public BeatmapPanelDownloadButton(IBeatmapSetInfo beatmapSet) { this.beatmapSet = beatmapSet; InternalChildren = new Drawable[] { shakeContainer = new ShakeContainer { RelativeSizeAxes = Axes.Both, Child = button = new DownloadButton { RelativeSizeAxes = Axes.Both, State = { BindTarget = State } }, }, DownloadTracker = new BeatmapDownloadTracker(beatmapSet) { State = { BindTarget = State } } }; button.Add(new DownloadProgressBar(beatmapSet) { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Depth = -1, }); }
private void configureView() { TitleViewLabel.Font = Styles.SetHelveticaBoldFont(18); DescriptionLabel.Font = Styles.SetHelveticaBoldFont(18); AlarmRequestLabel1.Font = Styles.SetHelveticaFont(15); AlarmRequestLabel2.Font = Styles.SetHelveticaFont(15); ConfirmLabel.Font = Styles.SetHelveticaFont(15); DownloadLabel.Font = Styles.SetHelveticaFont(15); NumberConfirmLabel.Font = Styles.SetHelveticaBoldFont(16); NumberRequestLabel.Font = Styles.SetHelveticaBoldFont(16); NumberDownloadLabel.Font = Styles.SetHelveticaBoldFont(16); DownloadButton.SetTitleColor(Colors.primaryRed, UIControlState.Normal); DownloadButton.Layer.BorderColor = UIColor.Black.CGColor; DownloadButton.Layer.BorderWidth = 1.0f; DownloadButton.Layer.CornerRadius = 4; ButtonMail.SetTitleColor(Colors.primaryRed, UIControlState.Normal); TitleViewLabel.Text = AppDelegate.LanguageBundle.GetLocalizedString("alarm_title"); DescriptionLabel.Text = AppDelegate.LanguageBundle.GetLocalizedString("alarm_description"); AlarmRequestLabel1.AttributedText = Styles.ConvertHTMLStyles(AppDelegate.LanguageBundle.GetLocalizedString("alarm_request_date_text_1"), AlarmRequestLabel1.Font.Name, AlarmRequestLabel1.Font.PointSize); AlarmRequestLabel2.Text = AppDelegate.LanguageBundle.GetLocalizedString("alarm_request_date_text_2"); ConfirmLabel.AttributedText = Styles.ConvertHTMLStyles(AppDelegate.LanguageBundle.GetLocalizedString("alarm_confirm_date"), ConfirmLabel.Font.Name, ConfirmLabel.Font.PointSize); DownloadLabel.AttributedText = Styles.ConvertHTMLStyles(AppDelegate.LanguageBundle.GetLocalizedString("alarm_download_skype"), DownloadLabel.Font.Name, DownloadLabel.Font.PointSize); DownloadButton.SetTitle(AppDelegate.LanguageBundle.GetLocalizedString("alarm_download_skype_link"), UIControlState.Normal); EmailButton.SetTitle(AppDelegate.LanguageBundle.GetLocalizedString("alarm_request_button"), UIControlState.Normal); ButtonMail.SetTitle(AppDelegate.LanguageBundle.GetLocalizedString("alarm_email"), UIControlState.Normal); }
void ReleaseDesignerOutlets() { if (DownloadButton != null) { DownloadButton.Dispose(); DownloadButton = null; } if (DownloadProgressBar != null) { DownloadProgressBar.Dispose(); DownloadProgressBar = null; } if (IdLabel != null) { IdLabel.Dispose(); IdLabel = null; } if (NameLabel != null) { NameLabel.Dispose(); NameLabel = null; } if (SlotNameLabel != null) { SlotNameLabel.Dispose(); SlotNameLabel = null; } }
//private bool fileDownloaded, fileExtracted = false; private void CheckQuranFiles() { Debug.Log("Checking Files..."); if (PlayerPrefs.GetInt("QuranDownloaded") != 114) { Downloader.SetActive(true); DownloadText.text = "(ﺖﻳﺎﺑﺎﺠﻴﻣ 160 ﻢﺠﺣ) ﻊﻗﻮﻤﻟﺍ ﻦﻣ نﺁﺮﻘﻟﺍ تﺎﻔﻠﻣ ﻞﻳﺰﻨﺗ ﻰﻟﺇ ﻖﻴﺒﻄﺘﻟﺍ جﺎﺘﺤﻳ"; DownloadButton.SetActive(true); DownloadButton.transform.GetChild(0).GetComponent <Text>().text = "ﻖﻓﺍﻮﻣ"; DownloadButton.GetComponent <Image>().color = Green; return; } if (PlayerPrefs.GetInt("QuranExtracted") != 114) { StartCoroutine(ExtractQuranFiles()); Debug.Log("extracting Quran files..."); return; } //Quran Loaded Debug.Log("Quran finished loading"); Downloader.SetActive(false); //yield return new WaitForSeconds(0.01f); //Set a var to Ready, to avoid checking files again //PlayerPrefs.SetInt("Quran_Ready", 114); BuildSuraButtons.InitilizeUI(this, NavParent); InitilizePrefs(); }
void ReleaseDesignerOutlets() { if (DownloadingLabel != null) { DownloadingLabel.Dispose(); DownloadingLabel = null; } if (DownloadingActivity != null) { DownloadingActivity.Dispose(); DownloadingActivity = null; } if (DownloadingProgress != null) { DownloadingProgress.Dispose(); DownloadingProgress = null; } if (DownloadButton != null) { DownloadButton.Dispose(); DownloadButton = null; } if (CancelButton != null) { CancelButton.Dispose(); CancelButton = null; } }
private void load(OsuGame game, ScoreManager scores) { InternalChild = shakeContainer = new ShakeContainer { RelativeSizeAxes = Axes.Both, Child = button = new DownloadButton { RelativeSizeAxes = Axes.Both, } }; button.Action = () => { switch (State.Value) { case DownloadState.LocallyAvailable: game?.PresentScore(Model.Value); break; case DownloadState.NotDownloaded: scores.Download(Model.Value); break; case DownloadState.Downloaded: case DownloadState.Downloading: shakeContainer.Shake(); break; } }; State.BindValueChanged(state => { button.State.Value = state.NewValue; switch (replayAvailability) { case ReplayAvailability.Local: button.TooltipText = @"Watch replay"; break; case ReplayAvailability.Online: button.TooltipText = @"Download replay"; break; default: button.TooltipText = @"Replay unavailable"; break; } }, true); if (replayAvailability == ReplayAvailability.NotAvailable) { button.Enabled.Value = false; button.Alpha = 0.6f; } }
public void DownloadSourceCode(string email, string name) { Email.SendKeys(email); Name.SendKeys(name); DownloadButton.Click(); var successMessage = string.Format("Thank you for downloading {0}! An email was sent to {1}. Check your inbox.", name, email); var waitElem = new WebDriverWait(_driver, TimeSpan.FromSeconds(30)); waitElem.Until(ExpectedConditions.TextToBePresentInElementLocated(By.Id("successMessageId"), successMessage)); }
private void StartDownloading() { Downloader.SetActive(true); StartCoroutine(DownloadQuranFiles()); isDownloading = true; DownloadButton.SetActive(true); DownloadButton.transform.GetChild(0).GetComponent <Text>().text = "ﻞﻳﺰﻨﺘﻟﺍ ءﺎﻐﻟﺍ"; DownloadButton.GetComponent <Image>().color = Red; Debug.Log("Quran downloading..."); }
private void StopDownloading() { StopAllCoroutines(); isDownloading = false; Downloader.SetActive(true); DownloadText.text = "(ﺖﻳﺎﺑﺎﺠﻴﻣ 160 ﻢﺠﺣ) ﻊﻗﻮﻤﻟﺍ ﻦﻣ نﺁﺮﻘﻟﺍ تﺎﻔﻠﻣ ﻞﻳﺰﻨﺗ ﻰﻟﺇ ﻖﻴﺒﻄﺘﻟﺍ جﺎﺘﺤﻳ"; DownloadButton.SetActive(true); DownloadButton.transform.GetChild(0).GetComponent <Text>().text = "ﻖﻓﺍﻮﻣ"; DownloadButton.GetComponent <Image>().color = Green; Debug.Log("Quran stopped downloading..."); }
public BeatmapPanelDownloadButton(BeatmapSetInfo beatmapSet) : base(beatmapSet) { InternalChild = shakeContainer = new ShakeContainer { RelativeSizeAxes = Axes.Both, Child = button = new DownloadButton { RelativeSizeAxes = Axes.Both, }, }; }
private void createButton(bool downloadable, bool hasVideo = false) { AddStep("create button", () => { Child = downloadButton = new DownloadButton(downloadable ? getDownloadableBeatmapSet(hasVideo) : getUndownloadableBeatmapSet()) { Anchor = Anchor.Centre, Origin = Anchor.Centre, Scale = new Vector2(2) }; }); }
private void load(OsuGame game, ScoreManager scores) { InternalChild = shakeContainer = new ShakeContainer { RelativeSizeAxes = Axes.Both, Child = button = new DownloadButton { RelativeSizeAxes = Axes.Both, } }; button.Action = () => { switch (State.Value) { case DownloadState.LocallyAvailable: game?.PresentScore(Score.Value, ScorePresentType.Gameplay); break; case DownloadState.NotDownloaded: scores.Download(Score.Value, false); break; case DownloadState.Importing: case DownloadState.Downloading: shakeContainer.Shake(); break; } }; Score.BindValueChanged(score => { downloadTracker?.RemoveAndDisposeImmediately(); if (score.NewValue != null) { AddInternal(downloadTracker = new ScoreDownloadTracker(score.NewValue) { State = { BindTarget = State } }); } button.Enabled.Value = replayAvailability != ReplayAvailability.NotAvailable; updateTooltip(); }, true); State.BindValueChanged(state => { button.State.Value = state.NewValue; updateTooltip(); }, true); }
public DownloadButton BuildDownload(string id, Models.Record courseRecord, ActivityIndicator spinner) { DownloadButton downloadBtn = new DownloadButton { Text = "download", Image = "baseline_cloud_download_black_48.png", Style = (Style)Application.Current.Resources["buttonStyle"], ClassId = id, Spinner = spinner, IsVisible = (courseRecord == null) ? true : (courseRecord.Deleted == "false") ? false : true }; return(downloadBtn); }
public DownloadButton BuildLaunch(string id, Models.Record courseRecord, ActivityIndicator spinner) { DownloadButton downloadBtn = new DownloadButton { Text = (courseRecord == null) ? "open" : (courseRecord.CompletionStatus.ToLower() == "completed") ? "review" : (courseRecord.CMI == "") ? "open" : "resume", Image = "baseline_launch_black_48.png", Style = (Style)Application.Current.Resources["buttonStyle"], ClassId = id, Spinner = spinner, CourseID = id, IsVisible = (courseRecord == null) ? false : (courseRecord.Deleted == "false" && courseRecord.Downloaded == true) ? true : false, }; return(downloadBtn); }
private void load(OsuGame game, ScoreManager scores) { InternalChild = shakeContainer = new ShakeContainer { RelativeSizeAxes = Axes.Both, Child = button = new DownloadButton { RelativeSizeAxes = Axes.Both, } }; button.Action = () => { switch (State.Value) { case DownloadState.LocallyAvailable: game?.PresentScore(Model.Value, ScorePresentType.Gameplay); break; case DownloadState.NotDownloaded: scores.Download(Model.Value); break; case DownloadState.Importing: case DownloadState.Downloading: shakeContainer.Shake(); break; } }; State.BindValueChanged(state => { button.State.Value = state.NewValue; updateTooltip(); }, true); Model.BindValueChanged(_ => { button.Enabled.Value = replayAvailability != ReplayAvailability.NotAvailable; updateTooltip(); }, true); }
void ReleaseDesignerOutlets() { if (WidthLabel != null) { WidthLabel.Dispose(); WidthLabel = null; } if (HeightLabel != null) { HeightLabel.Dispose(); HeightLabel = null; } if (DownloadButton != null) { DownloadButton.Dispose(); DownloadButton = null; } if (HeightTextField != null) { HeightTextField.Dispose(); HeightTextField = null; } if (ImageView != null) { ImageView.Dispose(); ImageView = null; } if (MediaPathTextField != null) { MediaPathTextField.Dispose(); MediaPathTextField = null; } if (WidthTextField != null) { WidthTextField.Dispose(); WidthTextField = null; } }
public BeatmapPanelDownloadButton(BeatmapSetInfo beatmapSet) : base(beatmapSet) { InternalChild = shakeContainer = new ShakeContainer { RelativeSizeAxes = Axes.Both, Child = button = new DownloadButton { RelativeSizeAxes = Axes.Both, }, }; button.Add(new DownloadProgressBar(beatmapSet) { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Depth = -1, }); }
partial void DownloadButtonClicked(UIButton sender) { if (currentActiveView == 2) { return; } BluetoothViewObj.Hidden = true; DownloadViewObj.Hidden = false; // Make the current button bold and stand out DownloadButton.SetTitleColor(UIColor.FromRGBA(82, 99, 227, 255), UIControlState.Normal); DownloadButton.Font = UIFont.BoldSystemFontOfSize(17.0f); // Make other fonts smaller DashboardButton.Font = UIFont.SystemFontOfSize(17.0f); BluetoothButton.Font = UIFont.SystemFontOfSize(17.0f); DashboardButton.SetTitleColor(UIColor.FromRGBA(82, 99, 227, 175), UIControlState.Normal); BluetoothButton.SetTitleColor(UIColor.FromRGBA(82, 99, 227, 175), UIControlState.Normal); currentActiveView = 2; }
System.Collections.IEnumerator ExtractQuranFiles() { Debug.Log("ExtractQuranFiles()..."); DownloadText.text = "ةﺮﻴﺧﻷﺍ تﺎﺴﻤﻠﻟﺍ"; DownloadButton.SetActive(false); yield return(new WaitForSeconds(.1f)); //Unzip file string zipPath = string.Format("{0}/Quran.zip", Application.persistentDataPath); var dir = new DirectoryInfo(Application.persistentDataPath + "/Quran/"); if (dir.Exists) { dir.Delete(true); } ZipFile.ExtractToDirectory(zipPath, Application.persistentDataPath + "/Quran/"); //System.IO.Compression. PlayerPrefs.SetInt("QuranExtracted", 114); File.Delete(zipPath); CheckQuranFiles(); }
/// <summary> /// </summary> private void ShowPreview(JToken mapset) { MapBanner.Alpha = 0; MapBanner.ClearAnimations(); Title.ClearAnimations(); Artist.ClearAnimations(); Creator.ClearAnimations(); DownloadButton.ClearAnimations(); CancelButton.ClearAnimations(); ViewMapsetPageButton.ClearAnimations(); Title.Alpha = 0; Artist.Alpha = 0; Creator.Alpha = 0; DownloadButton.Alpha = 0; CancelButton.Alpha = 0; ViewMapsetPageButton.Alpha = 0; Title.Text = mapset["title"].ToString(); Title.Animations.Add(new Animation(AnimationProperty.Alpha, Easing.Linear, 0, 1, 300)); Artist.Text = mapset["artist"].ToString(); Artist.Animations.Add(new Animation(AnimationProperty.Alpha, Easing.Linear, 0, 1, 300)); Creator.Text = "Created By: " + mapset["creator_username"]; Creator.Animations.Add(new Animation(AnimationProperty.Alpha, Easing.Linear, 0, 1, 300)); DownloadButton.Animations.Add(new Animation(AnimationProperty.Alpha, Easing.Linear, 0, 1, 300)); CancelButton.Animations.Add(new Animation(AnimationProperty.Alpha, Easing.Linear, 0, 1, 300)); ViewMapsetPageButton.Animations.Add(new Animation(AnimationProperty.Alpha, Easing.Linear, 0, 1, 300)); Task.Run(async() => { MapBanner.Image = await ImageDownloader.DownloadMapsetBanner((int)mapset["id"]); MapBanner.Animations.Add(new Animation(AnimationProperty.Alpha, Easing.Linear, 0, 1, 300)); }); }
/// <summary> /// </summary> private void HidePreview() { MapBanner.ClearAnimations(); MapBanner.Animations.Add(new Animation(AnimationProperty.Alpha, Easing.Linear, MapBanner.Alpha, 0, 300)); Title.ClearAnimations(); Title.Animations.Add(new Animation(AnimationProperty.Alpha, Easing.Linear, Title.Alpha, 0, 300)); Artist.ClearAnimations(); Artist.Animations.Add(new Animation(AnimationProperty.Alpha, Easing.Linear, Artist.Alpha, 0, 300)); Creator.ClearAnimations(); Creator.Animations.Add(new Animation(AnimationProperty.Alpha, Easing.Linear, Creator.Alpha, 0, 300)); DownloadButton.ClearAnimations(); DownloadButton.Animations.Add(new Animation(AnimationProperty.Alpha, Easing.Linear, DownloadButton.Alpha, 0, 300)); CancelButton.ClearAnimations(); CancelButton.Animations.Add(new Animation(AnimationProperty.Alpha, Easing.Linear, CancelButton.Alpha, 0, 300)); ViewMapsetPageButton.ClearAnimations(); ViewMapsetPageButton.Animations.Add(new Animation(AnimationProperty.Alpha, Easing.Linear, ViewMapsetPageButton.Alpha, 0, 300)); }
private void Window_Loaded(object sender, RoutedEventArgs e) { #region Validation if (Global.UpdateAvailable == null) { WhatsNewParagraph.Inlines.Add("Something wrong happened. No update was found."); return; } #endregion try { //Detect if this is portable or installed. Download the proper file. IsChocolatey = AppDomain.CurrentDomain.BaseDirectory.EndsWith(@"Chocolatey\lib\screentogif\content\"); IsInstaller = Directory.EnumerateFiles(AppDomain.CurrentDomain.BaseDirectory).Any(x => x.ToLowerInvariant().EndsWith("screentogif.visualelementsmanifest.xml")); VersionRun.Text = $"{LocalizationHelper.Get("S.Updater.Version")} {Global.UpdateAvailable.Version}"; SizeRun.Text = Global.UpdateAvailable.InstallerSize > 0 ? Humanizer.BytesToString(IsInstaller ? Global.UpdateAvailable.InstallerSize : Global.UpdateAvailable.PortableSize) : ""; TypeRun.Text = IsInstaller ? LocalizationHelper.Get("S.Updater.Installer") : LocalizationHelper.Get("S.Updater.Portable"); //If set to download automatically, check if the installer was downloaded. if (UserSettings.All.InstallUpdates) { //If the update was already downloaded. if (File.Exists(Global.UpdateAvailable.InstallerPath)) { DownloadButton.SetResourceReference(ImageButton.TextProperty, "S.Updater.Install"); //When the update was prompted manually, the user can set the installer to run the app afterwards. if (WasPromptedManually) { RunAfterwardsCheckBox.Visibility = Visibility.Visible; RunAfterwardsCheckBox.IsChecked = true; } } } //Details. if (Global.UpdateAvailable.IsFromGithub) { //From Github, the description is available. var splited = Global.UpdateAvailable.Description.Split(new[] { '#' }, StringSplitOptions.RemoveEmptyEntries); WhatsNewParagraph.Inlines.Add(splited[0].Replace(" What's new?\r\n\r\n", "")); FixesParagraph.Inlines.Add(splited.Length > 1 ? splited[1].Replace(" Bug fixes:\r\n\r\n", "").Replace(" Fixed:\r\n\r\n", "") : "Aparently nothing."); } else { //If the release detail was obtained by querying Fosshub, no release note is available. MainFlowDocument.Blocks.Remove(WhatsNewParagraphTitle); MainFlowDocument.Blocks.Remove(FixesParagraphTitle); MainFlowDocument.Blocks.Remove(FixesParagraph); var run = new Run(); run.SetResourceReference(Run.TextProperty, "S.Updater.Info.NewVersionAvailable"); WhatsNewParagraph.Inlines.Add(run); } } catch (Exception ex) { LogWriter.Log(ex, "Impossible to load the download details"); StatusBand.Error(LocalizationHelper.Get("S.Updater.Warning.Show")); } }
private void TransmittingWorker_DoWork(object sender, DoWorkEventArgs e) { while (true) { if (!DataLink.FileSending && !DataLink.FileRecieving) { if (!DataLink.SendQueue.IsEmpty) { File F; if (DataLink.SendQueue.TryDequeue(out F)) { DataLink.FileSending = true; DataLink.StartSendingFile(F); /****** установка элементов формы ******/ DownloadButton.Invoke((MethodInvoker) delegate { DownloadButton.Enabled = false; }); progressBar1.Invoke((MethodInvoker) delegate { progressBar1.Maximum = (int)(F.Size / 1024); }); ActionLabel.Invoke((MethodInvoker) delegate { ActionLabel.Text = "Идет передача файла..."; }); /**************************************/ FileStream Stream = new FileStream(F.Name, FileMode.Open, FileAccess.Read); byte R; byte[] buffer = new byte[1024]; int counter = 0; // счетчик ошибок while (DataLink.FileSending) { if (!PhysLayer.DsrSignal()) { Stream.Close(); MessageBox.Show("Ошибка передачи!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); PhysLayer.ShutDown(); } if (PhysLayer.Responses.TryDequeue(out R)) { if (R == Convert.ToByte('A')) { counter = 0; try { int BytesRead = Stream.Read(buffer, 0, buffer.Length); if (BytesRead > 0) { byte[] clean = new byte[BytesRead]; for (int i = 0; i < BytesRead; i++) { clean[i] = buffer[i]; } int step = clean.Length; clean = DataLink.pack('I', clean); clean = DataLink.EncodeFrame(clean); PhysLayer.Write(clean); progressBar1.Invoke((MethodInvoker) delegate { progressBar1.Step = step / 1024; progressBar1.PerformStep(); }); } else { Stream.Close(); DataLink.EOF(); DataLink.FileSending = false; progressBar1.Invoke((MethodInvoker) delegate { progressBar1.Value = 0; }); ActionLabel.Invoke((MethodInvoker) delegate { ActionLabel.Text = ""; }); MessageBox.Show("Передача файла завершена!", "Успех", MessageBoxButtons.OK, MessageBoxIcon.None); } } catch (ArgumentException) { MessageBox.Show("ISKLUCHENIE"); } } if (R == Convert.ToByte('N')) { if (counter < 5) { counter++; PhysLayer.Write(buffer); } else { MessageBox.Show("Ошибка передачи!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); PhysLayer.ShutDown(); } } } } } } } if (DataLink.FileRecieving) { DownloadButton.Invoke((MethodInvoker) delegate { DownloadButton.Enabled = false; }); string desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); string fullPath = desktop + "\\(NEW)" + DataLink.FileRecievingName; FileStream Stream = new FileStream(fullPath, FileMode.Create, FileAccess.Write); while (DataLink.FileRecieving) { if (!PhysLayer.DsrSignal()) { Stream.Close(); System.IO.File.Delete(fullPath); MessageBox.Show("Ошибка передачи!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); PhysLayer.ShutDown(); } byte[] result; if (PhysLayer.FramesRecieved.TryDequeue(out result)) { if (Encoding.Default.GetString(result) == "EOF") { Stream.Close(); DataLink.FileRecieving = false; MessageBox.Show("Прием файла завершен!", "Успех", MessageBoxButtons.OK, MessageBoxIcon.None); progressBar1.Invoke((MethodInvoker) delegate { progressBar1.Value = 0; }); break; } if (Encoding.Default.GetString(result) == "FNF") { Stream.Close(); System.IO.File.Delete(fullPath); progressBar1.Invoke((MethodInvoker) delegate { progressBar1.Value = 0; }); PhysLayer.ShutDown(); MessageBox.Show("Файл не найден.\r\nВыберите другой файл.", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); break; } if (Encoding.Default.GetString(result) == "SIZE") { progressBar1.Invoke((MethodInvoker) delegate { progressBar1.Maximum = DataLink.FileRecievingSize / 1024; }); } else { try { Stream.Write(result, 0, result.Length); progressBar1.Invoke((MethodInvoker) delegate { progressBar1.Step = result.Length / 1024; progressBar1.PerformStep(); }); } catch (IOException) { MessageBox.Show("Ошибка передачи!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); PhysLayer.ShutDown(); progressBar1.Invoke((MethodInvoker) delegate { progressBar1.Value = 0; }); } } } } Stream.Close(); PhysLayer.ShutDown(); } DownloadButton.Invoke((MethodInvoker) delegate { if (listBox1.Text != "") { DownloadButton.Enabled = true; } }); Thread.Sleep(1000); } }
private async void Window_Loaded(object sender, RoutedEventArgs e) { #region Validation if (Global.UpdateAvailable == null) { WhatsNewParagraph.Inlines.Add("Something wrong happened. No update was found."); return; } if (Global.UpdateAvailable.MustDownloadManually) { StatusBand.Warning(LocalizationHelper.Get("S.Updater.NoNewRelease.Info")); } #endregion try { //Detect if this is portable or installed. Download the proper file. IsChocolatey = AppDomain.CurrentDomain.BaseDirectory.EndsWith(@"Chocolatey\lib\screentogif\content\"); IsInstaller = Directory.EnumerateFiles(AppDomain.CurrentDomain.BaseDirectory).Any(x => x.ToLowerInvariant().EndsWith("screentogif.visualelementsmanifest.xml")); VersionRun.Text = $"{LocalizationHelper.Get("S.Updater.Version")} {Global.UpdateAvailable.Version}"; SizeRun.Text = !UserSettings.All.PortableUpdate ? (Global.UpdateAvailable.InstallerSize > 0 ? Humanizer.BytesToString(Global.UpdateAvailable.InstallerSize) : "") : (Global.UpdateAvailable.PortableSize > 0 ? Humanizer.BytesToString(Global.UpdateAvailable.PortableSize) : ""); TypeRun.Text = IsInstaller ? LocalizationHelper.Get("S.Updater.Installer") : LocalizationHelper.Get("S.Updater.Portable"); //Details. if (Global.UpdateAvailable.IsFromGithub) { //From Github, the description is available. var splited = Global.UpdateAvailable.Description.Split(new[] { '#' }, StringSplitOptions.RemoveEmptyEntries); WhatsNewParagraph.Inlines.Add(splited[0].Replace(" What's new?\r\n\r\n", "")); FixesParagraph.Inlines.Add(splited.Length > 1 ? splited[1].Replace(" Bug fixes:\r\n\r\n", "").Replace(" Fixed:\r\n\r\n", "") : "Aparently nothing."); } else { //If the release detail was obtained by querying Fosshub, no release note is available. MainFlowDocument.Blocks.Remove(WhatsNewParagraphTitle); MainFlowDocument.Blocks.Remove(FixesParagraphTitle); MainFlowDocument.Blocks.Remove(FixesParagraph); var run = new Run(); run.SetResourceReference(Run.TextProperty, "S.Updater.Info.NewVersionAvailable"); WhatsNewParagraph.Inlines.Add(run); } DocumentViewer.UpdateLayout(); //If set to force the download the portable version of the app, check if it was downloaded. if (UserSettings.All.PortableUpdate) { //If the update was already downloaded. if (File.Exists(Global.UpdateAvailable.PortablePath)) { //If it's still downloading, wait for it to finish before displaying "Open". if (Global.UpdateAvailable.IsDownloading) { Global.UpdateAvailable.TaskCompletionSource = new TaskCompletionSource <bool>(); await Global.UpdateAvailable.TaskCompletionSource.Task; if (!IsLoaded) { return; } } DownloadButton.SetResourceReference(ExtendedButton.TextProperty, "S.Updater.InstallManually"); } return; } //If set to download automatically, check if the installer was downloaded. if (UserSettings.All.InstallUpdates) { //If the update was already downloaded. if (File.Exists(Global.UpdateAvailable.InstallerPath)) { //If it's still downloading, wait for it to finish before displaying "Install". if (Global.UpdateAvailable.IsDownloading) { Global.UpdateAvailable.TaskCompletionSource = new TaskCompletionSource <bool>(); await Global.UpdateAvailable.TaskCompletionSource.Task; if (!IsLoaded) { return; } } DownloadButton.SetResourceReference(ExtendedButton.TextProperty, "S.Updater.Install"); //When the update was prompted manually, the user can set the installer to run the app afterwards. if (WasPromptedManually) { RunAfterwardsCheckBox.Visibility = Visibility.Visible; RunAfterwardsCheckBox.IsChecked = true; } } } } catch (Exception ex) { LogWriter.Log(ex, "Impossible to load the download details"); StatusBand.Error(LocalizationHelper.Get("S.Updater.Warning.Show")); } finally { Height = ActualHeight; SizeToContent = SizeToContent.Width; Width = ActualWidth; SizeToContent = SizeToContent.Manual; MaxHeight = double.PositiveInfinity; MaxWidth = double.PositiveInfinity; CenterOnScreen(); } }
void ReleaseDesignerOutlets() { if (BatteryLevel1 != null) { BatteryLevel1.Dispose(); BatteryLevel1 = null; } if (BatteryLevel2 != null) { BatteryLevel2.Dispose(); BatteryLevel2 = null; } if (BluetoothButton != null) { BluetoothButton.Dispose(); BluetoothButton = null; } if (BluetoothViewObj != null) { BluetoothViewObj.Dispose(); BluetoothViewObj = null; } if (ButtonsView != null) { ButtonsView.Dispose(); ButtonsView = null; } if (DashboardButton != null) { DashboardButton.Dispose(); DashboardButton = null; } if (DownloadButton != null) { DownloadButton.Dispose(); DownloadButton = null; } if (DownloadViewObj != null) { DownloadViewObj.Dispose(); DownloadViewObj = null; } if (EventButton1 != null) { EventButton1.Dispose(); EventButton1 = null; } if (EventButton2 != null) { EventButton2.Dispose(); EventButton2 = null; } if (EventButton3 != null) { EventButton3.Dispose(); EventButton3 = null; } if (EventButton4 != null) { EventButton4.Dispose(); EventButton4 = null; } if (EventButton5 != null) { EventButton5.Dispose(); EventButton5 = null; } if (EventButton6 != null) { EventButton6.Dispose(); EventButton6 = null; } if (EventButton7 != null) { EventButton7.Dispose(); EventButton7 = null; } if (EventButton8 != null) { EventButton8.Dispose(); EventButton8 = null; } if (GraphViewObj1 != null) { GraphViewObj1.Dispose(); GraphViewObj1 = null; } if (GraphViewObj3 != null) { GraphViewObj3.Dispose(); GraphViewObj3 = null; } if (SessionStatus1 != null) { SessionStatus1.Dispose(); SessionStatus1 = null; } if (SessionStatus2 != null) { SessionStatus2.Dispose(); SessionStatus2 = null; } if (StartSessionButton != null) { StartSessionButton.Dispose(); StartSessionButton = null; } if (StopSessionButton != null) { StopSessionButton.Dispose(); StopSessionButton = null; } }
void ReleaseDesignerOutlets() { if (AlarmRequestLabel1 != null) { AlarmRequestLabel1.Dispose(); AlarmRequestLabel1 = null; } if (AlarmRequestLabel2 != null) { AlarmRequestLabel2.Dispose(); AlarmRequestLabel2 = null; } if (buttonBack != null) { buttonBack.Dispose(); buttonBack = null; } if (ButtonMail != null) { ButtonMail.Dispose(); ButtonMail = null; } if (ConfirmLabel != null) { ConfirmLabel.Dispose(); ConfirmLabel = null; } if (DescriptionLabel != null) { DescriptionLabel.Dispose(); DescriptionLabel = null; } if (DownloadButton != null) { DownloadButton.Dispose(); DownloadButton = null; } if (DownloadLabel != null) { DownloadLabel.Dispose(); DownloadLabel = null; } if (DownloadNumberView != null) { DownloadNumberView.Dispose(); DownloadNumberView = null; } if (EmailButton != null) { EmailButton.Dispose(); EmailButton = null; } if (icon_call != null) { icon_call.Dispose(); icon_call = null; } if (instructionsView != null) { instructionsView.Dispose(); instructionsView = null; } if (NumberConfirmLabel != null) { NumberConfirmLabel.Dispose(); NumberConfirmLabel = null; } if (NumberConfirmView != null) { NumberConfirmView.Dispose(); NumberConfirmView = null; } if (NumberDownloadLabel != null) { NumberDownloadLabel.Dispose(); NumberDownloadLabel = null; } if (NumberRequestLabel != null) { NumberRequestLabel.Dispose(); NumberRequestLabel = null; } if (NumberRequestView != null) { NumberRequestView.Dispose(); NumberRequestView = null; } if (TitleViewLabel != null) { TitleViewLabel.Dispose(); TitleViewLabel = null; } }