SDL.TridionVSRazorExtension.ProjectFolderDialogWindow.btnOk_Click C# (CSharp) Method

btnOk_Click() private method

private btnOk_Click ( object sender, RoutedEventArgs e ) : void
sender object
e System.Windows.RoutedEventArgs
return void
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            this._AllTree = Service.GetFileTree(this._TopFolder, this.RootPath);
            this.CurrentProjectFolder = Service.GetSelectedFolderFromTree(this._AllTree);

            if (this.CurrentProjectFolder != null && this.lstTridionFolders.SelectedIndex >= 0)
            {
                this.CurrentProjectFolder.ProjectFolderRole = (ProjectFolderRole) this.cbRoles.SelectedValue;
                this.CurrentProjectFolder.TcmId = this.TridionFolders.Where(x => x.TridionRole == this._TridionRole).ToList()[this.lstTridionFolders.SelectedIndex].TcmId;

                if (this.CurrentProjectFolder.ChildItems != null && this.CurrentProjectFolder.ChildItems.All(x => x.Checked == true))
                {
                    this.CurrentProjectFolder.Checked = true;
                }
                else if (this.CurrentProjectFolder.ChildItems != null && this.CurrentProjectFolder.ChildItems.All(x => x.Checked == false))
                {
                    this.CurrentProjectFolder.Checked = false;
                }
                else
                {
                    this.CurrentProjectFolder.Checked = null;
                }

                if (this.CurrentProjectFolder.ChildItems != null && this.CurrentProjectFolder.ChildItems.All(x => x.SyncTemplate == true))
                {
                    this.CurrentProjectFolder.SyncTemplate = true;
                }
                else if (this.CurrentProjectFolder.ChildItems != null && this.CurrentProjectFolder.ChildItems.All(x => x.SyncTemplate == false))
                {
                    this.CurrentProjectFolder.SyncTemplate = false;
                }
                else
                {
                    this.CurrentProjectFolder.SyncTemplate = null;
                }

                this.SetChildRoles((ProjectFolderInfo)this._ProjectItem);
            }

            this.DialogResult = true;
            this.Close();
        }