private void tmrCheckInternet_Tick(object sender, EventArgs e) { this.tmrCheckInternet.Stop(); this._checkInternetThread = new Thread(delegate() { if (TwitterDownloader.CheckForInternetConnection()) { this.btnStart.Enabled = true; this.tbUserName.Focus(); new Thread(delegate() { Thread.Sleep(10000); if (this._isAutoStart) { this.btnStart.Invoke(new MethodInvoker(delegate { this.btnStart.PerformClick(); })); } }).Start(); } else { this.tmrCheckInternet.Interval = 5000; MessageBox.Show(strings.UnableAccess, strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); this.tmrCheckInternet.Start(); } }) { Priority = ThreadPriority.Lowest }; this._checkInternetThread.Start(); }
private async void btnStart_ClickAsync(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.tbSavePath.Text) || string.IsNullOrEmpty(this.tbUserName.Text)) { MessageBox.Show(strings.FillTheFields, strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } this.tbUserName.Text = TwitterDownloader.FixUserName(this.tbUserName.Text); this.DisEnControls(); this.tmrProgress.Start(); await this.WorkAsync(); }
public FrmMain(string[] args) { this.LoadSettings(); Thread.CurrentThread.CurrentUICulture = new CultureInfo(this._language); this.InitializeComponent(); CheckForIllegalCrossThreadCalls = false; this._possibleProgressInTaskBar = Environment.OSVersion.Version >= new Version(6, 1); // if version current version >= win7 this.tbSavePath.Text = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\TwitterPhotoDownloader"; this._twitterDownloader = new TwitterDownloader(); Dictionary <string, string> paramsDict = this.ParseParameters(args); this.SetFieldValuesByParams(paramsDict); }