Exemplo n.º 1
0
        private static void Main(string[] args)
        {
            Shellscape.Program.MainInstanceStarted += delegate() {
                Shellscape.Remoting.RemotingTaskMethods.Methods.Add("mailto", delegate(String[] arguments) { Forms.Main.Remote_Mailto(arguments); });

                AppDomain.CurrentDomain.UnhandledException += delegate(object sender, UnhandledExceptionEventArgs e) {
                    ErrorHelper.Report(e.ExceptionObject as Exception);
                };

                Config.Init();

                Shellscape.UpdateManager updates = new Shellscape.UpdateManager(_repoUser, _repoName, _repoName, _repoName);

                updates.Error += delegate(object sender, UnhandledExceptionEventArgs e) {
                    if (e.ExceptionObject is System.Net.WebException)
                    {
                        if (e.ExceptionObject != null)
                        {
                            ErrorHelper.Log(e.ExceptionObject as Exception, Guid.NewGuid());
                        }
                        return;
                    }

                    ErrorHelper.Report(e.ExceptionObject as Exception);
                };

                SystemEvents.SessionEnded += delegate(object sender, SessionEndedEventArgs e) {
                    Shellscape.UpdateManager.Current.Stop();
                    Application.Exit();
                };
            };

            Shellscape.Program.Run <GmailNotifierPlus.Forms.Main>(args);
        }
Exemplo n.º 2
0
        private static void Main(string[] args)
        {
            bool createdNew;

            channelName = String.Concat(WindowsIdentity.GetCurrent().Name, "@GmailNotifierPlus");

            Program.Icon = Utilities.ResourceHelper.GetIcon("gmail-classic.ico");

            String guid = "{421a0043-b2ab-4b86-8dec-63ce3b8bd764}";
            String name = String.Concat(@"Local\GmailNotifierPlus", guid);

            using (new Mutex(true, name, out createdNew)) {
                if (!createdNew)
                {
                    if (args.Length > 0)
                    {
                        CallRunningInstance(args);
                    }
                }
                else
                {
                    InitRemoting();

                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    Application.ThreadException += Application_ThreadException;

                    AppDomain appDomain = AppDomain.CurrentDomain;
                    appDomain.UnhandledException += AppDomain_UnhandledException;

                    Form startForm = null;

                    try {
                        Config.Init();

                        startForm = mainForm = new GmailNotifierPlus.Forms.Main(args);
                        //startForm = new GmailNotifierPlus.Forms.ToastTest();
                    }
                    catch (Exception e) {
                        Application_ThreadException(null, new System.Threading.ThreadExceptionEventArgs(e));
                    }

                    Application.Run(startForm);
                }
            }
        }