zoukankan      html  css  js  c++  java
  • XAF 如何使用AlertControl?

    http://www.devexpress.com/Support/Center/e/E1041.aspx

    using System;
    using System.Windows.Forms;
    using DevExpress.ExpressApp;
    using DevExpress.XtraBars.Alerter;
    using DevExpress.ExpressApp.Utils;

    namespace WinSolution.Module {
        
    public class ShowAlertControlMainWindowController : WindowController {
            
    private AlertControl alertControlCore;
            
    private Timer alertTimerCore;
            
    public ShowAlertControlMainWindowController() {
                TargetWindowType 
    = WindowType.Main;
            }
            
    protected override void OnActivated() {
                
    base.OnActivated();
                InitAlertControlCore();
                InitAlertTimerCore();
            }
            
    protected virtual void InitAlertControlCore() {
                alertControlCore 
    = new AlertControl();
            }
            
    protected virtual void InitAlertTimerCore() {
                alertTimerCore 
    = new Timer();
                alertTimerCore.Tick 
    += alertTimerCore_Tick;
                alertTimerCore.Interval 
    = 2000;
                alertTimerCore.Start();
            }
            
    private void alertTimerCore_Tick(object sender, EventArgs e) {
                ShowAlertInfo();
            }
            
    protected override void OnDeactivating() {
                
    if (alertTimerCore != null)
                    alertTimerCore.Stop();
                
    base.OnDeactivating();
            }
            
    protected virtual void ShowAlertInfo() {
                Form mainForm 
    = (Form)Application.MainWindow.Template;
                AlertInfo info 
    = new AlertInfo("Frohe Weihnachten! (Merry Christmas!)", DateTime.Now.ToString(), ImageLoader.Instance.GetImageInfo("Attention").Image);
                AlertControl.Show(mainForm, info);
            }
            
    public AlertControl AlertControl { get { return alertControlCore; } }
            
    public Timer AlertTimer { get { return alertTimerCore; } }
        }
    }

    欢迎转载,转载请注明出处:http://www.cnblogs.com/Tonyyang/

  • 相关阅读:
    结构体struct和typedef后面接指针的含义
    C++中关于指针初始化和使用NULL的理解
    (虚)继承类的内存占用大小
    为什么构造函数不能为虚函数
    C++中变量自动初始化的问题
    CY7C68013A的一点总结
    Altium designer总结
    在Linux系统上限制远程登录的IP
    linux系统如何限制其他用户登录
    使用秘钥对登录Linux系统
  • 原文地址:https://www.cnblogs.com/Tonyyang/p/1806637.html
Copyright © 2011-2022 走看看