Ejemplo n.º 1
0
 public App()
 {
     System.Windows.Forms.Application.EnableVisualStyles();
     //AppDomain.CurrentDomain.AssemblyLoad += new AssemblyLoadEventHandler(AppDomain_CurrentDomain_AssemblyLoad);
     
     System.Windows.Forms.Application.ApplicationExit += delegate(object sender, EventArgs e)
     {
         Settings.Save();
     };
     
     splash = new XMail.Forms.SplashScreenForm();
     splash.Show();
     System.Windows.Forms.Application.DoEvents();
     
     splash.SetMessage("Loading accounts...");
     Settings.Load();
     if (Settings.Account.Count == 0)
     {
         splash.Visible = false;
         Forms.AddAccountForm aaf = new Forms.AddAccountForm();
         aaf.ShowDialog();
         splash.Visible = true;
         AccountSettings.AccountInfo ac = aaf.NewAccountInfo;
         Settings.Account.Add(ac);
     }
     StaticManager.Connect();
     splash.SetMessage("Creating user interface...");
     MainWindow a = XMail.MainWindow.Instance;
     splash.Close();
     a.ShowDialog();
     try{ // ugh. TODO: remove this requirement
         
         Tasks.TaskManager.StopAll();
         StaticManager.Disconnect();
     }catch(Exception){}
     Settings.Save();
     XMail.MainWindow.Instance.NotifyIcon.Dispose();
 }
Ejemplo n.º 2
0
        // set up new email account
        private void MenuItem_Click_1(object sender, RoutedEventArgs e)
        {
            Forms.AddAccountForm f = new Forms.AddAccountForm();
            f.ShowDialog();
            if (f.DialogResult == System.Windows.Forms.DialogResult.Cancel)
                return;
            foreach (string fn in Directory.GetFiles(System.Windows.Forms.Application.LocalUserAppDataPath + "\\..\\Messages"))
                File.Delete(fn);
            foreach (string fn in Directory.GetFiles(System.Windows.Forms.Application.LocalUserAppDataPath + "\\..\\SentMessages"))
                File.Delete(fn);

            Classes.Settings.Account.RemoveAt(0);
            Classes.Settings.Account.Add(f.NewAccountInfo);
            Classes.Settings.Save();
        }