/// <summary> /// Search for the inserted text in the entire panel. /// </summary> /// <param name="panel">The panel in which to search.</param> public List <int> SearchInEditor(PanelActive panel, List <int> lista) { if (panel.TextBox1.Text == "") { panel.Label3.Text = ""; return(new List <int>()); } if (panel.ListView1.Items.Count > 0) { panel.Label3.Text = "0"; foreach (System.Windows.Forms.ListViewItem item in panel.ListView1.Items) { if (item.Text.IndexOf(panel.TextBox1.Text, StringComparison.OrdinalIgnoreCase) >= 0) { lista.Add(item.Index); panel.Label3.Visible = true; panel.Label3.Text = (Int32.Parse(panel.Label3.Text) + 1).ToString(); } int i = 0; foreach (System.Windows.Forms.ListViewItem.ListViewSubItem subItem in item.SubItems) { if (subItem.Text.IndexOf(panel.TextBox1.Text, StringComparison.OrdinalIgnoreCase) >= 0) { lista.Add(item.Index); panel.Label3.Visible = true; panel.Label3.Text = (Int32.Parse(panel.Label3.Text) + 1).ToString(); i++; } } } panel.Label3.Text = panel.Label3.Text + " matches"; } return(lista); }
/// <summary> /// Remove the param from the main form. /// </summary> /// <param name="panel">The panel to remove.</param> public void RemoveList(PanelActive panel) { foreach (LogList list in LogList) { if (list.Panel.Equals(panel)) { LogList.Remove(list); break; } } //var tmp = Align(); Draw(); }
/// <summary> /// Execute the parsing process, with the drawing process. /// </summary> /// <param name="panel">Where to put the parsed content.</param> public void Parse(PanelActive panel) { var FileName = Path.GetFileName(panel.Label2.Text); var ParsingMode = GetParsingMode(FileName, panel.Label2.Text); if (ParsingMode == 1) { ParserClass = new ParserMode1(); } else if (ParsingMode == 2) { ParserClass = new ParserMode2(); } else if (ParsingMode == 3) { ParserClass = new ParserMode3(); } else if (ParsingMode == 4) { ParserClass = new ParserMode4(); } else { MessageBox.Show("Cross Log cannot read this file.\n\nTo get help, click the \"?\" button on the top menu.", "Invalid parsing mode"); return; } var taskResult = new List <Log>(); taskResult = ParserClass.Parse(panel.Label2.Text); var tmp = ParserClass.GetDateFromFileName(panel.Label2.Text); if (tmp.Year != 1) { panel.Label4.Text = tmp.Day + " - " + tmp.Month + " - " + tmp.Year; } else { panel.Label4.Text = "Cannot load date"; } logList.Add(new LogList(panel, taskResult)); return; }
/// <summary> /// Change the selected line in all the editors. /// </summary> public void ChangeSelection(PanelActive panelActive) { if (panelActive.ListView1.SelectedItems.Count <= 0) { return; } int t = 0; foreach (PanelActive panel in FormClass.TableLayoutPanel1.Controls) { if (panel.ListView1.Items.Count > 0) { if (selected == LogList[t].ListLog.Count) { panel.ListView1.Items[selected].BackColor = Color.Yellow; panel.ListView1.Items[selected].ForeColor = Color.Black; } else { panel.ListView1.Items[selected].BackColor = LogList[t].ListLog[selected].BackColor; panel.ListView1.Items[selected].ForeColor = LogList[t].ListLog[selected].ForeColor; LogList[t].ListLog[selected].BackColor = panel.ListView1.Items[selected].BackColor; LogList[t].ListLog[selected].ForeColor = panel.ListView1.Items[selected].ForeColor; } } t++; } selected = panelActive.ListView1.SelectedItems[panelActive.ListView1.SelectedItems.Count - 1].Index; panelActive.ListView1.Items[selected].EnsureVisible(); t = 0; foreach (PanelActive panel in FormClass.TableLayoutPanel1.Controls) { if (panelActive.ListView1.SelectedItems.Count > 0 && panel.ListView1.Items.Count >= selected) { panel.ListView1.Items[selected].BackColor = Color.DodgerBlue; panel.ListView1.Items[selected].ForeColor = Color.White; panel.ListView1.TopItem = panel.ListView1.Items[panelActive.ListView1.Items.IndexOf(panelActive.ListView1.TopItem)]; } t++; } panelActive.ListView1.SelectedItems.Clear(); ChangeMainScrollPosition(selected, panelActive); }
/// <summary> /// Change the list view font due XML settings. /// </summary> public void SetPanelFont(PanelActive panel) { try { var xml = new XmlDocument(); var AppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); xml.Load(AppDataPath + "\\Axel Technology\\Cross Log\\preferences.xml"); var Nodes = xml.DocumentElement.ChildNodes; var FontNode = Nodes[0]; var FontName = FontNode["name"].InnerText; var FontSize = Int32.Parse(FontNode["size"].InnerText); panel.ListView1.Font = new Font(FontName, FontSize); } catch { MessageBox.Show("Cross Log cannot read the value from the XML consfiguration file.\nThis is caused by a bad formatted string in the file.\n\nTo fix the problem click the \"?\" button on the top menu.", "Invalid XML value", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Add an editor to the main form. /// </summary> public void AddEditor() { form.TableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100)); form.TableLayoutPanel1.CellBorderStyle = TableLayoutPanelCellBorderStyle.Inset; form.TableLayoutPanel1.GrowStyle = TableLayoutPanelGrowStyle.AddColumns; PanelActive panel = new PanelActive(form.ControllerInstance); form.TableLayoutPanel1.Controls.Add(panel); panel.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right); form.Label4.Text = (Int32.Parse(form.Label4.Text) + 1).ToString(); panel.Label1.Text = "Viewer " + (Int32.Parse(form.Label4.Text)).ToString(); panel.ListView1.View = View.Details; panel.ListView1.AllowColumnReorder = true; panel.ListView1.Columns.Add("Time", 90, HorizontalAlignment.Left); panel.ListView1.Columns.Add("Mode", 70, HorizontalAlignment.Left); panel.ListView1.Columns.Add("Description", 500, HorizontalAlignment.Left); if (true) { panel.ListView1.Columns.Add("Function Call", 200, HorizontalAlignment.Left); } }
/// <summary> /// Change universal scroll bar position according to the selected line. /// </summary> public void ChangeMainScrollPosition(int line, PanelActive panel) { FormClass.VScrollBar1.Value = (line * 90) / panel.ListView1.Items.Count; }
/// <summary> /// Remove the param from the main form. /// </summary> /// <param name="panel">The panel to remove.</param> public void RemoveEditor(PanelActive panel) { drawerClass.RemoveEditor(panel); }
/// <summary> /// Remove the panel from the main form. /// </summary> /// <param name="panel">The panel to remove.</param> public void RemoveEditor(PanelActive panel) { form.TableLayoutPanel1.Controls.Remove(panel); form.Label4.Text = (Int32.Parse(form.Label4.Text) - 1).ToString(); }