示例#1
0
 private void ContextMenuBuilder(List <ToolStripMenuItem> _listContextMenuItems)
 {
     if (_listContextMenuItems != null)
     {
         _listContextMenuItems.Add(CustomApplicationContext.CreateStripMenuItem(1, "Show &Details", Item_Click));
     }
 }
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     var applicationContext = new CustomApplicationContext();
     Application.Run(applicationContext);
 }
示例#3
0
 private void ContextMenuBuilder(List <ToolStripMenuItem> _listContextMenuItems)
 {
     if (_listContextMenuItems != null)
     {
         _listContextMenuItems.Add(CustomApplicationContext.CreateStripMenuItem(1, C_Settings, Item_Settings));
     }
 }
示例#4
0
 public TrayManager()
 {
     CustomApplicationContext.InitCustomApplicationContext(Assembly.GetExecutingAssembly().GetName().Name
                                                           , Backupper.Properties.Resources.Backupper.ToBitmap(), ContextMenuBuilder
                                                           , OnOpen
                                                           , OnDoubleClick
                                                           , OnExit
                                                           , C_OPEN);
 }
示例#5
0
 public ManagerClass()
 {
     CustomApplicationContext.InitCustomApplicationContext("asdasdad"
                                                           , TrayUIFrameworkTest.Properties.Resources.Flickr_1
                                                           , ContextMenuBuilder
                                                           , OnOpen
                                                           , OnDoubleClick
                                                           , OnExit
                                                           , "&Open App");
 }
示例#6
0
 public AppContextManager()
 {
     CustomApplicationContext.InitCustomApplicationContext("SKFlickrSyncUI"
                                                           , SKFlickrSyncUI.Properties.Resources.Flickr_1
                                                           , ContextMenuBuilder
                                                           , OnOpen
                                                           , OnDoubleClick
                                                           , OnExit
                                                           , "&Open App");
 }
示例#7
0
        static void Main()
        {
            if (!SingleInstance.Start()) return;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var applicationContext = new CustomApplicationContext();
            Application.Run(applicationContext);
            SingleInstance.Stop();
        }
示例#8
0
        static void Main()
        {
            if (!SingleInstance.Start())
            {
                return;
            }

            log4net.Config.XmlConfigurator.Configure();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            try
            {
                var applicationContext = new CustomApplicationContext();
                Application.Run(applicationContext);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Program Terminated Unexpectedly",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            SingleInstance.Stop();
        }
示例#9
0
        public static void Main_WinTrayApp(CustomApplicationContext _CustomApplicationContext, string _sApplicationName, bool _bShouldRunAsSingleInstance)
        {
            try
            {
                bool createdNew = true;

                Process currentProcess = Process.GetCurrentProcess();
                string  sAppName       = (string.IsNullOrWhiteSpace(_sApplicationName) == true) ? currentProcess.ProcessName : _sApplicationName.RemoveWhiteSpace();

                using (Mutex mutex = new Mutex(true, sAppName, out createdNew))
                {
                    // SKislyuk 11/3/2016 2:23:09 PM
                    // if the app can run as multiple instances app then disregard the mutex
                    createdNew = (_bShouldRunAsSingleInstance == true) ? createdNew : true;

                    if (createdNew)
                    {
                        if (_CustomApplicationContext == null)
                        {
                            throw new Exception("The CustomApplicationContext class is not initialized.");
                        }

                        Application.Run(_CustomApplicationContext);
                    }
                    else
                    {
                        ShowProcess();
                    }
                }
            }
            catch (Exception exp)
            {
                Logger.WriteErrorLogOnly(exp, "b4d12487-4e99-4ed9-a9f4-38e02de2f41f");
                Logger.DisplayError(exp.Message);
            }
        }
 private void Exit_Click(object sender, EventArgs args)
 {
     s_MainForm.Close();
     CustomApplicationContext.Exit();
 }
示例#11
0
        //################################################################################
        #region Private Members

        private void InitializeComponent()
        {
            ContainerPanel.SuspendLayout();
            SuspendLayout();

            #region Container Panel

            ContainerPanel.Margin        = new Padding(0);
            ContainerPanel.Padding       = new Padding(0);
            ContainerPanel.Location      = new Point(0, 0);
            ContainerPanel.FlowDirection = FlowDirection.LeftToRight;

            #endregion

            #region Logo Button

            void HideAction(Control button)
            {
                button.DoubleClick += (sender, arg) =>
                {
                    ParentControl.Visible = false;
                };
            }

            LogoButton = new ImageButton(HideAction, Resources.Logo)
            {
                Margin = new Padding(0, 0, Style.PanelSpacing, 0)
            };
            LogoButton.SetToolTip("Handy Box App v2.4");
            LogoButton.SetBackgroundColor(Color.FromArgb(226, 87, 76));

            #endregion

            #region Title Label

            TitleLabel.Name = $"TitleLabel";
            TitleLabel.Text = $@"Handy Box App v2.4  ";
            //TitleLabel.Width = 190 - LogoButton.Width;
            TitleLabel.AutoSize  = true;
            TitleLabel.Margin    = new Padding(0, 0, Style.PanelSpacing, 0);
            TitleLabel.Padding   = new Padding(Style.PanelPadding);
            TitleLabel.TextAlign = ContentAlignment.MiddleLeft;
            TitleLabel.Font      = new Font(new FontFamily(Style.FontName), Style.PanelFontSize, FontStyle.Bold);
            Painter <Black> .Paint(TitleLabel, PaintMode.Dark);

            TitleLabel.MouseDown += DragAndDrop;

            #endregion

            #region Close Button

            void CloseAction(Control button)
            {
                button.Click += (sender, args) =>
                {
                    ((MainForm)ParentControl).Close();
                    CustomApplicationContext.Exit();
                };
            }

            CloseButton = new ImageButton(CloseAction, Resources.Close)
            {
                Margin = new Padding(0)
            };
            CloseButton.SetToolTip("Close");
            CloseButton.SetBackgroundColor(Color.FromArgb(201, 54, 54));

            #endregion

            #region Title Panel

            Name          = "TitlePanel";
            AutoSize      = true;
            Margin        = new Padding(0, 0, 0, Style.PanelSpacing);
            BackColor     = Color.FromArgb(100, 100, 100);
            BorderStyle   = BorderStyle.FixedSingle;
            AutoScaleMode = AutoScaleMode.Font;

            #endregion

            ContainerPanel.Controls.Add(LogoButton);
            ContainerPanel.Controls.Add(TitleLabel);
            ContainerPanel.Controls.Add(CloseButton);
            Controls.Add(ContainerPanel);

            ContainerPanel.ResumeLayout(false);
            ContainerPanel.PerformLayout();
            ResumeLayout(false);
        }
示例#12
0
 public static void Main_WinTrayApp(CustomApplicationContext _CustomApplicationContext, string _sApplicationName)
 {
     Main_WinTrayApp(_CustomApplicationContext, _sApplicationName, false);
 }