void CheckDefaultMailClientState()
		{
			var settings = SettingsManager.ClientSettings.AppConfiguration;

			if (!settings.IsJustRegistered && settings.IsDefaultMailClientCheckEnabled)
			{
				// Check if Inbox2 is the default mail client
				var handler = new DefaultMailClientHandler();

				if (!handler.IsDefaultMailClient())
				{
					var result = Inbox2MessageBox.Show(Strings.NotYourDefaultMailClient, Inbox2MessageBoxButton.YesNo,
													   Strings.AlwaysPerformThisCheckDuringStartup, true);

					settings.IsDefaultMailClientCheckEnabled = result.DoNotAskAgainResult;
					SettingsManager.Save();

					if (result.Result == Inbox2MessageBoxResult.Yes)
					{
						var executable = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "Inbox2DefaultMailClient.exe");

						try
						{
							// Start set default mail client process as administrator if needed
							new Process { StartInfo = new ProcessStartInfo(executable) { UseShellExecute = true, Verb = "runas" } }.Start();
						}
						catch (Exception ex)
						{
							Logger.Error("An error has occured while trying to start process. Exception = {0}", LogSource.UI, ex);
						}
					}
				}
			}
		}
Esempio n. 2
0
        void CheckNow_Click(object sender, RoutedEventArgs e)
        {
            // Check if Inbox2 is the default mail client
            var handler = new DefaultMailClientHandler();

            if (!handler.IsDefaultMailClient())
            {
                var result = Inbox2MessageBox.Show(Strings.NotYourDefaultMailClient, Inbox2MessageBoxButton.YesNo);

                if (result.Result == Inbox2MessageBoxResult.Yes)
                {
                    var executable = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "Inbox2DefaultMailClient.exe");

                    try
                    {
                        // Start set default mail client process as administrator if needed
                        new Process {
                            StartInfo = new ProcessStartInfo(executable)
                            {
                                UseShellExecute = true, Verb = "runas"
                            }
                        }.Start();
                    }
                    catch (Exception ex)
                    {
                        Logger.Error("An error has occured while trying to start process. Exception = {0}", LogSource.UI, ex);
                    }
                }
            }
            else
            {
                Inbox2MessageBox.Show(Strings.AlreadyDefaultMailClient, Inbox2MessageBoxButton.OK);
            }
        }