private async void ManageLocal() { try { if (_running) return; GlobalObjects.ViewModel.LocalConfig = true; GlobalObjects.ViewModel.BlockNavigation = true; _running = true; var localXml = ""; await Task.Run(async () => { Dispatcher.Invoke(() => { WaitManageLocal.Visibility = Visibility.Visible; //ImgManageLocal.Visibility = Visibility.Collapsed; }); GlobalObjects.ViewModel.ApplicationMode = ApplicationMode.ManageLocal; var officeInstallManager = new OfficeLocalInstallManager(); localXml = await officeInstallManager.GenerateConfigXml(); }); GlobalObjects.ViewModel.ConfigXmlParser.LoadXml(localXml); GlobalObjects.ViewModel.ResetXml = true; GlobalObjects.ViewModel.ImportFile = null; GlobalObjects.ViewModel.ConfigXmlParser.ConfigurationXml.Add.Version = null; if (RestartWorkflow != null) { this.RestartWorkflow(this, new EventArgs()); } GlobalObjects.ViewModel.BlockNavigation = false; var installOffice = new InstallOffice(); if (installOffice.IsUpdateRunning()) { this.TransitionTab(this, new TransitionTabEventArgs() { Direction = TransitionTabDirection.Forward, Index = 6, UseIndex = true }); } else { this.TransitionTab(this, new TransitionTabEventArgs() { Direction = TransitionTabDirection.Forward, Index = 0 }); } LogAnaylytics("/StartView", "StartNew"); } catch (Exception ex) { LogErrorMessage(ex); } finally { Dispatcher.Invoke(() => { WaitManageLocal.Visibility = Visibility.Collapsed; //ImgManageLocal.Visibility = Visibility.Visible; }); _running = false; } }
private async Task LoadViewState() { try { await Retry.BlockAsync(10, 1, async () => { Dispatcher.Invoke(() => { ErrorRow.Visibility = Visibility.Collapsed; }); SetItemState(LocalViewItem.Install, LocalViewState.Default); var installGenerator = new OfficeLocalInstallManager(); LocalInstall = await installGenerator.CheckForOfficeInstallAsync(); if (LocalInstall.Installed) { SetItemState(LocalViewItem.Install, LocalViewState.Success); SetItemState(LocalViewItem.Uninstall, LocalViewState.Action); Dispatcher.Invoke(() => { VersionLabel.Content = "(" + LocalInstall.Version + ")"; ChannelLabel.Content = LocalInstall.Channel; // ChannelLabel.Content = "First Release Deferred"; if (ChannelLabel.Content.ToString().Length < 10) { ChannelName.Width = new GridLength(100); } else if (ChannelLabel.Content.ToString().Length < 20) { ChannelName.Width = new GridLength(150); } else { ChannelName.Width = new GridLength(200); } var selectIndex = 0; if (LocalInstall.Channel != null) { for (var i = 0; i < ProductBranch.Items.Count; i++) { var item = (OfficeBranch) ProductBranch.Items[i]; if (item == null) continue; if (item.NewName.ToLower() != LocalInstall.Channel.ToLower()) continue; selectIndex = i; break; } } BranchChanged(this, new BranchChangedEventArgs() { BranchName = LocalInstall.Channel }); ProductBranch.SelectedIndex = selectIndex; }); var installOffice = new InstallOffice(); if (installOffice.IsUpdateRunning()) { await RunUpdateOffice(); } else { if (LocalInstall.LatestVersionInstalled) { SetItemState(LocalViewItem.Update, LocalViewState.Success); } else { SetItemState(LocalViewItem.Update, LocalViewState.Action); Dispatcher.Invoke(() => { UpdateStatus.Content = "New version available (" + LocalInstall.LatestVersion + ")"; }); } } Dispatcher.Invoke(() => { ChangeChannel.IsEnabled = false; }); } else { SetItemState(LocalViewItem.Install, LocalViewState.Action); } }); } catch (Exception ex) { SetItemState(LocalViewItem.Install, LocalViewState.Fail); Dispatcher.Invoke(() => { ErrorText.Text = ex.Message; }); LogErrorMessage(ex); } }