private ConnectionTabControl CreateNewCntConnectionTab(string text) { var connectionPage = new TabPage { Margin = new Padding(0), Padding = new Padding(0), BackColor = Color.White }; tabMain.TabPages.Add(connectionPage); tabMain.SelectedTab = connectionPage; var connectionTab = new ConnectionTabControl( this._model, isDisableStatusLine, isDisableNavigationPanel, ConnectionArrangeMode == ConnectionViewArrangeMode.AsRootNodes ); connectionTab.ConntectionUpdated += OnConnectionUpdated; connectionPage.Text = text; connectionPage.Controls.Add(connectionTab); connectionTab.Dock = DockStyle.Fill; this._model.LocaleManager.LocalizeDeep(this, connectionTab.Controls); return(connectionTab); }
private TreeTaskManager() { this._schedulingLock = new object(); this._runningTasksLock = new object(); this._treeControl = null; this.ProgressManager = null; this._nodeCounter = null; this.RunningTasks = new ObservableConcurrentDictionary<long, TreeTask>(); }
private void saveToolStripMenuItem_Click(object sender, EventArgs e) { frmSaveDialog saveDialog = new frmSaveDialog(); ConnectionData connection = null; ConnectionTabControl currentTab = (ConnectionTabControl)tabMain.SelectedTab.Controls[0]; if (currentTab != null) { connection = currentTab.GetSelectedConnection(); } if (connection == null) { saveDialog.DisableCurrentScope(); } else { saveDialog.SetCurScopeName(connection.SourceConnectionName); } if (saveDialog.ShowDialog() == DialogResult.OK) { if (saveDialog.Scope == frmSaveDialog.ScopeToSave.All) { currentTab = null; } StorageSerializationInfo serializationInfo = new StorageSerializationInfo( this._model, currentTab, saveDialog.Folder, saveDialog.SaveCurrent, saveDialog.SaveHistoric ); ProgressForm form = new ProgressForm { Text = this._model.LocaleManager.GetLocalizedText( this.Name, "lbSerialization", this._model.Settings.InterfaceLanguage ), StartPosition = FormStartPosition.CenterParent }; form.ProgressBar.Style = ProgressBarStyle.Marquee; form.Argument = serializationInfo; form.DoWork += DoSerializationWork; StartSerializationForm(form); } }
public StorageSerializationInfo( MsSqlAuditorModel model, ConnectionTabControl tabControl, string outputPath, bool saveCurrentDatabase, bool saveHistoricDatabase ) { this.Model = model; this.TabControl = tabControl; this.OutputFolder = outputPath; this.SaveCurrentDatabase = saveCurrentDatabase; this.SaveHistoricDatabase = saveHistoricDatabase; }
private void EstablishNewConnection() { frmConnectionSelection selector = new frmConnectionSelection(); selector.SetConnectionGroupInfos(this._model.GetAvailableConnections()); if (selector.ShowDialog() == DialogResult.OK) { ConnectionGroupInfo connectionGroup = selector.SelectedConnectionGroupInfo.ExtractSelectedGroup(); ConnectionTabControl targetTab = GetTargetTab(connectionGroup.Name + "{" + connectionGroup.TemplateFileName + "}"); targetTab.OpenConnection(connectionGroup); } }
private void mnuFile_DropDownOpening(object sender, EventArgs e) { var enabled = false; ConnectionData selectedCnn = null; if (this._ActiveTab != null) { enabled = this._ActiveTab.CanSaveRaw; selectedCnn = this._ActiveTab.GetSelectedConnection(); } mnuCloseConnection.Enabled = this._ActiveTab != null && (this._ActiveTab.ConnectionsAsNodes && this._ActiveTab.GetSelectedConnection() != null); mnuCloseConnection.Text = ConnectionTabControl.GetCloseConnectionCommandText(this._model.LocaleManager); mnuSaveRaw.Enabled = enabled; mnuSaveRaw.Text = this._model.LocaleManager.GetLocalizedText(this.Name, mnuSaveRaw.Name) + (enabled && selectedCnn != null ? " \"" + selectedCnn.Title + "\"": "") + "..."; }
private void mnuNewDirectConnection_Click(object sender, EventArgs e) { using (CreateDirectConnectionDialog createConnectionDialog = new CreateDirectConnectionDialog(this._model)) { if (createConnectionDialog.ShowDialog() == DialogResult.OK) { ConnectionData connectionData = createConnectionDialog.ResultConnection; ConnectionGroupInfo group = connectionData.ConnectionGroup; Template selectedTemplate = TemplateNodesLoader.GetTemplateByFile( createConnectionDialog.SelectedTemplateFileFullPath ); ConnectionTabControl targetTab = GetTargetTab( group.Name + " {" + group.TemplateFileName + "}" ); targetTab.SelectedTemplate = selectedTemplate; targetTab.OpenConnection(group); } } }
public TreeTaskManager(ConnectionTabControl treeControl) : this() { this.ProgressManager = new TreeTaskProgressManager(this); this._treeControl = treeControl; this._nodeCounter = new NodeCounter(treeControl._model); }
internal void Init(ConnectionTabControl parent, PreprocessorAreaData area, ConcreteTemplateNodeDefinition definition, MsSqlAuditorModel model) { if (parent == null) { throw new ArgumentNullException("parent"); } if (area == null) { throw new ArgumentNullException("area"); } if (definition == null) { throw new ArgumentNullException("definition"); } if (model == null) { throw new ArgumentNullException("model"); } if (!area.IsConfigured) { throw new ArgumentOutOfRangeException("area"); } this._area = area; this._parent = parent; this._model = model; table.StartConfiguring(); var rows = this._area.Rows; var columns = this._area.Columns; // _templateId = !String.IsNullOrWhiteSpace(definition.Connection.TemplateId) ? definition.Connection.TemplateId : definition.Connection.TemplateFileName; if (!String.IsNullOrWhiteSpace(definition.Connection.TemplateId)) { this._templateId = definition.Connection.TemplateId; } else { this._templateId = string.IsNullOrEmpty(definition.Connection.TemplateDir) ? definition.Connection.TemplateFileName : Path.Combine(definition.Connection.TemplateDir, definition.Connection.TemplateFileName); } this._nodeId = !String.IsNullOrWhiteSpace(definition.TemplateNode.Id) ? definition.TemplateNode.Id : definition.TemplateNode.Name; this._areaId = !String.IsNullOrWhiteSpace(this._area.Id) ? this._area.Id : this._area.Name; this._reportLanguage = this._model.Settings.ReportLanguage; this._splitterSettings = this._model.LayoutSettings.GetExtendedSettings <SplitterSettings>(this._templateId, String.Empty, this._reportLanguage); if (this._splitterSettings == null) { this._splitterSettings = new SplitterSettings { SplitterNodeSettingList = new List <SplitterSetting>() }; } var splitterSetting = this._splitterSettings.SplitterNodeSettingList.FirstOrDefault( s => string.Equals(s.NodeId, this._nodeId, StringComparison.InvariantCultureIgnoreCase) && string.Equals(s.AreaId, this._areaId, StringComparison.InvariantCultureIgnoreCase) ); if (splitterSetting != null) { var newRows = PreprocessorAreaData.ParseGridDimension(splitterSetting.Rows, "splitterSetting.Rows"); var newColumns = PreprocessorAreaData.ParseGridDimension(splitterSetting.Columns, "splitterSetting.Columns"); if (rows.Length == newRows.Length && columns.Length == newColumns.Length) { rows = newRows; columns = newColumns; } } table.SetRows(rows); table.SetColumns(columns); List <PreprocessorData> preprocessors = _area.Preprocessors; for (int i = 0, iMax = preprocessors.Count; i < iMax; i++) { PreprocessorData preprocessor = preprocessors[i]; Control control = preprocessor.ContentFactory.CreateControl(); if (control != null) { if (control is WebBrowser) { // control.PreviewKeyDown += (s, e) => control.PreviewKeyDown += ConnectionTabArea_PreviewKeyDown; this.Disposed += (s, e) => { // // #248 - fix memory leaks during Web rendering // // if (e.KeyCode == Keys.F5) // { // _parent.F5RefreshView(); // } control.PreviewKeyDown -= ConnectionTabArea_PreviewKeyDown; IntPtr currentProcessHandle = (IntPtr)(-1); SafeNativeMethods.EmptyWorkingSet(currentProcessHandle); }; } #region Wrap control to frame with title if (preprocessor.VerticalTextAlign != null) { var titleFrame = new TitleFrame( preprocessor.VerticalTextAlign, preprocessor.TextAlign, control ); titleFrame.Title = preprocessor.Name; control = titleFrame; } #endregion table.AddControlToCell( preprocessor.Column - 1, preprocessor.Row - 1, preprocessor.ColSpan, preprocessor.RowSpan, control ); } } table.StopConfiguring(); this._splitterChanged = false; if (!this._handlingSplitterMoved) { this._handlingSplitterMoved = true; table.SplitterMoved += TableSplitterMoved; } }
public StorageSerializer(MsSqlAuditorModel model, ConnectionTabControl connectionTabControl) { this._model = model; this._connectionTabControl = connectionTabControl; this._dateSuffix = DateTime.Now.ToString("s").Replace(":", "-"); }
private void OnConnectionUpdated(object sender, ConnectionTabControl.ConntectionUpdatedArgs args) { string strTemplateName = String.Empty; string strConnectionName = String.Empty; BeginInvoke(new Action(() => { if (sender == this._ActiveTab && sender != null) { if (args != null) { if (args.TemplateName != null) { strTemplateName = args.TemplateName; } if (args.ConnectionName != null) { strConnectionName = args.ConnectionName; } } setTitle(strConnectionName.TrimmedOrEmpty(), strTemplateName.TrimmedOrEmpty()); } })); }
private ConnectionTabControl CreateNewCntConnectionTab(string text) { var connectionPage = new TabPage { Margin = new Padding(0), Padding = new Padding(0), BackColor = Color.White }; tabMain.TabPages.Add(connectionPage); tabMain.SelectedTab = connectionPage; var connectionTab = new ConnectionTabControl( this._model, isDisableStatusLine, isDisableNavigationPanel, ConnectionArrangeMode == ConnectionViewArrangeMode.AsRootNodes ); connectionTab.ConntectionUpdated += OnConnectionUpdated; connectionPage.Text = text; connectionPage.Controls.Add(connectionTab); connectionTab.Dock = DockStyle.Fill; this._model.LocaleManager.LocalizeDeep(this, connectionTab.Controls); return connectionTab; }
internal void Init(ConnectionTabControl parent, PreprocessorAreaData area, ConcreteTemplateNodeDefinition definition, MsSqlAuditorModel model) { if (parent == null) { throw new ArgumentNullException("parent"); } if (area == null) { throw new ArgumentNullException("area"); } if (definition == null) { throw new ArgumentNullException("definition"); } if (model == null) { throw new ArgumentNullException("model"); } if (!area.IsConfigured) { throw new ArgumentOutOfRangeException("area"); } this._area = area; this._parent = parent; this._model = model; table.StartConfiguring(); var rows = this._area.Rows; var columns = this._area.Columns; // _templateId = !String.IsNullOrWhiteSpace(definition.Connection.TemplateId) ? definition.Connection.TemplateId : definition.Connection.TemplateFileName; if (!String.IsNullOrWhiteSpace(definition.Connection.TemplateId)) { this._templateId = definition.Connection.TemplateId; } else { this._templateId = string.IsNullOrEmpty(definition.Connection.TemplateDir) ? definition.Connection.TemplateFileName : Path.Combine(definition.Connection.TemplateDir, definition.Connection.TemplateFileName); } this._nodeId = !String.IsNullOrWhiteSpace(definition.TemplateNode.Id) ? definition.TemplateNode.Id : definition.TemplateNode.Name; this._areaId = !String.IsNullOrWhiteSpace(this._area.Id) ? this._area.Id : this._area.Name; this._reportLanguage = this._model.Settings.ReportLanguage; this._splitterSettings = this._model.LayoutSettings.GetExtendedSettings<SplitterSettings>(this._templateId, String.Empty, this._reportLanguage); if (this._splitterSettings == null) { this._splitterSettings = new SplitterSettings { SplitterNodeSettingList = new List<SplitterSetting>() }; } var splitterSetting = this._splitterSettings.SplitterNodeSettingList.FirstOrDefault( s => string.Equals(s.NodeId, this._nodeId, StringComparison.InvariantCultureIgnoreCase) && string.Equals(s.AreaId, this._areaId, StringComparison.InvariantCultureIgnoreCase) ); if (splitterSetting != null) { var newRows = PreprocessorAreaData.ParseGridDimension(splitterSetting.Rows, "splitterSetting.Rows"); var newColumns = PreprocessorAreaData.ParseGridDimension(splitterSetting.Columns, "splitterSetting.Columns"); if (rows.Length == newRows.Length && columns.Length == newColumns.Length) { rows = newRows; columns = newColumns; } } table.SetRows(rows); table.SetColumns(columns); List<PreprocessorData> preprocessors = _area.Preprocessors; for (int i = 0, iMax = preprocessors.Count; i < iMax; i++) { PreprocessorData preprocessor = preprocessors[i]; Control control = preprocessor.ContentFactory.CreateControl(); if (control != null) { if (control is WebBrowser) { // control.PreviewKeyDown += (s, e) => control.PreviewKeyDown += ConnectionTabArea_PreviewKeyDown; this.Disposed += (s, e) => { // // #248 - fix memory leaks during Web rendering // // if (e.KeyCode == Keys.F5) // { // _parent.F5RefreshView(); // } control.PreviewKeyDown -= ConnectionTabArea_PreviewKeyDown; IntPtr currentProcessHandle = (IntPtr)(-1); SafeNativeMethods.EmptyWorkingSet(currentProcessHandle); }; } #region Wrap control to frame with title if (preprocessor.VerticalTextAlign != null) { var titleFrame = new TitleFrame( preprocessor.VerticalTextAlign, preprocessor.TextAlign, control ); titleFrame.Title = preprocessor.Name; control = titleFrame; } #endregion table.AddControlToCell( preprocessor.Column - 1, preprocessor.Row - 1, preprocessor.ColSpan, preprocessor.RowSpan, control ); } } table.StopConfiguring(); this._splitterChanged = false; if (!this._handlingSplitterMoved) { this._handlingSplitterMoved = true; table.SplitterMoved += TableSplitterMoved; } }