示例#1
0
        /// <summary>
        /// 系统托盘图标初始化程序
        /// </summary>
        public static void NotifyIcon_Init()
        {
            NI = new System.Windows.Forms.NotifyIcon();

            NI.Icon = Properties.Resources.favicon;
            NI.Text = "录播姬";

            //打开菜单项
            System.Windows.Forms.MenuItem open = new System.Windows.Forms.MenuItem("显示主窗口");
            open.Click += new EventHandler((s, e) => { Application.Current.MainWindow.Show(); Application.Current.MainWindow.Activate(); });

            //设置菜单项
            System.Windows.Forms.MenuItem setting = new System.Windows.Forms.MenuItem("设置");
            setting.Click += new EventHandler((s, e) => { SettingWindow ss = new SettingWindow(); ss.Show(); });

            //检查更新菜单项
            System.Windows.Forms.MenuItem checkupdate = new System.Windows.Forms.MenuItem("检查更新");
            checkupdate.Click += new EventHandler((s, e) => { });

            //关于菜单项
            System.Windows.Forms.MenuItem about = new System.Windows.Forms.MenuItem("关于");
            about.Click += new EventHandler((s, e) => { AboutWindow a = new AboutWindow(); a.ShowDialog(); });

            //退出菜单项
            System.Windows.Forms.MenuItem exit = new System.Windows.Forms.MenuItem("退出");
            exit.Click += new EventHandler((s, e) => { Bas.Exit(); });

            //关联托盘控件
            System.Windows.Forms.MenuItem[] childen = new System.Windows.Forms.MenuItem[] { open, setting, checkupdate, about, exit };
            NI.ContextMenu = new System.Windows.Forms.ContextMenu(childen);

            NI.Click             += new EventHandler((s, e) => { Application.Current.MainWindow.Show(); Application.Current.MainWindow.Activate(); });
            NI.BalloonTipClicked += new EventHandler((s, e) => { Application.Current.MainWindow.Show(); Application.Current.MainWindow.Activate(); });

            NI.Visible = true;
        }
示例#2
0
        /// <summary>
        /// 设置按钮点击
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Btn_ShowSettingWindow_Click(object sender, RoutedEventArgs e)
        {
            SettingWindow s = new SettingWindow();

            s.Show();
        }