Пример #1
0
        private static bool HandleSquirrel(string[] args)
        {
            if (args.Any(a => a.StartsWith("--squirrel")))
            {
                log.Info("Squirrel handling started...");
                log.Info("Received events: " + string.Join(',', args.Where(a => a.StartsWith("--squirrel"))));

                if (args.Any(a => a == "--squirrel-firstrun"))
                {
                    log.Info("First run, doing nothing");
                    return(false);
                }

                if (args.Any(a => a == "--squirrel-uninstall") && ExplorerIntegrationHandler.IsEnabled())
                {
                    log.Info("Trying to disable ExplorerIntegration");
                    try
                    {
                        ExplorerIntegrationHandler.Disable();
                    }
                    catch (Exception e)
                    {
                        log.Error("Error while disabling ExplorerIntegration", e);
                    }
                }

                log.Info("Exiting after handling Squirrel");
                return(true);
            }
            return(false);
        }
Пример #2
0
        private async void SettingsTabCtrl_TabIndexChangedAsync(object sender, EventArgs e)
        {
            if (SettingsTabCtrl.SelectedIndex == 3)
            {
                TwoFaCheckbox.CheckedChanged -= TwoFaCheckbox_CheckedChangedAsync;

                //account tab -> load settings
                TwoFaCheckbox.Checked = await clientManager.GetHasTwoFaEnabled();

                //settings loaded enable buttons
                TwoFaCheckbox.Enabled = true;

                TwoFaCheckbox.CheckedChanged += TwoFaCheckbox_CheckedChangedAsync;
            }
            else
            {
                //hide the qrcode and lable
                picture_qr.Visible = false;
                scanLable.Visible  = false;
            }

            if (SettingsTabCtrl.SelectedIndex == 2)
            {
                ExplorerIntegrationBox.Checked = ExplorerIntegrationHandler.IsEnabled();
                autostartCheckbox.Checked      = AutostartHandler.IsEnabled();
            }
        }
Пример #3
0
 private void ExplorerIntegrationBox_CheckedChanged(object sender, EventArgs e)
 {
     if (ExplorerIntegrationBox.Checked)
     {
         ExplorerIntegrationBox.Checked = ExplorerIntegrationHandler.Enable();
     }
     else
     {
         ExplorerIntegrationHandler.Disable();
     }
 }
Пример #4
0
        static void Main(string[] args)
        {
            var f = new FileInfo(System.Reflection.Assembly.GetEntryAssembly().Location);

            Directory.SetCurrentDirectory(f.Directory.FullName);

            var rollingFileAppender = new RollingFileAppender()
            {
                Layout             = new PatternLayout("%date{HH:mm:ss} [%thread] %-3level %logger - %message%newline"),
                File               = "rollingLog.txt",
                AppendToFile       = true,
                MaximumFileSize    = "100KB",
                MaxSizeRollBackups = 2
            };

            rollingFileAppender.ActivateOptions();

            BasicConfigurator.Configure(
                new ConsoleAppender(),
                rollingFileAppender
                );

            if (HandleSquirrel(args))
            {
                return;
            }

            var configFileMap = new ExeConfigurationFileMap();

#if DEBUG
            configFileMap.ExeConfigFilename = "App.Release.config";
#else
            configFileMap.ExeConfigFilename = "App.Release.config";
#endif
            Config.Configuration = ConfigurationManager.OpenMappedExeConfiguration(configFileMap, ConfigurationUserLevel.None);



            log.Info("Starting...");

            log.Info("Working Directory: " + Directory.GetCurrentDirectory());

            Application.ThreadException += Application_ThreadException;

            Task.Run(Update);


            if (PipeHandler.IsServer)
            {
                ExplorerIntegrationHandler.Init();
                AutostartHandler.Init();

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new IconHandler(args));
            }
            else
            {
                PipeHandler.SendMessage(args);
            }
        }