CheckForOfficeInstallAsync() 공개 메소드

public CheckForOfficeInstallAsync ( ) : Task
리턴 Task
        public async Task <OfficeInstallation> CheckForOfficeInstallAsync()
        {
            var result = new OfficeInstallation();

            if (isLocal)
            {
                result = await LocalInstall.CheckForOfficeInstallAsync();
            }
            else
            {
                switch (_connectionType)
                {
                case ConnectionType.WMI:
                    result = await WmiInstall.CheckForOfficeInstallAsync();

                    break;

                case ConnectionType.PowerShell:
                    result = await PowershellInstall.CheckForOfficeInstallAsync();

                    break;

                default:
                    throw new Exception("Connection Unknown");
                }
            }

            return(result);
        }
        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);
            }
        }