public static void OpenUrl(Uri url) { ProcessStartHelper.Start(url.AbsoluteUri); /*if(url.AbsoluteUri.Contains("wikipedia.org") || url.AbsoluteUri.Contains("wiktionary.org") || url.AbsoluteUri.StartsWith("http://click.adbrite.com/mb/click.php?") || ) || ProcessStartHelper.Start(url.AbsoluteUri); || else || ProcessStartHelper.Start(Constants.RedirectPageUrl + "?l=" + HttpUtility.UrlEncode(url.AbsoluteUri)); */ }
void OptionsFormHelpButtonClicked(object sender, System.ComponentModel.CancelEventArgs e) { ProcessStartHelper.Start(Constants.OptionsHelpUrl); e.Cancel = true; }
void TimerUpdateTick(object sender, EventArgs e) { switch (UpdatesManager.State) { case UpdateState.None: lStatus.Text = TranslateString("Preparing"); break; case UpdateState.CheckVersion: lStatus.Text = TranslateString("Check version"); break; case UpdateState.UpdateDownloading: lStatus.Text = string.Format(CultureInfo.InvariantCulture, TranslateString("Downloaded {0}Kb from {1}Kb with speed {2}Kb/s"), UpdatesManager.KBReceived, UpdatesManager.TotalKBToReceive, UpdatesManager.DownloadSpeedKBPerSecond) + "\r\n" + UpdatesManager.FileName; pbMain.Style = ProgressBarStyle.Blocks; pbMain.Value = (int)UpdatesManager.ProgressPercentage; break; case UpdateState.UpdateDownloaded: lStatus.Text = TranslateString("Update downloaded"); timerUpdate.Enabled = false; pbMain.Visible = false; if (WindowState == FormWindowState.Minimized) { WindowState = FormWindowState.Normal; } Activate(); if (UpdatesManager.CanRunUpdate && MessageBox.Show(this, TranslateString("New version is downloaded. Do you want to stop " + Constants.AppName + " and run installer of new version ?"), Constants.AppName, MessageBoxButtons.YesNo) == DialogResult.Yes) { UpdatesManager.RunUpdate(); } else { SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "Exe files (*.exe)|*.exe"; sfd.FilterIndex = 1; sfd.DefaultExt = "exe"; sfd.FileName = UpdatesManager.FileName; sfd.Title = TranslateString("Please select where to save installer of new version which you can run later"); if (sfd.ShowDialog(this) == DialogResult.OK) { UpdatesManager.SaveUpdate(sfd.FileName); } else { UpdatesManager.DeleteUpdate(); } lStatus.Text = UpdatesManager.Message; timerClose.Enabled = true; } break; case UpdateState.Ending: case UpdateState.Error: lStatus.Text = UpdatesManager.Message; timerUpdate.Enabled = false; timerClose.Enabled = true; pbMain.Visible = false; break; case UpdateState.NewVersionExists: timerUpdate.Enabled = false; lStatus.Text = string.Format(CultureInfo.InvariantCulture, TranslateString("New version {0} of {1} available"), UpdatesManager.VersionOnSite, Constants.AppName); if (MessageBox.Show(this, string.Format(CultureInfo.InvariantCulture, TranslateString("New version {0} of {1} available"), UpdatesManager.VersionOnSite, Constants.AppName ) + ".\r\n" + TranslateString("Do you want to open site where you can download it ?"), Constants.AppName, MessageBoxButtons.YesNo) == DialogResult.Yes ) { string url = Constants.DownloadUrlBase; if (FreeCL.RTL.LangPack.CurrentLanguage == "Ukrainian") { url += "uk.html"; } else if (FreeCL.RTL.LangPack.CurrentLanguage == "Russian") { url += "ru.html"; } else { url += "en.html"; } ProcessStartHelper.Start(url); } UpdatesManager.UpdateCheckDone(); BCancelClick(sender, e); break; } }
void BDonateClick(object sender, EventArgs e) { ProcessStartHelper.Start(Constants.DonateUrl); }