Skip to content

Commit 710c1aa

Browse files
committed
Enhancement
1 parent 0337827 commit 710c1aa

File tree

4 files changed

+53
-42
lines changed

4 files changed

+53
-42
lines changed

CSMDevHelper/CSMDevHelper.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<BootstrapperEnabled>true</BootstrapperEnabled>
3232
</PropertyGroup>
3333
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
34-
<PlatformTarget>x86</PlatformTarget>
34+
<PlatformTarget>AnyCPU</PlatformTarget>
3535
<DebugSymbols>true</DebugSymbols>
3636
<DebugType>full</DebugType>
3737
<Optimize>false</Optimize>

CSMDevHelper/EventNode.cs

+8
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ public bool hasModeling
6363
get{ return this.eventInfo.Modeling != default(String); }
6464
}
6565

66+
public string Text
67+
{
68+
get
69+
{
70+
return "HELL";
71+
}
72+
}
73+
6674
public string Monitor
6775
{
6876
get

CSMDevHelper/frmCSMDH.Designer.cs

+3-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CSMDevHelper/frmCSMDH.cs

+41-40
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ public frmCSMDH()
3737
{
3838
InitializeComponent();
3939
this.rootNode = null;
40-
this.toolTip = null;
4140
this.treeLog.Sorted = true;
4241
this.dictGCID = new Dictionary<string, HashSet<string>>();
4342

@@ -68,6 +67,7 @@ public frmCSMDH()
6867
this.listFilterNode.ListChanged += new ListChangedEventHandler(listFilterNode_ListChanged);
6968

7069
this.log_filename = @"C:\ProgramData\Mitel\Customer Service Manager\Server\Logs\TelDrv.log";
70+
7171
this.registryHandler = new RegistryHandler();
7272

7373
this.waitHandle = new AutoResetEvent(false);
@@ -105,18 +105,23 @@ private void btnLogStart_Click(object sender, EventArgs e)
105105

106106
try
107107
{
108-
if (rbtnMCD.Checked)
108+
if ((rbtnAuto.Checked &&
109+
registryHandler.DriverVersion == enumDriverVersion.CP5000) ||
110+
rbtnCP.Checked)
109111
{
110-
logReader = new LogMCDReader(log_filename, !chkTailing.Checked);
112+
logReader = new LogCPReader(log_filename, !chkTailing.Checked);
111113
}
112-
else if (rbtnCP.Checked)
114+
else if ((rbtnAuto.Checked &&
115+
(registryHandler.DriverVersion == enumDriverVersion.MCD4x ||
116+
registryHandler.DriverVersion == enumDriverVersion.MCD5x)) ||
117+
rbtnMCD.Checked)
113118
{
114-
logReader = new LogCPReader(log_filename, !chkTailing.Checked);
119+
logReader = new LogMCDReader(log_filename, !chkTailing.Checked);
115120
}
116121
else
117122
{
118123
//TODO Fill this section
119-
logReader = new LogMCDReader(log_filename, !chkTailing.Checked);
124+
throw new Exception("The driver version should be checked!");
120125
}
121126
}
122127
catch (Exception ex)
@@ -511,7 +516,7 @@ private void treeLog_MouseDown(object sender, MouseEventArgs e)
511516
{
512517
if (ModelingForm ==null)
513518
{
514-
if (e.Button == MouseButtons.Right)
519+
if (e.Button == MouseButtons.Middle)
515520
{
516521
TreeNode node = treeLog.GetNodeAt(e.X, e.Y);
517522
if (node != null && node.Parent == null)
@@ -583,23 +588,20 @@ private void treeLog_MouseDown(object sender, MouseEventArgs e)
583588
ModelingForm.AutoSize = true;
584589
ModelingForm.Show(this);
585590
ModelingForm.ResumeLayout();
586-
//CSMEvent tag = (CSMEvent)node.Tag;
587-
//string msgToolTip = String.Format("{0:4}Monitor: {1}", String.Empty, tag.eventInfo.MonitorHandlerExtension);
588-
//if (tag.eventInfo.CGCID != default(string))
589-
//{
590-
// msgToolTip += String.Format("{0}{1:4}CGCID: {2}", Environment.NewLine, String.Empty, tag.eventInfo.CGCID);
591-
//}
592-
//if (tag.eventInfo.PGCID != default(string))
593-
//{
594-
// msgToolTip += String.Format("{0}{1:4}PGCID: {2}", Environment.NewLine, String.Empty, tag.eventInfo.PGCID);
595-
//}
596-
//msgToolTip += String.Format("{0}{1}", Environment.NewLine, tag.eventInfo.Modeling);
597-
//toolTip = new ToolTip();
598-
//toolTip.ToolTipTitle = String.Format("Event: {0}", tag.eventInfo.Type);
599-
//toolTip.UseAnimation = false;
600-
//toolTip.UseFading = false;
601-
//toolTip.Show(msgToolTip, (IWin32Window)sender, e.X, e.Y);
602-
//treeLog.SelectedNode = node;
591+
}
592+
}
593+
else if (e.Button == MouseButtons.Right)
594+
{
595+
TreeNode node = treeLog.GetNodeAt(e.X, e.Y);
596+
if (node != null && node.Parent == null)
597+
{
598+
treeLog.SelectedNode = node;
599+
string result = (node.Text + Environment.NewLine).TrimStart();
600+
foreach (TreeNode inode in node.Nodes)
601+
{
602+
result += " " + inode.Text + Environment.NewLine;
603+
}
604+
Clipboard.SetText(result);
603605
}
604606
}
605607
}
@@ -612,10 +614,10 @@ private void treeLog_MouseDown(object sender, MouseEventArgs e)
612614

613615
private void treeLog_KeyDown(object sender, KeyEventArgs e)
614616
{
615-
if (toolTip != null)
617+
if (ModelingForm != null)
616618
{
617-
toolTip.Hide(treeLog);
618-
toolTip = null;
619+
ModelingForm.Close();
620+
ModelingForm = null;
619621
}
620622
}
621623

@@ -631,6 +633,18 @@ private void openLogFile(object sender, EventArgs e)
631633
if (dialog.ShowDialog() == DialogResult.OK)
632634
{
633635
log_filename = dialog.FileName;
636+
if (log_filename.Equals(default_log_filename,StringComparison.CurrentCultureIgnoreCase))
637+
{
638+
rbtnAuto.Visible = true;
639+
rbtnMCD.Visible = false;
640+
rbtnCP.Visible = false;
641+
}
642+
else
643+
{
644+
rbtnAuto.Visible = false;
645+
rbtnMCD.Visible = true;
646+
rbtnCP.Visible = true;
647+
}
634648
this.btnLogStop_Click(sender, e);
635649
}
636650
}
@@ -657,22 +671,12 @@ private void updateVersionLabel()
657671

658672
private void button1_Click(object sender, EventArgs e)
659673
{
660-
//if (comboBox1.Text != String.Empty)
661-
//{
662-
663-
//}
664-
//LibraryHandler libHandler = new LibraryHandler();
665-
//libHandler.UnregisterDll("TelCommon.dll");
666-
//libHandler.RegisterDll("TelCommon.dll");
667674
if (ModelingForm == null)
668675
{
669676
ModelingForm = new Form();
670677
ModelingForm.StartPosition = FormStartPosition.Manual;
671678
ModelingForm.Left = Cursor.Position.X + 5;
672679
ModelingForm.Top = Cursor.Position.Y + 5;
673-
//ModelingForm.Width = 0;
674-
//ModelingForm.Height = 0;
675-
//ModelingForm.FormBorderStyle = FormBorderStyle.None;
676680
ModelingForm.FormBorderStyle = FormBorderStyle.Sizable;
677681
ModelingForm.Name = "frmModeling";
678682
ModelingForm.BackColor = System.Drawing.Color.LightGray;
@@ -682,7 +686,6 @@ private void button1_Click(object sender, EventArgs e)
682686
eee.Multiline = true;
683687
eee.ReadOnly = true;
684688
TabControl tbc = new TabControl();
685-
//tbc.SizeMode = TabSizeMode.Fixed;
686689
SplitContainer sc = new SplitContainer();
687690
TableLayoutPanel tbl = new TableLayoutPanel();
688691
Button b = new Button();
@@ -709,8 +712,6 @@ private void button1_Click(object sender, EventArgs e)
709712
sc.AutoSize = true;
710713
tbl2.ResumeLayout();
711714
tbl.ResumeLayout();
712-
//sc.Panel1.Size = PreferredSize;
713-
//sc.Panel2.Size = PreferredSize;
714715
sc.BorderStyle = BorderStyle.Fixed3D;
715716
sc.AutoSize = true;
716717
string aaa = @"

0 commit comments

Comments
 (0)