public void OnMenuFileSaveActivate(object obj, EventArgs args) { if (this.saveFilename.IsEmpty()) { this.OnMenuFileSaveAsActivate(obj, args); return; } if (this.totalLog == null) { // this.ShowCannotSaveFileDialog this.fileSaveDialog.Filename = ""; this.saveFilename.ResetName(); return; } this.GetSelectedSlices(); this.resultLog.WriteFile(this.saveFilename.Filename, false); string status = String.Format("{0}: \"{1}\", {2}: {3}", Drohne.i18n("File Saved"), this.saveFilename.Filename, Drohne.i18n("Total Entries"), this.resultLog.dataArray.Count); this.statusbar.Push(1, status); }
public static void Main(string[] args) { Drohne.SetCultureInfo(); //Drohne.TestBench(); new GUI(args); }
private void ShowUnknownLogFormatDialog(string filename) { string errorMessage = String.Format("{0}:\r\n\"{1}\"", Drohne.i18n("Unknown log format"), filename); MessageDialog dialog = new MessageDialog(this.fileOpenDialog, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Close, errorMessage); dialog.Run(); dialog.Destroy(); }
/********************** * additional dialogs * **********************/ private void ShowDifferentLogFormatDialog(string filename) { string warning = String.Format("{0}:\r\n\"{1}\"", Drohne.i18n("Different log format detected"), filename); MessageDialog dialog = new MessageDialog(this.fileOpenDialog, DialogFlags.DestroyWithParent, MessageType.Warning, ButtonsType.Close, warning); dialog.Run(); dialog.Destroy(); }
private void LoadSelectedLogFiles(ArrayList logFiles) { int count = 0; string status = ""; this.totalLog = null; foreach (Hashtable logFileInfo in logFiles) { string fn = (String)logFileInfo["Filename"]; LogFormat format = (LogFormat)logFileInfo["Format"]; if (this.totalLog == null) { this.totalLog = LogBase.CreateLogInstanceFromFile(fn, format); } else { this.totalLog.Append(LogBase.CreateLogInstanceFromFile(fn, format)); } if (format != this.totalLog.Format) { this.ShowDifferentLogFormatDialog(fn); } status = String.Format("{0}: \"{1}\"", Drohne.i18n("Loaded File"), fn); this.statusbar.Push(1, status); if (count++ == 0) { this.saveFilename.Extension = FilenameHelper.GetExtension(fn); } } status = String.Format("{0}: {1}, {2}: {3}", Drohne.i18n("Files Loaded"), count, Drohne.i18n("Log Format"), this.totalLog.Format); this.statusbar.Push(1, status); this.PopulateSlicesTreeView(); }
/************************************** * signal handlers for fileOpenDialog * **************************************/ public void OnFileOpenDialogOkButtonClicked(object obj, EventArgs args) { string[] selections = this.fileOpenDialog.Selections; LogFormat format = LogFormat.Unknown; ArrayList logFiles = new ArrayList(); int count = 0; foreach (string fn in selections) { if (Directory.Exists(fn)) { continue; } format = LogBase.DetectLogFormatFromFile(fn); if (format == LogFormat.Unknown) { this.ShowUnknownLogFormatDialog(fn); continue; } Hashtable logFileInfo = new Hashtable(); logFileInfo["Filename"] = fn; logFileInfo["Format"] = format; logFiles.Add(logFileInfo); count++; } if (count == 0) { return; } string status = String.Format("{0}: {1}", Drohne.i18n("Selected Files"), count); this.statusbar.Push(1, status); this.fileOpenDialog.Hide(); this.LoadSelectedLogFiles(logFiles); }
/****************************** * methods for slicesTreeView * ******************************/ private void SetupSlicesTreeView() { this.slicesStore = new ListStore(typeof(int), typeof(bool), typeof(string), typeof(string)); this.slicesTreeView.Model = slicesStore; CellRendererToggle crt = new CellRendererToggle(); crt.Activatable = true; crt.Toggled += CellRendererToggleToggled; this.slicesTreeView.AppendColumn(Drohne.i18n("Select"), crt, "active", 1); this.slicesTreeView.AppendColumn(Drohne.i18n("Log Start"), new CellRendererText(), "text", 2); this.slicesTreeView.AppendColumn(Drohne.i18n("Log End"), new CellRendererText(), "text", 3); }