Esempio n. 1
0
        //void latestWallpaperMenuItem_Click(object sender, EventArgs e)
        //{
        //    BackgroundWindow.ShouldForceShowWallpaperPreviewWindow = true;

        //    ShowBalloonTip("正在检测壁纸", "稍后会有提示...");
        //    if (!WallpaperChecker.Instance().IsChecking)
        //    {
        //        System.Threading.Thread checkWallpaperThread = new System.Threading.Thread(new System.Threading.ThreadStart(
        //           delegate
        //           {
        //               WallpaperChecker.Instance().BeginCheckWallpaper();
        //           }
        //         ));
        //        checkWallpaperThread.Start();
        //    }
        //}
        //void settingMenuItem_Click(object sender, EventArgs e)
        //{
        //    SettingsWindow.Instance().Show();
        //    SettingsWindow.Instance().Activate();
        //}
        #endregion
        // 退出
        private void ExitMenuItem_Click(object sender, EventArgs e)
        {
            Helper.Instance.AlertConfirm(null, "确定要退出托盘应用程序吗?", () =>
            {
                BackgroundWindow.ExitApp();
                NotifyIconHelper.Instance().Hide();
            });
        }
Esempio n. 2
0
        //应用程序启动前调用
        protected override void OnStartup(StartupEventArgs e)
        {
            this.ShutdownMode = ShutdownMode.OnExplicitShutdown;
            base.OnStartup(e);
            bool startupFlag;

            mutex = new Mutex(true, PM.ApplicationName, out startupFlag);
            if (!startupFlag)
            {
                if (!PM.IsMainWinShow)
                {
                    PM.IsMainWinShow = true;
                    //激活已运行实例
                }

                MessageBox.Show("程序已经启动!");
                Environment.Exit(0);
            }
            else
            {
                if (e.Args.Length > 0)//启动参数
                {
                }
                OnInit();

                View.Login login = new View.Login();

                if (login.ShowDialog() == true)
                {
                    MainWindow mainWindow = new MainWindow();
                    mainWindow.Show();
                }
                else
                {
                    BackgroundWindow.ExitApp();
                }
            }
        }
Esempio n. 3
0
        private Module.ReportModule _rpModule   = new Module.ReportModule();   //日志模板
        public MainWindow()
        {
            InitializeComponent();
            this.SourceInitialized += delegate(object sender, EventArgs e)
            {
                this._HwndSource = PresentationSource.FromVisual((Visual)sender) as HwndSource;
            };
            this.MouseMove += new MouseEventHandler(Window_MouseMove);
            XamlHelper.Instance.SetBackground(this.mainborder, PlanMGMT.Model.PM.AppBgImg);
            #region 窗体事件

            this.MouseLeftButtonDown += (s, e) =>
            {
                if (e.LeftButton == MouseButtonState.Pressed)
                {
                    this.DragMove();
                }
            };
            //窗体最小化
            this.btnMin.Click += (s, e) =>
            {
                this.WindowState = System.Windows.WindowState.Minimized;
                this.Visibility  = Visibility.Hidden;//最小化到托盘
            };
            //窗体关闭
            this.btnClose.Click += (s, e) =>
            {
                if (PlanMGMT.Model.PM.MinToTray)
                {
                    Minimized();
                    return;
                }
                BackgroundWindow.ExitApp();
            };
            #endregion
            #region 主菜单

            //首页
            this.btnMain.Click += (s, e) =>
            {
                if (this.brMain.Child != this._mmModule)
                {
                    this.brMain.Child = this._mmModule;
                }
            };
            //设置
            this.btnSet.Click += (s, e) =>
            {
                View.Config config = new View.Config();
                config.Owner = this;
                config.ShowDialog();
            };
            //记事
            //this.btnNote.Click += (s, e) =>
            //{
            //    if (this.brMain.Child != this._nlModule) this.brMain.Child = this._nlModule;
            //};
            //任务
            this.btnTask.Click += (s, e) =>
            {
                if (this.brMain.Child != this._rpModule)
                {
                    this.brMain.Child = this._rpModule;
                }
            };
            //计划
            this.btnPlan.Click += (s, e) =>
            {
                if (this.brMain.Child != this._plModule)
                {
                    this.brMain.Child = this._plModule;
                }
            };

            #endregion
            #region 弹出资讯

            if (Model.PM.ShowNews)
            {
                this.WindowState = System.Windows.WindowState.Minimized;
            }
            #endregion
            if (this.brMain.Child != this._plModule)
            {
                this.brMain.Child = this._plModule;
            }
            NotifyIconHelper.NotifyIcon.MouseClick += new System.Windows.Forms.MouseEventHandler(TaskBarLeftDown_Click);
            #region 接收消息
            //EsbHelper.Instance.BeginReceiveMessage();
            #endregion
        }