Start() публичный статический Метод

public static Start ( ) : void
Результат void
Пример #1
0
 private void Reconnect(bool checkForNewMails = true)
 {
     try {
         Imap.Stop();
         Imap.Start();
         if (checkForNewMails)
         {
             CheckNewMail();
         }
     } catch (Exception ex) {
         notifyIcon.ShowBalloonTip(500, "Ошибка соединения", ex.Message,
                                   ToolTipIcon.Error);
     }
 }
Пример #2
0
        public Dialog()
        {
            while (!Util.IsInternetConnected())
            {
                Thread.Sleep(TimeSpan.FromMinutes(5));
            }
            Util.CheckInitRegistry();

            InitializeComponent();
            IconOld   = notifyIcon.Icon;
            soundPath = Path.GetDirectoryName(
                Assembly.GetExecutingAssembly().Location) + @"\Notify.wav";
            if (!File.Exists(soundPath))
            {
                soundPath = Environment.GetFolderPath(Environment.SpecialFolder.Windows) +
                            @"\Media\Windows Notify.wav";
            }
            Location = new Point(
                Screen.PrimaryScreen.WorkingArea.Width - Width,
                Screen.PrimaryScreen.WorkingArea.Height - Height);
            NetworkChange.NetworkAvailabilityChanged += new NetworkAvailabilityChangedEventHandler(OnNetworkAvailabilityChanged);
            SystemEvents.PowerModeChanged            += new PowerModeChangedEventHandler(OnPowerModeChanged);
            Imap.NewMessageEvent += new NewMessageEventHandler(OnNewMessage);

            var login = Environment.UserName + "@oblpro.ru";

            if (!(new Regex(@"\w+_\w{2}@oblpro\.ru").IsMatch(login)))
            {
                DisplayOkno();
                Environment.Exit(0);
            }

            var password = Util.GetPassword() ?? PromptPassword(login);

            Util.DeletePassword();
            while (!Imap.VerifyCredentials(login, password))
            {
                password = PromptPassword(login);
            }
            Util.SavePassword(password);
            Imap.SetCredentials(login, password);
            Imap.Start();
            CheckNewMail();
            timer.Enabled = true;
        }