/// <summary> /// Closes the and save data grid. /// </summary> private bool closeAndSaveDataGrid( ResourceEditorUserControl fileGroupControl) { if (fileGroupControl == null) { return(true); } else if (fileGroupControl.CloseAndSaveDataGrid()) { var tabPage = (XtraTabPage)fileGroupControl.Parent; mainTabControl.TabPages.Remove(tabPage); tabPage.Dispose(); if (mainTabControl.TabPages.Count <= 0) { mainTabControl.Visible = false; } return(true); } else { return(false); } }
/// <summary> /// Checks the get add editor control. /// </summary> /// <param name="gridEditableData">The file group.</param> /// <param name="isNew">if set to <c>true</c> [is new].</param> /// <returns></returns> private ResourceEditorUserControl checkGetAddEditorControl( IGridEditableData gridEditableData, out bool isNew) { var checksum = gridEditableData.GetChecksum(MainForm.Current.ProjectFilesControl.Project ?? Project.Empty); //FileGroup.BuildChecksum( //MainForm.Current.ProjectFilesControl.Project, //gridEditableData); foreach (XtraTabPage tabPage in mainTabControl.TabPages) { if (ConvertHelper.ToInt64(tabPage.Tag) == checksum) { mainTabControl.SelectedTabPage = tabPage; isNew = true; return((ResourceEditorUserControl)tabPage.Controls[0]); } } // -- // Not found, add new. var newTabPage = new XtraTabPage { Text = gridEditableData.GetNameIntelligent(MainForm.Current.ProjectFilesControl.Project ?? Project.Empty), Tooltip = gridEditableData.GetFullNameIntelligent(MainForm.Current.ProjectFilesControl.Project ?? Project.Empty), ImageIndex = (int)gridEditableData.SourceType, Tag = checksum }; var editorControl = new ResourceEditorUserControl { Dock = DockStyle.Fill }; newTabPage.Controls.Add(editorControl); mainTabControl.TabPages.Add(newTabPage); mainTabControl.Visible = true; mainTabControl.SelectedTabPage = newTabPage; isNew = false; return(editorControl); }
/// <summary> /// Closes the and save data grid. /// </summary> private bool closeAndSaveDataGrid( ResourceEditorUserControl fileGroupControl) { if (fileGroupControl == null) { return true; } else if (fileGroupControl.CloseAndSaveDataGrid()) { var tabPage = (XtraTabPage)fileGroupControl.Parent; mainTabControl.TabPages.Remove(tabPage); tabPage.Dispose(); if (mainTabControl.TabPages.Count <= 0) { mainTabControl.Visible = false; } return true; } else { return false; } }
/// <summary> /// Checks the get add editor control. /// </summary> /// <param name="gridEditableData">The file group.</param> /// <param name="isNew">if set to <c>true</c> [is new].</param> /// <returns></returns> private ResourceEditorUserControl checkGetAddEditorControl( IGridEditableData gridEditableData, out bool isNew) { var checksum = gridEditableData.GetChecksum(MainForm.Current.ProjectFilesControl.Project ?? Project.Empty); //FileGroup.BuildChecksum( //MainForm.Current.ProjectFilesControl.Project, //gridEditableData); foreach (XtraTabPage tabPage in mainTabControl.TabPages) { if (ConvertHelper.ToInt64(tabPage.Tag) == checksum) { mainTabControl.SelectedTabPage = tabPage; isNew = true; return (ResourceEditorUserControl)tabPage.Controls[0]; } } // -- // Not found, add new. var newTabPage = new XtraTabPage { Text = gridEditableData.GetNameIntelligent(MainForm.Current.ProjectFilesControl.Project ?? Project.Empty), Tooltip = gridEditableData.GetFullNameIntelligent(MainForm.Current.ProjectFilesControl.Project ?? Project.Empty), ImageIndex = (int)gridEditableData.SourceType, Tag = checksum }; var editorControl = new ResourceEditorUserControl { Dock = DockStyle.Fill }; newTabPage.Controls.Add(editorControl); mainTabControl.TabPages.Add(newTabPage); mainTabControl.Visible = true; mainTabControl.SelectedTabPage = newTabPage; isNew = false; return editorControl; }