Exemple #1
0
 public WindowBase()
 {
     InitializeStyle();
     FullScreenManager.RepairWpfWindowFullScreenBehavior(this);
     this.SourceInitialized += delegate(object sender, EventArgs e)
     {
         this._HwndSource = PresentationSource.FromVisual((Visual)sender) as HwndSource;
     };
     this.Loaded += delegate
     {
         InitializeEvent();
     };
 }
 public WaitingForm()
 {
     InitializeComponent();
     this.Background = CommonUtil.From16JinZhi("#4F000000");
     // 这句话是防止弹出窗口挡住桌面的工具栏
     FullScreenManager.RepairWpfWindowFullScreenBehavior(this);
     try
     {
         this.Owner = Application.Current.MainWindow;
     }
     catch
     {
     }
 }
Exemple #3
0
        public MainWindow(IDsEnvironment dsEnvironment, IDsConfigurationSection dsconfig)
        {
            InitializeComponent();

            dsNotifications.Top  = SystemParameters.WorkArea.Height - topOffset;
            dsNotifications.Left = SystemParameters.WorkArea.Left + SystemParameters.WorkArea.Width - leftOffset;
            DsEnvironment        = dsEnvironment;

            /////这里是在初始化加载控件之前就已经做了,故使用配置的方式进行加载
            ////1、创建默认主题(默认情况下是DeepBlue)
            if (dsconfig.Themes.Count > 0)
            {
                foreach (ThemeElement item in dsconfig.Themes)
                {
                    ThemeManage.CurrentTheme = item.Name;
                    break;
                }
            }
            System.Windows.Application.Current.Resources.MergedDictionaries.Clear();
            ////2、加载控件的样式
            foreach (ModuleConfigurationElement module in dsconfig.Modules)
            {
                string assemblyfile = module.AssemblyFile.Substring(module.AssemblyFile.LastIndexOf('/') + 1);
                string path         = assemblyfile.Substring(0, assemblyfile.LastIndexOf('.'));
                ThemeManage.EnsureApplicationResources(ThemeManage.CurrentTheme, path);
            }
            //////这部分代码怎么实现的问题---gefx
            //if (dsEnvironment.AddinInfos == null || dsEnvironment.AddinInfos.Count <= 0)
            //    DsEnvironment = ParentContaioner.GetObject<IDsEnvironment>();

            //foreach (AddinInfo addininfo in DsEnvironment.AddinInfos.Values)
            //{
            //    ////这里又有一个问题就是命名空间要更程序集的名称对应,不然的话就需要截取字符串的形式啦!!
            //    string assemblyname = addininfo.AddinNameSpace;
            //    ThemeManage.EnsureApplicationResources(ThemeManage.CurrentTheme, assemblyname);
            //}
            #region Debug
            //base.SetWindowTheme("DeepBlue", "DS.AFP.UIFramework");
            #endregion

            App.iconMouseEvent += App_iconMouseEvent;

            FullScreenManager.RepairWpfWindowFullScreenBehavior(this);
        }
Exemple #4
0
        public MainWindow()
        {
            InitializeComponent();
            AppSet.AppMainWindow = this;
            //以下代码,修复窗体全屏时覆盖任务栏以及大小不正确问题。
            FullScreenManager.RepairWpfWindowFullScreenBehavior(this);
            //设定升级检测定时器
            _UpdateAppTimer       = new System.Windows.Threading.DispatcherTimer();
            _UpdateAppTimer.Tick += new EventHandler(async(x, y) =>
            {
                await CheckAppUpdateAsync();
            });
            _UpdateAppTimer.Interval = new TimeSpan(0, 0, 0);

            //设定网络状态检测定时器
            _CheckNetStateTimer       = new System.Windows.Threading.DispatcherTimer();
            _CheckNetStateTimer.Tick += new EventHandler(async(x, y) =>
            {
                await CheckNetStateAsync();
            });
            _CheckNetStateTimer.Interval = new TimeSpan(0, 0, 10);

            #region 显示系统托盘图标
            //系统托盘显示
            this.notifyIcon = new NotifyIcon();
            this.notifyIcon.BalloonTipText = "系统监控中... ...";
            this.notifyIcon.ShowBalloonTip(2000);
            this.notifyIcon.Text = "政工业务工作平台";
            //this.notifyIcon.Icon = new System.Drawing.Icon(@"AppIcon.ico");
            this.notifyIcon.Icon    = System.Drawing.Icon.ExtractAssociatedIcon(System.Windows.Forms.Application.ExecutablePath);
            this.notifyIcon.Visible = true;
            //托盘右键菜单项
            this.notifyIcon.ContextMenuStrip        = new ContextMenuStrip();
            this.notifyIcon.ContextMenuStrip.Height = 300;
            this.notifyIcon.ContextMenuStrip.Items.Add("显示主窗口", null, (sender, eventArgs) =>
            {
                if (WinLockDialog.ThisWinObj != null)
                {
                    //说明该锁定窗口已经打开
                    WinLockDialog.ThisWinObj.Activate();
                    return;
                }
                if (AppSet.AppIsLocked)
                {
                    WinLockDialog wld = new WinLockDialog();
                    if (!wld.ShowDialog().Value)
                    {
                        return;
                    }
                }
                AppSet.AppIsLocked = false;
                this.Visibility    = System.Windows.Visibility.Visible;
                this.ShowActivated = true;
                this.ShowInTaskbar = true;
                this.WindowState   = WindowState.Maximized;
                this.Activate();
            });
            this.notifyIcon.ContextMenuStrip.Items.Add("关闭显示器", null, (sender, eventArgs) =>
            {
                CloseScreen.Close();
            });
            this.notifyIcon.ContextMenuStrip.Items.Add("锁定软件", null, (sender, eventArgs) =>
            {
                LockApp();
            });
            this.notifyIcon.ContextMenuStrip.Items.Add("关闭程序", null, (sender, eventArgs) =>
            {
                ShutDownApp();
            });
            //托盘双击响应
            this.notifyIcon.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler((o, e) =>
            {
                if (e.Button == MouseButtons.Left)
                {
                    this.notifyIcon.ContextMenuStrip.Items[0].PerformClick();
                }
            });
            #endregion
        }
Exemple #5
0
 public Window()
 {
     this.Style = (Style)Application.Current.Resources["VSWindowStyle"];
     FullScreenManager.RepairWpfWindowFullScreenBehavior(this);
     this.Loaded += DefaultWindow_Loaded;
 }