コード例 #1
0
        private async Task GetBranchVersion(OfficeBranch branch, OfficeEdition officeEdition)
        {
            try
            {
                var modelBranch = GlobalObjects.ViewModel.Branches.FirstOrDefault(b =>
                                                                                  b.Branch.ToString().ToLower() == branch.Branch.ToString().ToLower());
                if (modelBranch == null)
                {
                    return;
                }

                UpdateTargetVersion.SetValue(TextBoxHelper.WatermarkProperty, modelBranch.CurrentVersion);
            }
            catch (Exception ex)
            {
                var strError = ex.Message;
                if (strError != null)
                {
                }
            }
        }
コード例 #2
0
        private async Task UpdateVersions()
        {
            var branch = (OfficeBranch)UpdateBranch.SelectedItem;

            if (branch == null)
            {
                return;
            }

            UpdateTargetVersion.ItemsSource = branch.Versions;
            UpdateTargetVersion.SetValue(TextBoxHelper.WatermarkProperty, branch.CurrentVersion);

            var officeEdition = OfficeEdition.Office32Bit;

            var configXml = GlobalObjects.ViewModel.ConfigXmlParser.ConfigurationXml;

            if (configXml.Add != null)
            {
                if (configXml.Add.OfficeClientEdition == OfficeClientEdition.Office64Bit)
                {
                    officeEdition = OfficeEdition.Office64Bit;
                }
            }

            if (UpdateUpdatePath.Text.Length > 0)
            {
                var otherFolder = GlobalObjects.SetBranchFolderPath(branch.Branch.ToString(), UpdateUpdatePath.Text);
                if (await GlobalObjects.DirectoryExists(otherFolder))
                {
                    if (!string.IsNullOrEmpty(UpdateUpdatePath.Text))
                    {
                        UpdateUpdatePath.Text = GlobalObjects.SetBranchFolderPath(branch.Branch.ToString(),
                                                                                  UpdateUpdatePath.Text);
                    }
                }
            }

            await GetBranchVersion(branch, officeEdition);
        }