private void cmdApplyAndClose_Click(object sender, EventArgs e) { SelectedLogFiles = GetAllSelectedLogs(); if (SelectedLogFiles.Count == 0) { Mbox.Show("There are no selected files.\r\n\r\nUse Ctrl-A to select all files\r\n\r\nUse Ctrl/Shift And click on row for individual select.", "No selected files", MessageBoxButtons.OK); return; } DialogResult = DialogResult.OK; Close(); }
private void cmdApplyAndClose_Click(object sender, EventArgs e) { _filter.QuickFilters = new List <QuickFilterValues>(); foreach (var item in lstCheckBox.CheckedItems) { _filter.QuickFilters.AddRange(((QuickFilterDisplay)item).GetFilters()); } if (!string.IsNullOrWhiteSpace(txtFilter.Text)) { var newFilters = txtFilter.Lines?.ToList().Where(p => !string.IsNullOrEmpty(p)); if (newFilters != null) { foreach (var newFilter in newFilters) { bool negFilter = false; var filter = newFilter; if (radStartsWith.Checked) { filter = $"^{filter}"; } if (radNotContains.Checked) { negFilter = true; } try { var regex = new Regex(filter); Trace.WriteLine(regex.IsMatch("")); _filter.QuickFilters.Add(new QuickFilterValues { FilterValue = filter, FriendlyName = (negFilter ? "<>" : "=") + filter, ColumnName = cboColumn.SelectedIndex > 0 ? cboColumn.SelectedItem.ToString() : null, NegativeFilter = negFilter }); } catch { Mbox.Show("The filter is not correct. Edit or Cancel", "No you dont!"); return; } } } } Close(); }
private static async Task <bool> AskInstallNewerVersion(IStoreFactory storeFactory, ApplicationVersion newerVersion) { if (_skipAskDownload) { return(false); } try { Log.To.Main.Add($"There is a new version available. Current version: {Version}, available version: {newerVersion}"); DialogResult doYouWantToDownload = Mbox.Show( string.Join("\r\n", "Great Scott! There's an update available.", $"Changes in version {newerVersion} include:", "", newerVersion.Description, "", "Would you like to download and install the latest version?"), null, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (doYouWantToDownload != DialogResult.Yes) { return(false); } //SplashManager.Loader.ShowFloatingSplash(SplashManager.Loader.GetDefaultOwner()); //splashFormStatus.Text = "Downloading..."; var packageManager = new PackageManager(storeFactory); string packageFilename = await packageManager.DownloadLatestVersionPackage(ApplicationId); return(PackageManager.InstallApplication(packageFilename)); } catch (Exception ex) { Log.To.Main.AddException("Error in AskInstallNewerVersion", ex); return(false); } }
private async Task DoReload(string path) { Switchboard.Instance.Initialize(CtrlDockPanelMain, this); var splash = SplashManager.Loader.ShowFloatingSplash(this, "Loading files..."); try { if (_filesystem.FileExists(path) && !_filesystem.Path.GetExtension(path).Equals(".zip", StringComparison.InvariantCultureIgnoreCase) && _isInitialized) { //single file var res = Mbox.Show("Do you want to keep all other files open?,", "Keep files open", MessageBoxButtons.YesNo); if (res != DialogResult.Yes) { Switchboard.Instance.CloseAllOpenAndReset(); } await Switchboard.Instance.ReloadAllData(path); await Switchboard.Instance.LoadPanelHelper.ShowLastLoadedLog(); } else { Switchboard.Instance.CloseAllOpenAndReset(); await Switchboard.Instance.ReloadAllData(path); Switchboard.Instance.LoadPanelHelper?.ShowStartPageAfterLoad(); } lblStrip1.Text = $@"Data load done {DateTime.Now:yyyy-MM-dd HH:mm:ss}"; } catch (Exception e) { MessageBox.Show(@"We did not manage to read this.\r\n" + e); } finally { splash.Dispose(); _isInitialized = true; } }
private void toggleParalellScrollingToolStripMenuItem_Click(object sender, EventArgs e) { Switchboard.Instance.Settings.Documents.ParallelScrollingEnabled = Switchboard.Instance.Settings.Documents.ParallelScrollingEnabled != true; Mbox.Show($"Parallel Scolling is now {(Switchboard.Instance.Settings.Documents.ParallelScrollingEnabled ? "Enabled" : "Disabled")}"); }
private void AddNewLog(SenseLogInfo logInfo, string key) { var splash = SplashManager.Loader.ShowFloatingSplash(this, "Opening log"); try { if (_gridAndData.ContainsKey(key)) { return; } _gridAndData.Add(key, new DataWrapper { Name = logInfo.Name, IsDirectory = logInfo.IsDirectory, LogFilePath = logInfo.LogFilePath, LastModified = logInfo.LastModified }); ctrlTab1.SuspendLayout(); ctrlTab1.TabPages.Add(key, logInfo.Name); var tab = ctrlTab1.TabPages[key]; tab.Tag = key; tab.ImageIndex = 0; var gridCtrl = new GridWrapperControl <GenericDataWrapper>(RecalcFilterBox, _gridAndData[key].GridAndDataWrapper); gridCtrl.Grid.Scroll += GridCtrlOnScroll; gridCtrl.Grid.MouseMove += GridOnMouseMove; gridCtrl.Grid.MouseDown += (sender, args) => { ctrlPreview.HideDisplay(); }; gridCtrl.RightClikFilterGenerator = GenerateRightClickMenu; gridCtrl.RightClikFilterDateColumnGetter = RightClikFilterDateColumnGetter; gridCtrl.ClearFiltersInAllGrids = ClearFiltersInAllGrids; gridCtrl.Dock = DockStyle.Fill; tab.Controls.Add(gridCtrl); _gridAndData[key].GenericDataWrapperService.LogFileAnalyzer = new LogFileAnalyzerService(); var fileCutoff = _gridAndData[key].GenericDataWrapperService.LoadToJson(logInfo.LogFilePath); _gridAndData[key].GridAndDataWrapper.GridHelper = CreateGrid(gridCtrl.Grid, key, _gridAndData[key]); _gridAndData[key].GridAndDataWrapper.GridInvoked = true; _gridAndData[key].GridAndDataWrapper.GridHelper.Grid.FormatRow += GridOnFormatRow; _gridAndData[key].GridAndDataWrapper.DateColumnGetter = GetDateColumnGetter; _gridAndData[key].GridWrapperControl = gridCtrl; ResizeAllToCurrentSize(gridCtrl.Controls); _closeTabHelper[0].SetTabHeader(tab, _gridAndData[key].GenericDataWrapperService.LogFileAnalyzer.SimplifiedFailureLevel); ctrlTab1.SelectedTab = tab; ctrlTab1.ResumeLayout(); if (ctrlTab1.TabPages.Count > 1 || ctrlTab1.TabPages.Count > 1) { picDown.Visible = true; } splash.Dispose(); if (fileCutoff > 0) { Mbox.Show("This file is too large and has been capped at 1 million lines.", "I'm sorry about this"); } } catch (Exception e) { splash.Dispose(); Mbox.Show($"Failed opening log \r\n{e}", "Failure"); } }
private async Task <bool> LoadStuff() { var helper = new ModelFilterHelper(); var headers = new Dictionary <string, ColumnHeaderWrapper <EventLogEntryShort> > { { "Level", helper.CreateColumnHeaderWrapper <EventLogEntryShort, string>("Level", "Level") }, { "Source", helper.CreateColumnHeaderWrapper <EventLogEntryShort, string>("Source", "Source") }, { "Event Id", helper.CreateColumnHeaderWrapper <EventLogEntryShort, long?>("Event Id", "InstanceId") }, { "Message", helper.CreateColumnHeaderWrapper <EventLogEntryShort, string>("Message", "Message").IgnoreInGrid() }, { "User", helper.CreateColumnHeaderWrapper <EventLogEntryShort, string>("User", "User").IgnoreInGrid() }, { "Date and time", helper.CreateColumnHeaderWrapper <EventLogEntryShort, DateTime?>("Date and time", "Logged") } }; List <EventLogEntryShort> res = new List <EventLogEntryShort>(); _gridAndData = new Dictionary <string, DataWrapper>(); if (Switchboard.Instance.LogCollectorOutput?.GroupedServerInfo != null) { //var splash = SplashManager.Loader.ShowFloatingSplash(this,"Opening Windows logs.."); ShowSplash("Opening Windows logs.."); try { _validationErrors = new List <string>(); res = await Switchboard.Instance.LogCollectorOutput.WindowsEventLogItems(JsonErrors); if (_validationErrors.Any()) { string err = _validationErrors.Take(5).Aggregate((curr, next) => curr + "\r\n" + next); Mbox.Show($"We had problems parsing this Windows event log. We found {_validationErrors.Count} errors\r\n\r\n{err}", "Problems in parsing Windows event log"); } } catch (Exception e) { Mbox.Show($"The Windows log is invalid.\r\n\r\n{e}", "Sorry we can't read this"); } finally { HideSplash(); } } if (res == null) { return(false); } foreach (var item in res) { if (item.LogName == null) { continue; } if (!_gridAndData.ContainsKey(item.LogName)) { _gridAndData.Add(item.LogName, new DataWrapper()); _gridAndData[item.LogName].GridAndDataWrapper.Data = new List <EventLogEntryShort>(); _gridAndData[item.LogName].GridAndDataWrapper.Headers = headers; } _gridAndData[item.LogName].GridAndDataWrapper.Data.Add(item); } InvokeGrid(CtrlGridTabs.SelectedTab); return(true); }