コード例 #1
0
        public void InitializeComponent()
        {
            try
            {
                this.notifyIcon          = new NotifyIcon();
                this.configWindow        = VMSMainForm.GetInstance();
                this.configMenuItem      = new ToolStripMenuItem("Cấu hình", global::VMS.Server.Monitor.Properties.Resources.WindowImage);
                this.configMenuItem.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.runMenuItem         = new ToolStripMenuItem("Bật", global::VMS.Server.Monitor.Properties.Resources.RunImage, configWindow.RunServiceButton_Click);
                this.stopMenuItem        = new ToolStripMenuItem("Tắt", global::VMS.Server.Monitor.Properties.Resources.StopImage, configWindow.StopServiceButton_Click);
                this.startUpMenuItem     = new ToolStripMenuItem("Mở cửa sổ sau khi khởi động Windows");
                this.startTypeMenuItem   = new ToolStripMenuItem("Khởi động chương trình cùng Windows");
                this.exitMenuItem        = new ToolStripMenuItem("Thoát", global::VMS.Server.Monitor.Properties.Resources.ExitImage);
                var contextMenu = new ContextMenuStrip();
                contextMenu.Items.AddRange(new ToolStripItem[] { configMenuItem, new ToolStripSeparator(), runMenuItem, stopMenuItem, new ToolStripSeparator(), startTypeMenuItem, startUpMenuItem, new ToolStripSeparator(), exitMenuItem });

                notifyIcon.Visible          = true;
                notifyIcon.Icon             = VMS.Server.Monitor.Properties.Resources.ApplicationServerRunning;
                notifyIcon.ContextMenuStrip = contextMenu;
            }
            catch (Exception ex)
            {
                log.Error("Exception(" + MethodBase.GetCurrentMethod().Name + "): " + ex);
                throw new Exception(ex.Message);
            }
        }
コード例 #2
0
ファイル: VMSMainForm.cs プロジェクト: hanigamal/rb-vms
 public static VMSMainForm GetInstance()
 {
     try
     {
         instance = instance ?? new VMSMainForm();
         return instance;
     }
     catch (Exception ex)
     {
         log.Error("Exception(" + MethodBase.GetCurrentMethod().Name + "): " + ex);
         throw new Exception(ex.Message);
     }
 }
コード例 #3
0
ファイル: VMSMainForm.cs プロジェクト: hanigamal/rb-vms
 public static VMSMainForm GetInstance()
 {
     try
     {
         instance = instance ?? new VMSMainForm();
         return(instance);
     }
     catch (Exception ex)
     {
         log.Error("Exception(" + MethodBase.GetCurrentMethod().Name + "): " + ex);
         throw new Exception(ex.Message);
     }
 }