private void OpenFile(bool addTab) { DialogResult openDialogResult = openFileDialog.ShowDialog(); if (openDialogResult == DialogResult.OK) { var opened = radDock.GetWindow <DocumentWindow>(SavedLogsLoader.SavedLogsKeyOf(openFileDialog.FileName)); if (opened != null) { radDock.ActiveWindow = opened; return; } if (addTab) { AddNewTab(); } LoadGrid(radDock.ActiveWindow, openFileDialog.FileName, true); RadPageControl page = radDock.ActiveWindow.Controls["RadPageControl"] as RadPageControl; if (page != null) { lblLinesCount.Text = Resources.statusbar_lines + page.LinesCount; } } }
private void Setupcontrols() { ThemeResolutionService.ApplicationThemeName = Settings.Default.ThemeName; chkAutoRefresh.Checked = Convert.ToBoolean(Settings.Default.AutoRefreshEnabled); SavedLogsLoader.LoadSavedLogsPaths(); foreach (var pair in SavedLogsLoader.SavedLogsDic) { lstSavedLogs.Items.Add(new RadListDataItem(pair.Key, pair.Value)); } lstSavedLogs.SelectedIndex = -1; }
private void btnSave_Click(object sender, EventArgs e) { try { SavedLogsLoader.SavedLogsDic.Add(txtKey.Text, SavedLogsLoader.GetConfigPath(txtPath.Text, txtFileNameFormat.Text)); SavedLogsLoader.SaveLogPath(txtKey.Text, txtFileNameFormat.Text); RadMessageBox.Show("New path saved", "Saved Successfully", MessageBoxButtons.OK, RadMessageIcon.Info); DialogResult = DialogResult.OK; _key = txtKey.Text; Close(); } catch (Exception ex) { RadMessageBox.Show(ex.Message, "Error while saving", MessageBoxButtons.OK, RadMessageIcon.Error); } }
private void radDock_ActiveWindowChanged(object sender, DockWindowEventArgs e) { RadPageControl page = e.DockWindow?.Controls["RadPageControl"] as RadPageControl; if (page == null) { return; } lblFileName.Text = page.FilePath; lblLinesCount.Text = Resources.statusbar_lines + page.LinesCount; int index = SavedLogsLoader.SavedLogsIndexOf(e.DockWindow.Name); if (index != -1) { lstSavedLogs.SelectedItem = lstSavedLogs.Items.FirstOrDefault(i => i.Text == e.DockWindow.Name); } page.LogLinesGrid.CurrentRowChanged += grdLogs_CurrentRowChanged; page.LogLinesGrid.DataBindingComplete += grdLogs_CountUpdated; }
private void LoadGrid(DockWindow document, string filePath, bool autoRefreshEnabled) { RadPageControl page = document.Controls["RadPageControl"] as RadPageControl; if (page == null) { return; } page.AutoRefreshEnabled = autoRefreshEnabled; page.FilePath = filePath; page.LoadGrid(); lblFileName.Text = page.FilePath; if (SavedLogsLoader.SavedLogsContains(filePath)) { radDock.ActiveWindow.Text = SavedLogsLoader.SavedLogsKeyOf(filePath); } else if (!radDock.ActiveWindow.Text.Contains(Resources.UnsavedFileIndicator)) { radDock.ActiveWindow.Text += Resources.UnsavedFileIndicator; } document.Name = document.Text; }