functions

  • Thread starter Thread starter juli jul
  • Start date Start date
J

juli jul

Hello,
I would like to know if there is a function which is running during the
runtime of my program all the time and where I could place events
overloading and things I need to check during the run(Like if some tab
page been pressed )?
Thanks!
 
To be informed of such things you must add handlers to the various events
provided by your controls. These call into your code when the user interacts
with the interface.

To detect the use of a tab page you'll get the
TabControl.SelectedIndexChanged event.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
10xs but where exactly - which function I should place those events?
Which function will continuesly run and check for inputs during all the
run?
 
You need to read up more on events and forms. The way you've phrased
the question tells me that you have some fundamental misunderstandings
about how forms applications run.

There _is no_ "function" that will "continuously run" and check for
inputs while your application is running. That's not how it works at
all.

In brief, the way it works is that you _subscribe_ to events coming
from various parts of your form. For example, you mentioned a tab page.
You can subscribe to a tab page's "VisibilityChanged" event. What this
means is that _the tab page will call your function_ whenever it goes
from showing to not showing, or vice versa. There _is no_ "master
function" watching the tab page in which you place your code. _You have
to write_ a function to do something and then tell the tab page, "Call
this whenever your visibility changes."

As I said, you have to do some reading on forms and events and how they
work. It's too big a topic to explain here in sufficient detail.
 
Thanks for the advice BUT what I am trying to understand is where I
should place the :
this.comboBox.SelectedIndexChanged+=new
EventHandler(comboBox_SelectedIndexChanged);
Because if I place it in the onLoad function of the form-there are no
values in comboBox and the action is not taking place. How do I do it?
Thanks a lot.
 
You put it in the OnLoad function of the form.

It doesn't matter that there aren't yet any values in the combo box.
Once you've hooked up the event handler, it will be called whenever the
selected index of the combo box changes in future, when it _does_ have
values in it.

Typically you want to hook it up _after_ you put values in the combo
box, but not because it won't work if you don't, but because if you do
it before, you may get a bunch of unwanted events when you're loading
up the combo box. However, the thing works whether you hook it up
before you load up the combo box, or after. It doesn't matter.

If your event handler is not being called, then your event handler is
not being hooked up to the combo box. Are you sure that OnLoad is being
called?

Also, if you don't care about spurious events, connect the event
handler in the Visual Studio IDE rather than in the OnLoad method of
your form. This will connect it when the form is being constructed, way
before OnLoad. The only drawback, as I said, is that you may get a
bunch of calls to comboBox_SelectedIndexChanged as the combo box is
loaded up with values.
 
10xs but it's not really working and the weird thing is that if I am
putting this code(with +=) to some function activated during the run of
the program -the events fires and handler works(although not
properly).Maybe I should add something or place it somewere else except
the onLoad?
 
Maybe you should submit what Jon Skeet calls a "short but complete
program". Make a copy of your problem form and strip stuff away until
you get a small, compact program that demonstrates the problem, then
post the code here, and we can tell you what is going wrong.
 
Thank you ,I will try to post parts of my code here:

private void LogAnalysis_Load(object sender, System.EventArgs e)
{
this.comboBox.SelectedItemChanged+=new
EventHandler(comboBox_SelectedItemChanged); this.comboBox.SelectedValu
eChanged+=new EventHandler(comboBox_SelectedValueChanged);
this.comboBox.SelectedIndexChanged+=new
EventHandler(comboBox_SelectedIndexChanged);
}
private void uiCommandBar1_CommandClick(object sender,
Janus.Windows.UI.CommandBars.CommandEventArgs e)
{
//I am opening a text file
this.Fill_Menu
}

private void Fill_Menu()
{
//This function adds values to the comboBox
}

private void comboBox_SelectedItemChanged(object sender, EventArgs e)
{
MessageBox.Show("As");

}

private void comboBox_SelectedIndexChanged(object sender, EventArgs e)
{
MessageBox.Show("Af");
}
private void comboBox_SelectedValueChanged(object sender, EventArgs e)
{
MessageBox.Show("Ad");
}


Hope someone will figure out my proble,Thanks a lot!
 
My first question is, is LogAnalysis_Load ever being called? Put a
MessageBox.Show() in there, and verify that yes, it is being called, so
the event handlers are, in fact, being connected up.

My first suspicion would be that it's not connected to the Form's Load
event, so the combo box event handlers are never being connected.
 
Hello,I showed the MessageBox there and it worked->the load function is
called. Is there something else you might think of as a reason to my
problem?
Thanks a lot!
 
Do you ever reassign the variable this.comboBox? That is, there should
be only one place in your code that says,

this.comboBox = new ComboBox();

or something like that, and it should be the code that Visual Studio
inserted. If you reassign the combo box somewhere else, then you could
have the effects that you're seeing.
 
Hello,
I am initializing the combobox int the Fill_Menu() funcction I posted
here,didn't initialize it again(tried to do what you said but the
comboBox is empty and the event not shooting).Some other ideas?
Thank you very much:)
 
When you say "initializing the combo box", do you mean that you are
filling it with values, or that you are saying,

this.comboBox = new ComboBox(...);

?

If it is the latter then that is your problem.
 
I think that you need to post your full Fill_Menu() method so we can
see what it's doing.
 
Hello,
here is my code,the event fires but not always and sometimes the program
acts "strange" - I think it has something to do with the comboBox
events. Maybe someone could help with it-Thanks a lot!!!


using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;

namespace abc.def.Database
{

public class LogAnalysis : System.Windows.Forms.Form
{
private System.Windows.Forms.SaveFileDialog saveFileDialog1;
private string file_name;
private Janus.Windows.UI.Tab.UITab uiTab1;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.HScrollBar hScrollBar1;
protected System.Windows.Forms.Panel panel2;
protected Steema.TeeChart.TChart tChart2;
private System.Windows.Forms.HScrollBar hScrollBar2;
private Steema.TeeChart.TChart tChart1;
protected Steema.TeeChart.Styles.Line line3;
protected Steema.TeeChart.Styles.Line line4;
protected System.Windows.Forms.ToolTip toolTip1;
protected Janus.Windows.GridEX.GridEXFilterCondition grf;
protected System.Windows.Forms.ToolTip toolTip2;
private System.Windows.Forms.Splitter splitter1;
private System.Windows.Forms.Splitter splitter2;
private System.Windows.Forms.NotifyIcon notifyIcon1;
private Reader re;
private MsgBox msbx;
private Janus.Windows.UI.Tab.UITabPage tabPage1;
private Janus.Windows.UI.Tab.UITabPage Performance;
private Janus.Windows.UI.Tab.UITabPage tabPage3;
private Janus.Windows.UI.Tab.UITabPage tabPage4;
private System.Windows.Forms.StatusBar statusBar1;
private Janus.Windows.GridEX.GridEX gridex_log;
private System.Windows.Forms.StatusBar statusBar2;
protected Janus.Windows.GridEX.GridEX gridex_mem;
private System.Windows.Forms.StatusBar statusBar3;
protected Janus.Windows.GridEX.GridEX gridex_per;
private System.Windows.Forms.StatusBar statusBar4;
private Janus.Windows.GridEX.GridEX gridex_exc;
private Janus.Windows.UI.CommandBars.UICommandManager
uiCommandManager1;
private Janus.Windows.UI.CommandBars.UICommand File;
private Janus.Windows.UI.CommandBars.UICommandBar uiCommandBar1;
private Janus.Windows.UI.CommandBars.UIRebar TopRebar1;
private Janus.Windows.UI.CommandBars.UICommand Exit;
private Janus.Windows.UI.CommandBars.UICommand Exit1;
private Janus.Windows.UI.CommandBars.UICommand Open;
private Janus.Windows.UI.CommandBars.UICommand Analysis;
private Janus.Windows.UI.CommandBars.UICommand File1;
private Janus.Windows.UI.CommandBars.UICommand Open1;
private Janus.Windows.UI.CommandBars.UICommand Analysis1;
private System.Windows.Forms.RadioButton radioButton1;
private Janus.Windows.UI.CommandBars.UICommand Command0;
private Janus.Windows.UI.CommandBars.UICommand Command1;
private ArrayList command_name,class_name;
bool menu_flag;
private System.Windows.Forms.RadioButton radio;
private System.Windows.Forms.GroupBox groupBox2;
private Janus.Windows.UI.CommandBars.UICommand Command2;
private Janus.Windows.UI.CommandBars.UICommand Command21;
private Janus.Windows.UI.CommandBars.UICommand Command11;
private Janus.Windows.EditControls.UIComboBox comboBox;
private Janus.Windows.EditControls.UIComboBox comboBox2;
int counter;
private Janus.Windows.UI.Tab.UITabPage uiTabPage1;
private System.Windows.Forms.StatusBar statusBar6;
private Janus.Windows.GridEX.GridEX gridex_sql_exception;
private Janus.Windows.UI.CommandBars.UICommand Command3;
private Janus.Windows.UI.CommandBars.UICommand Command31;
private Janus.Windows.UI.CommandBars.UIRebar BottomRebar1;
private Janus.Windows.UI.CommandBars.UIRebar LeftRebar1;
private Janus.Windows.UI.CommandBars.UIRebar RightRebar1;

private System.ComponentModel.IContainer components;

public LogAnalysis()
{

InitializeComponent();




}

protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code

private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
this.uiTab1 = new Janus.Windows.UI.Tab.UITab();
this.tabPage1 = new Janus.Windows.UI.Tab.UITabPage();
this.gridex_log = new Janus.Windows.GridEX.GridEX();
this.statusBar1 = new System.Windows.Forms.StatusBar();
this.Performance = new Janus.Windows.UI.Tab.UITabPage();
this.gridex_mem = new Janus.Windows.GridEX.GridEX();
this.statusBar2 = new System.Windows.Forms.StatusBar();
this.splitter2 = new System.Windows.Forms.Splitter();
this.panel1 = new System.Windows.Forms.Panel();
this.tChart1 = new Steema.TeeChart.TChart();
this.line4 = new Steema.TeeChart.Styles.Line();
this.hScrollBar1 = new System.Windows.Forms.HScrollBar();
this.tabPage3 = new Janus.Windows.UI.Tab.UITabPage();
this.gridex_per = new Janus.Windows.GridEX.GridEX();
this.statusBar3 = new System.Windows.Forms.StatusBar();
this.splitter1 = new System.Windows.Forms.Splitter();
this.panel2 = new System.Windows.Forms.Panel();
this.tChart2 = new Steema.TeeChart.TChart();
this.line3 = new Steema.TeeChart.Styles.Line();
this.hScrollBar2 = new System.Windows.Forms.HScrollBar();
this.tabPage4 = new Janus.Windows.UI.Tab.UITabPage();
this.gridex_exc = new Janus.Windows.GridEX.GridEX();
this.statusBar4 = new System.Windows.Forms.StatusBar();
this.uiTabPage1 = new Janus.Windows.UI.Tab.UITabPage();
this.gridex_sql_exception = new Janus.Windows.GridEX.GridEX();
this.statusBar6 = new System.Windows.Forms.StatusBar();
this.comboBox = new Janus.Windows.EditControls.UIComboBox();
this.comboBox2 = new Janus.Windows.EditControls.UIComboBox();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.toolTip2 = new System.Windows.Forms.ToolTip(this.components);
this.notifyIcon1 = new
System.Windows.Forms.NotifyIcon(this.components);
this.uiCommandManager1 = new
Janus.Windows.UI.CommandBars.UICommandManager(this.components);
this.uiCommandBar1 = new Janus.Windows.UI.CommandBars.UICommandBar();
this.File1 = new Janus.Windows.UI.CommandBars.UICommand("File");
this.Analysis1 = new
Janus.Windows.UI.CommandBars.UICommand("Analysis");
this.Command31 = new
Janus.Windows.UI.CommandBars.UICommand("Command3");
this.File = new Janus.Windows.UI.CommandBars.UICommand("File");
this.Open1 = new Janus.Windows.UI.CommandBars.UICommand("Open");
this.Exit1 = new Janus.Windows.UI.CommandBars.UICommand("Exit");
this.Exit = new Janus.Windows.UI.CommandBars.UICommand("Exit");
this.Open = new Janus.Windows.UI.CommandBars.UICommand("Open");
this.Analysis = new
Janus.Windows.UI.CommandBars.UICommand("Analysis");
this.Command21 = new
Janus.Windows.UI.CommandBars.UICommand("Command2");
this.Command11 = new
Janus.Windows.UI.CommandBars.UICommand("Command1");
this.Command0 = new
Janus.Windows.UI.CommandBars.UICommand("Command0");
this.Command1 = new
Janus.Windows.UI.CommandBars.UICommand("Command1");
this.Command2 = new
Janus.Windows.UI.CommandBars.UICommand("Command2");
this.Command3 = new
Janus.Windows.UI.CommandBars.UICommand("Command3");
this.TopRebar1 = new Janus.Windows.UI.CommandBars.UIRebar();
this.BottomRebar1 = new Janus.Windows.UI.CommandBars.UIRebar();
this.LeftRebar1 = new Janus.Windows.UI.CommandBars.UIRebar();
this.RightRebar1 = new Janus.Windows.UI.CommandBars.UIRebar();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.radioButton1 = new System.Windows.Forms.RadioButton();
((System.ComponentModel.ISupportInitialize)(this.uiTab1)).BeginInit()
;
this.uiTab1.SuspendLayout();
this.tabPage1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gridex_log)).BeginIn
it();
this.Performance.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gridex_mem)).BeginIn
it();
this.panel1.SuspendLayout();
this.tabPage3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gridex_per)).BeginIn
it();
this.panel2.SuspendLayout();
this.tabPage4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gridex_exc)).BeginIn
it();
this.uiTabPage1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gridex_sql_exception
)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.uiCommandManager1)).
BeginInit();
((System.ComponentModel.ISupportInitialize)(this.uiCommandManager1.Ed
itContextMenu)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.uiCommandBar1)).Begi
nInit();
((System.ComponentModel.ISupportInitialize)(this.TopRebar1)).BeginIni
t();
this.TopRebar1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.BottomRebar1)).Begin
Init();
((System.ComponentModel.ISupportInitialize)(this.LeftRebar1)).BeginIn
it();
((System.ComponentModel.ISupportInitialize)(this.RightRebar1)).BeginI
nit();
this.SuspendLayout();
//
// uiTab1
//
this.uiTab1.Controls.Add(this.tabPage1);
this.uiTab1.Controls.Add(this.Performance);
this.uiTab1.Controls.Add(this.tabPage3);
this.uiTab1.Controls.Add(this.tabPage4);
this.uiTab1.Controls.Add(this.uiTabPage1);
this.uiTab1.Dock = System.Windows.Forms.DockStyle.Fill;
this.uiTab1.FirstTabOffset = 5;
this.uiTab1.Location = new System.Drawing.Point(0, 24);
this.uiTab1.Name = "uiTab1";
this.uiTab1.SelectedIndex = 0;
this.uiTab1.Size = new System.Drawing.Size(640, 464);
this.uiTab1.TabIndex = 0;
this.uiTab1.TabPages.AddRange(new Janus.Windows.UI.Tab.UITabPage[] {
this.tabPage1,
this.Performance,
this.tabPage3,
this.tabPage4,
this.uiTabPage1});
//
// tabPage1
//
this.tabPage1.Controls.Add(this.gridex_log);
this.tabPage1.Controls.Add(this.statusBar1);
this.tabPage1.Location = new System.Drawing.Point(1, 21);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Size = new System.Drawing.Size(636, 440);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Log";
//
// gridex_log
//
this.gridex_log.AllowEdit =
Janus.Windows.GridEX.InheritableBoolean.False;
this.gridex_log.ColumnAutoResize = true;
this.gridex_log.Dock = System.Windows.Forms.DockStyle.Fill;
this.gridex_log.EditorsControlStyle.ButtonAppearance =
Janus.Windows.GridEX.ButtonAppearance.Regular;
this.gridex_log.Font = new System.Drawing.Font("Microsoft Sans
Serif", 8.25F, System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, ((System.Byte)(177)));
this.gridex_log.Location = new System.Drawing.Point(0, 0);
this.gridex_log.Name = "gridex_log";
this.gridex_log.RecordNavigator = true;
this.gridex_log.Size = new System.Drawing.Size(636, 418);
this.gridex_log.TabIndex = 1;
//
// statusBar1
//
this.statusBar1.Location = new System.Drawing.Point(0, 418);
this.statusBar1.Name = "statusBar1";
this.statusBar1.Size = new System.Drawing.Size(636, 22);
this.statusBar1.TabIndex = 0;
//
// Performance
//
this.Performance.Controls.Add(this.gridex_mem);
this.Performance.Controls.Add(this.statusBar2);
this.Performance.Controls.Add(this.splitter2);
this.Performance.Controls.Add(this.panel1);
this.Performance.Location = new System.Drawing.Point(1, 21);
this.Performance.Name = "Performance";
this.Performance.Size = new System.Drawing.Size(636, 440);
this.Performance.TabIndex = 1;
this.Performance.Text = "Memory";
//
// gridex_mem
//
this.gridex_mem.AllowEdit =
Janus.Windows.GridEX.InheritableBoolean.False;
this.gridex_mem.ColumnAutoResize = true;
this.gridex_mem.Dock = System.Windows.Forms.DockStyle.Fill;
this.gridex_mem.EditorsControlStyle.ButtonAppearance =
Janus.Windows.GridEX.ButtonAppearance.Regular;
this.gridex_mem.Font = new System.Drawing.Font("Microsoft Sans
Serif", 8.25F, System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, ((System.Byte)(177)));
this.gridex_mem.Location = new System.Drawing.Point(0, 251);
this.gridex_mem.Name = "gridex_mem";
this.gridex_mem.RecordNavigator = true;
this.gridex_mem.Size = new System.Drawing.Size(636, 167);
this.gridex_mem.TabIndex = 5;
//
// statusBar2
//
this.statusBar2.Location = new System.Drawing.Point(0, 418);
this.statusBar2.Name = "statusBar2";
this.statusBar2.Size = new System.Drawing.Size(636, 22);
this.statusBar2.TabIndex = 4;
//
// splitter2
//
this.splitter2.Dock = System.Windows.Forms.DockStyle.Top;
this.splitter2.Location = new System.Drawing.Point(0, 248);
this.splitter2.Name = "splitter2";
this.splitter2.Size = new System.Drawing.Size(636, 3);
this.splitter2.TabIndex = 3;
this.splitter2.TabStop = false;
//
// panel1
//
this.panel1.Controls.Add(this.tChart1);
this.panel1.Controls.Add(this.hScrollBar1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(636, 248);
this.panel1.TabIndex = 0;
//
// tChart1
//
//
// tChart1.Aspect
//
this.tChart1.Aspect.View3D = false;
//
// tChart1.Axes
//
//
// tChart1.Axes.Left
//
//
// tChart1.Axes.Left.Title
//
this.tChart1.Axes.Left.Title.Caption = "m/byte";
this.tChart1.Axes.Left.Title.Lines = new string[] {
"m/byte"};
this.tChart1.Dock = System.Windows.Forms.DockStyle.Fill;
//
// tChart1.Header
//
this.tChart1.Header.Lines = new string[] {
"Memory"};
//
// tChart1.Legend
//
this.tChart1.Legend.Visible = false;
this.tChart1.Location = new System.Drawing.Point(0, 0);
this.tChart1.Name = "tChart1";
this.tChart1.Series.Add(this.line4);
this.tChart1.Size = new System.Drawing.Size(636, 232);
this.tChart1.TabIndex = 2;
//
// line4
//
//
// line4.Brush
//
this.line4.Brush.Color = System.Drawing.Color.Red;
this.line4.Title = "line4";
//
// hScrollBar1
//
this.hScrollBar1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.hScrollBar1.Location = new System.Drawing.Point(0, 232);
this.hScrollBar1.Name = "hScrollBar1";
this.hScrollBar1.Size = new System.Drawing.Size(636, 16);
this.hScrollBar1.TabIndex = 1;
this.hScrollBar1.Scroll += new
System.Windows.Forms.ScrollEventHandler(this.hScrollBar1_Scroll);
//
// tabPage3
//
this.tabPage3.Controls.Add(this.gridex_per);
this.tabPage3.Controls.Add(this.statusBar3);
this.tabPage3.Controls.Add(this.splitter1);
this.tabPage3.Controls.Add(this.panel2);
this.tabPage3.Location = new System.Drawing.Point(1, 21);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(636, 440);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "Performance";
//
// gridex_per
//
this.gridex_per.AllowEdit =
Janus.Windows.GridEX.InheritableBoolean.False;
this.gridex_per.ColumnAutoResize = true;
this.gridex_per.Dock = System.Windows.Forms.DockStyle.Fill;
this.gridex_per.EditorsControlStyle.ButtonAppearance =
Janus.Windows.GridEX.ButtonAppearance.Regular;
this.gridex_per.Font = new System.Drawing.Font("Microsoft Sans
Serif", 8.25F, System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, ((System.Byte)(177)));
this.gridex_per.Location = new System.Drawing.Point(0, 243);
this.gridex_per.Name = "gridex_per";
this.gridex_per.RecordNavigator = true;
this.gridex_per.Size = new System.Drawing.Size(636, 175);
this.gridex_per.TabIndex = 6;
//
// statusBar3
//
this.statusBar3.Location = new System.Drawing.Point(0, 418);
this.statusBar3.Name = "statusBar3";
this.statusBar3.Size = new System.Drawing.Size(636, 22);
this.statusBar3.TabIndex = 5;
//
// splitter1
//
this.splitter1.Dock = System.Windows.Forms.DockStyle.Top;
this.splitter1.Location = new System.Drawing.Point(0, 240);
this.splitter1.Name = "splitter1";
this.splitter1.Size = new System.Drawing.Size(636, 3);
this.splitter1.TabIndex = 4;
this.splitter1.TabStop = false;
//
// panel2
//
this.panel2.Controls.Add(this.tChart2);
this.panel2.Controls.Add(this.hScrollBar2);
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
this.panel2.Location = new System.Drawing.Point(0, 0);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(636, 240);
this.panel2.TabIndex = 0;
//
// tChart2
//
//
// tChart2.Aspect
//
this.tChart2.Aspect.View3D = false;
//
// tChart2.Axes
//
//
// tChart2.Axes.Left
//
//
// tChart2.Axes.Left.Title
//
this.tChart2.Axes.Left.Title.Caption = "m/sec";
this.tChart2.Axes.Left.Title.Lines = new string[] {
"m/sec"};
this.tChart2.Cursor = System.Windows.Forms.Cursors.Default;
this.tChart2.Dock = System.Windows.Forms.DockStyle.Fill;
//
// tChart2.Header
//
this.tChart2.Header.Lines = new string[] {
"Performance"};
//
// tChart2.Legend
//
this.tChart2.Legend.Visible = false;
this.tChart2.Location = new System.Drawing.Point(0, 0);
this.tChart2.Name = "tChart2";
this.tChart2.Series.Add(this.line3);
this.tChart2.Size = new System.Drawing.Size(636, 223);
this.tChart2.TabIndex = 2;
//
// line3
//
//
// line3.Brush
//
this.line3.Brush.Color = System.Drawing.Color.Red;
this.line3.Title = "line3";
//
// hScrollBar2
//
this.hScrollBar2.Dock = System.Windows.Forms.DockStyle.Bottom;
this.hScrollBar2.Location = new System.Drawing.Point(0, 223);
this.hScrollBar2.Name = "hScrollBar2";
this.hScrollBar2.Size = new System.Drawing.Size(636, 17);
this.hScrollBar2.TabIndex = 3;
this.hScrollBar2.Scroll += new
System.Windows.Forms.ScrollEventHandler(this.hScrollBar2_Scroll);
//
// tabPage4
//
this.tabPage4.Controls.Add(this.gridex_exc);
this.tabPage4.Controls.Add(this.statusBar4);
this.tabPage4.Location = new System.Drawing.Point(1, 21);
this.tabPage4.Name = "tabPage4";
this.tabPage4.Size = new System.Drawing.Size(636, 440);
this.tabPage4.TabIndex = 3;
this.tabPage4.Text = "Exception";
//
// gridex_exc
//
this.gridex_exc.AllowEdit =
Janus.Windows.GridEX.InheritableBoolean.False;
this.gridex_exc.ColumnAutoResize = true;
this.gridex_exc.Dock = System.Windows.Forms.DockStyle.Fill;
this.gridex_exc.EditorsControlStyle.ButtonAppearance =
Janus.Windows.GridEX.ButtonAppearance.Regular;
this.gridex_exc.Font = new System.Drawing.Font("Microsoft Sans
Serif", 8.25F, System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, ((System.Byte)(177)));
this.gridex_exc.Location = new System.Drawing.Point(0, 0);
this.gridex_exc.Name = "gridex_exc";
this.gridex_exc.RecordNavigator = true;
this.gridex_exc.Size = new System.Drawing.Size(636, 416);
this.gridex_exc.TabIndex = 1;
//
// statusBar4
//
this.statusBar4.Location = new System.Drawing.Point(0, 416);
this.statusBar4.Name = "statusBar4";
this.statusBar4.Size = new System.Drawing.Size(636, 24);
this.statusBar4.TabIndex = 0;
//
// uiTabPage1
//
this.uiTabPage1.Controls.Add(this.gridex_sql_exception);
this.uiTabPage1.Controls.Add(this.statusBar6);
this.uiTabPage1.Location = new System.Drawing.Point(1, 21);
this.uiTabPage1.Name = "uiTabPage1";
this.uiTabPage1.Size = new System.Drawing.Size(636, 440);
this.uiTabPage1.TabIndex = 4;
this.uiTabPage1.Text = "SQLException";
//
// gridex_sql_exception
//
this.gridex_sql_exception.AllowEdit =
Janus.Windows.GridEX.InheritableBoolean.False;
this.gridex_sql_exception.ColumnAutoResize = true;
this.gridex_sql_exception.Dock = System.Windows.Forms.DockStyle.Fill;
this.gridex_sql_exception.EditorsControlStyle.ButtonAppearance =
Janus.Windows.GridEX.ButtonAppearance.Regular;
this.gridex_sql_exception.Font = new System.Drawing.Font("Microsoft
Sans Serif", 8.25F, System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, ((System.Byte)(177)));
this.gridex_sql_exception.Location = new System.Drawing.Point(0, 0);
this.gridex_sql_exception.Name = "gridex_sql_exception";
this.gridex_sql_exception.RecordNavigator = true;
this.gridex_sql_exception.Size = new System.Drawing.Size(636, 418);
this.gridex_sql_exception.TabIndex = 4;
//
// statusBar6
//
this.statusBar6.Location = new System.Drawing.Point(0, 418);
this.statusBar6.Name = "statusBar6";
this.statusBar6.Size = new System.Drawing.Size(636, 22);
this.statusBar6.TabIndex = 3;
//
// comboBox
//
this.comboBox.Location = new System.Drawing.Point(0, 0);
this.comboBox.Name = "comboBox";
this.comboBox.Size = new System.Drawing.Size(176, 20);
this.comboBox.TabIndex = 0;
this.comboBox.ReadOnly=true;
//
// comboBox2
//
this.comboBox2.Location = new System.Drawing.Point(0, 0);
this.comboBox2.Name = "comboBox2";
this.comboBox2.Size = new System.Drawing.Size(176, 20);
this.comboBox2.TabIndex = 0;
//
// notifyIcon1
//
this.notifyIcon1.Text = "notifyIcon1";
this.notifyIcon1.Visible = true;
//
// uiCommandManager1
//
this.uiCommandManager1.BottomRebar = this.BottomRebar1;
this.uiCommandManager1.CommandBars.AddRange(new
Janus.Windows.UI.CommandBars.UICommandBar[] {
this.uiCommandBar1});
this.uiCommandManager1.Commands.AddRange(new
Janus.Windows.UI.CommandBars.UICommand[] {
this.File,
this.Exit,
this.Open,
this.Analysis,
this.Command0,
this.Command1,
this.Command2,
this.Command3});
this.uiCommandManager1.ContainerControl = this;
this.uiCommandManager1.Id = new
System.Guid("3de34ecd-b03a-4451-a0d7-1322200d27d4");
this.uiCommandManager1.LeftRebar = this.LeftRebar1;
this.uiCommandManager1.RightRebar = this.RightRebar1;
this.uiCommandManager1.TopRebar = this.TopRebar1;
//
// uiCommandBar1
//
this.uiCommandBar1.CommandBarType =
Janus.Windows.UI.CommandBars.CommandBarType.Menu;
this.uiCommandBar1.CommandManager = this.uiCommandManager1;
this.uiCommandBar1.Commands.AddRange(new
Janus.Windows.UI.CommandBars.UICommand[] {
this.File1,
this.Analysis1,
this.Command31});
this.uiCommandBar1.Key = "CommandBar1";
this.uiCommandBar1.Location = new System.Drawing.Point(0, 0);
this.uiCommandBar1.Name = "uiCommandBar1";
this.uiCommandBar1.RowIndex = 0;
this.uiCommandBar1.Size = new System.Drawing.Size(640, 24);
this.uiCommandBar1.TabIndex = 0;
this.uiCommandBar1.Text = "CommandBar1";
this.uiCommandBar1.CommandClick += new
Janus.Windows.UI.CommandBars.CommandEventHandler(this.uiCommandBar1_Comm
andClick);
//
// File1
//
this.File1.Key = "File";
this.File1.Name = "File1";
//
// Analysis1
//
this.Analysis1.Key = "Analysis";
this.Analysis1.Name = "Analysis1";
//
// Command31
//
this.Command31.Key = "Command3";
this.Command31.Name = "Command31";
//
// File
//
this.File.Commands.AddRange(new
Janus.Windows.UI.CommandBars.UICommand[] {
this.Open1,
this.Exit1});
this.File.Key = "File";
this.File.Name = "File";
this.File.Text = "File";
//
// Open1
//
this.Open1.Key = "Open";
this.Open1.Name = "Open1";
//
// Exit1
//
this.Exit1.Key = "Exit";
this.Exit1.Name = "Exit1";
//
// Exit
//
this.Exit.Checked = Janus.Windows.UI.InheritableBoolean.False;
this.Exit.IsEditableControl =
Janus.Windows.UI.InheritableBoolean.True;
this.Exit.Key = "Exit";
this.Exit.Name = "Exit";
this.Exit.Text = "Exit";
//
// Open
//
this.Open.Key = "Open";
this.Open.Name = "Open";
this.Open.Text = "Open";
//
// Analysis
//
this.Analysis.Commands.AddRange(new
Janus.Windows.UI.CommandBars.UICommand[] {
this.Command21,
this.Command11});
this.Analysis.ControlWidth = 100;
this.Analysis.Enabled = Janus.Windows.UI.InheritableBoolean.False;
this.Analysis.Key = "Analysis";
this.Analysis.Name = "Analysis";
this.Analysis.Text = "Analysis";
//
// Command21
//
this.Command21.Key = "Command2";
this.Command21.Name = "Command21";
//
// Command11
//
this.Command11.Key = "Command1";
this.Command11.Name = "Command11";
//
// Command0
//
this.Command0.CommandType =
Janus.Windows.UI.CommandBars.CommandType.ControlContainer;
this.Command0.IsEditableControl =
Janus.Windows.UI.InheritableBoolean.True;
this.Command0.Key = "Command0";
this.Command0.Name = "Command0";
this.Command0.Text = "Add Class";
//
// Command1
//
this.Command1.CommandType =
Janus.Windows.UI.CommandBars.CommandType.ComboBoxCommand;
this.Command1.ControlWidth = 200;
this.Command1.IsEditableControl =
Janus.Windows.UI.InheritableBoolean.True;
this.Command1.Key = "Command1";
this.Command1.Name = "Command1";
this.Command1.Text = "Service";
//
// Command2
//
this.Command2.CommandType =
Janus.Windows.UI.CommandBars.CommandType.ComboBoxCommand;
this.Command2.ControlWidth = 300;
this.Command2.IsEditableControl =
Janus.Windows.UI.InheritableBoolean.True;
this.Command2.Key = "Command2";
this.Command2.Name = "Command2";
this.Command2.Text = "Operation";
//
// Command3
//
this.Command3.Key = "Command3";
this.Command3.Name = "Command3";
this.Command3.Text = "Clear Structures";
//
// TopRebar1
//
this.TopRebar1.CommandBars.AddRange(new
Janus.Windows.UI.CommandBars.UICommandBar[] {
this.uiCommandBar1});
this.TopRebar1.CommandManager = this.uiCommandManager1;
this.TopRebar1.Controls.Add(this.uiCommandBar1);
this.TopRebar1.Dock = System.Windows.Forms.DockStyle.Top;
this.TopRebar1.Location = new System.Drawing.Point(0, 0);
this.TopRebar1.Name = "TopRebar1";
this.TopRebar1.Size = new System.Drawing.Size(640, 24);
this.TopRebar1.TabIndex = 1;
//
// BottomRebar1
//
this.BottomRebar1.CommandManager = this.uiCommandManager1;
this.BottomRebar1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.BottomRebar1.Location = new System.Drawing.Point(0, 0);
this.BottomRebar1.Name = "BottomRebar1";
this.BottomRebar1.TabIndex = 0;
//
// LeftRebar1
//
this.LeftRebar1.CommandManager = this.uiCommandManager1;
this.LeftRebar1.Dock = System.Windows.Forms.DockStyle.Left;
this.LeftRebar1.Location = new System.Drawing.Point(0, 0);
this.LeftRebar1.Name = "LeftRebar1";
this.LeftRebar1.TabIndex = 0;
//
// RightRebar1
//
this.RightRebar1.CommandManager = this.uiCommandManager1;
this.RightRebar1.Dock = System.Windows.Forms.DockStyle.Right;
this.RightRebar1.Location = new System.Drawing.Point(0, 0);
this.RightRebar1.Name = "RightRebar1";
this.RightRebar1.TabIndex = 0;
//
// groupBox2
//
this.groupBox2.Font = new System.Drawing.Font("Microsoft Sans Serif",
8.25F, System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, ((System.Byte)(177)));
this.groupBox2.Location = new System.Drawing.Point(137, 4);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(300, 300);
this.groupBox2.TabIndex = 3;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "groupBox2";
//
// radioButton1
//
this.radioButton1.Location = new System.Drawing.Point(41, 2);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(100, 24);
this.radioButton1.TabIndex = 2;
this.radioButton1.Text = "radioButton1";
//
// LogAnalysis
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(640, 488);
this.Controls.Add(this.uiTab1);
this.Controls.Add(this.TopRebar1);
this.Name = "LogAnalysis";
this.Text = "Log Analysis";
this.Load += new System.EventHandler(this.LogAnalysis_Load);
((System.ComponentModel.ISupportInitialize)(this.uiTab1)).EndInit();
this.uiTab1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.gridex_log)).EndInit
();
this.Performance.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.gridex_mem)).EndInit
();
this.panel1.ResumeLayout(false);
this.tabPage3.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.gridex_per)).EndInit
();
this.panel2.ResumeLayout(false);
this.tabPage4.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.gridex_exc)).EndInit
();
this.uiTabPage1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.gridex_sql_exception
)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.uiCommandManager1.Ed
itContextMenu)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.uiCommandManager1)).
EndInit();
((System.ComponentModel.ISupportInitialize)(this.uiCommandBar1)).EndI
nit();
((System.ComponentModel.ISupportInitialize)(this.TopRebar1)).EndInit(
);
this.TopRebar1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.BottomRebar1)).EndIn
it();
((System.ComponentModel.ISupportInitialize)(this.LeftRebar1)).EndInit
();
((System.ComponentModel.ISupportInitialize)(this.RightRebar1)).EndIni
t();
this.ResumeLayout(false);

}
#endregion
[STAThread]

private void LogAnalysis_Load(object sender, System.EventArgs e)
{
this.gridex_log.LinkFormatStyle.Reset();
Steema.TeeChart.Axis bottomAxis = tChart1.Axes.Bottom;
bottomAxis.Increment = 1;
Steema.TeeChart.Axis rightAxis=tChart1.Axes.Right;
rightAxis.Increment=1;
Steema.TeeChart.Axis bottomAxis2=tChart2.Axes.Bottom;
bottomAxis2.Increment=1;
tChart1.Axes.Bottom.SetMinMax(0, 20);
tChart1.Axes.Left.SetMinMax(0,1000);
tChart2.Axes.Bottom.SetMinMax(0,20);
this.msbx=new MsgBox();
this.uiTab1.VisualStyle =
Janus.Windows.UI.Tab.TabVisualStyle.Office2003;
this.gridex_log.VisualStyle=Janus.Windows.GridEX.VisualStyle.Office20
03;
this.gridex_exc.VisualStyle=Janus.Windows.GridEX.VisualStyle.Office20
03;
this.gridex_mem.VisualStyle=Janus.Windows.GridEX.VisualStyle.Office20
03;
this.gridex_per.VisualStyle=Janus.Windows.GridEX.VisualStyle.Office20
03;
this.gridex_sql_exception.VisualStyle=Janus.Windows.GridEX.VisualStyl
e.Office2003;



this.gridex_exc.ColumnButtonClick+=new
Janus.Windows.GridEX.ColumnActionEventHandler( gridex_ColumnButtonClic
k);

this.gridex_sql_exception.ColumnButtonClick+=new
Janus.Windows.GridEX.ColumnActionEventHandler(gridex_sql_exception_Colum
nButtonClick);


this.tChart1.ClickSeries+=new
Steema.TeeChart.TChart.SeriesEventHandler(tChart1_Click);
this.tChart2.ClickSeries+=new
Steema.TeeChart.TChart.SeriesEventHandler(tChart2_ClickSeries);

this.uiTab1.SelectedTabChanged+=new
Janus.Windows.UI.Tab.TabEventHandler(uiTab1_SelectedTabChanged);

this.command_name=new ArrayList();
this.class_name=new ArrayList();



}

private void menuItem2_Click(object sender, System.EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.ShowDialog();
this.file_name=ofd.FileName;
if(file_name.Length==0)
MessageBox.Show("Please choose a file");
else
{

Reader re2=new Reader(this.file_name);
re=re2;

Chart_Source();
Grid_Source();
statusBar1.Text=file_name;
statusBar2.Text=file_name;
statusBar3.Text=file_name;
statusBar4.Text=file_name;
statusBar6.Text=file_name;
}
}


public void Grid_Source()
{

if(this.menu_flag==false)
{
this.gridex_per.SetDataBinding(re.PL,"");
}
else
{
this.gridex_per.SetDataBinding(re.ALP,"");

}

this.gridex_per.RetrieveStructure();





if(gridex_per.RootTable.Columns.Count!=0)
{
this.gridex_per.RootTable.Columns["ID"].Position=0;
this.gridex_per.RootTable.Columns["Class_Name"].Position=1;
this.gridex_per.RootTable.Columns["Command_Name"].Position=2;
this.gridex_per.RootTable.Columns["Date"].Position=3;
this.gridex_per.RootTable.Columns["Time"].Position=4;
}


if(this.menu_flag==false)
this.gridex_mem.SetDataBinding(re.ML,"");
else
this.gridex_mem.SetDataBinding(re.ALM,"");
this.gridex_mem.RetrieveStructure();

if(gridex_mem.RootTable.Columns.Count!=0)
{
this.gridex_mem.RootTable.Columns["ID"].Position=0;
this.gridex_mem.RootTable.Columns["Class_Name"].Position=1;
this.gridex_mem.RootTable.Columns["Command_Name"].Position=2;
this.gridex_mem.RootTable.Columns["Date"].Position=3;
this.gridex_mem.RootTable.Columns["Size"].Position=4;
}





this.gridex_exc.SetDataBinding(re.EL,"");
this.gridex_exc.RetrieveStructure();

this.gridex_sql_exception.SetDataBinding(re.ESL,"");
this.gridex_sql_exception.RetrieveStructure();



gridex_exc.RootTable.PreviewRow=true;
gridex_exc.RootTable.PreviewRowLines = 3;

this.gridex_exc.RootTable.Columns.Add();
this.gridex_sql_exception.RootTable.Columns.Add();

if(this.gridex_sql_exception.RootTable.Columns.Count>1)
{
this.gridex_sql_exception.RootTable.Columns[3].Width=89;
this.gridex_sql_exception.RootTable.Columns[3].ButtonStyle=Janus.Win
dows.GridEX.ButtonStyle.ButtonCell;
this.gridex_sql_exception.RootTable.Columns[3].ButtonDisplayMode=Jan
us.Windows.GridEX.CellButtonDisplayMode.Always;
this.gridex_sql_exception.RootTable.Columns[3].Caption="Stuck
Trace";
this.gridex_sql_exception.RootTable.Columns[3].TextAlignment=Janus.W
indows.GridEX.TextAlignment.Center;
}

if(this.gridex_exc.RootTable.Columns.Count>1)
{
this.gridex_exc.RootTable.Columns[3].Width=89;
this.gridex_exc.RootTable.Columns[3].ButtonStyle=Janus.Windows.GridE
X.ButtonStyle.ButtonCell;
this.gridex_exc.RootTable.Columns[3].ButtonDisplayMode=Janus.Windows
.GridEX.CellButtonDisplayMode.Always;
this.gridex_exc.RootTable.Columns[3].Caption="Stuck Trace";
this.gridex_exc.RootTable.Columns[3].TextAlignment=Janus.Windows.Gri
dEX.TextAlignment.Center;

}

this.gridex_log.SetDataBinding(re.LL,"");
this.gridex_log.RetrieveStructure();

}

public void Chart_Source()
{

int[] pLineVals = new int[re.PL.Count];
int[] mLineVals=new int[re.ML.Count];
int i=0;


this.line3.Cursor=Cursors.Hand;
this.line4.Cursor=Cursors.Hand;

tChart1.Series[0].Clear();
tChart2.Series[0].Clear();


if(this.menu_flag==false)
{
foreach(Performance p in re.PL)
{
this.line3.Add(i++,p.Time);
}
i=0;
foreach(Memory m in re.ML)
{
this.line4.Add(i++,m.Size);
}

}
else
{

foreach(Performance p in re.ALP)
{
this.line3.Add(i++,p.Time);

}
System.Console.WriteLine(line3.Count);
i=0;
foreach(Memory m in re.ALM)
{
this.line4.Add(i++,m.Size);
}

}



tChart1.Axes.Left.SetMinMax(0,line4.YValues.Maximum+100);
tChart2.Axes.Left.SetMinMax(0,line3.YValues.Maximum+100);

tChart1.Series[0].Delete(0,tChart1.Series[0].Count);
tChart2.Series[0].Delete(0,tChart1.Series[0].Count);


}

private void tChart1_Click(object sender,
Steema.TeeChart.Styles.Series line3, int num ,
System.Windows.Forms.MouseEventArgs e)
{
this.toolTip1.SetToolTip(this.tChart1,line3.YValues[num].ToString());
this.gridex_mem.MoveToRowIndex(num);
this.gridex_mem.Focus();
}

private void tChart2_ClickSeries(object
sender,Steema.TeeChart.Styles.Series line4,int
num,System.Windows.Forms.MouseEventArgs e)
{
this.toolTip2.SetToolTip(this.tChart2,line4.YValues[num].ToString());
this.gridex_per.MoveToRowIndex(num);
this.gridex_per.Focus();
}

private void gridex_ColumnButtonClick(object sender,
Janus.Windows.GridEX.ColumnActionEventArgs e)
{
this.msbx.ShowDialog(re.EL.Get_Val(this.gridex_exc.Row).Get_StuckInfo
());
}


private void hScrollBar1_Scroll_1(object sender,
System.Windows.Forms.ScrollEventArgs e)
{
tChart1.Axes.Bottom.SetMinMax(0+hScrollBar1.Value,20+hScrollBar1.Valu
e);
hScrollBar1.Maximum=Convert.ToInt16(tChart1.Series[0].XValues.Maximum
);

}

private void menuItem3_Click_1(object sender, System.EventArgs e)
{
MessageBox.Show(this.file_name);
}

private void hScrollBar2_Scroll(object sender,
System.Windows.Forms.ScrollEventArgs e)
{
tChart2.Axes.Bottom.SetMinMax(0+hScrollBar2.Value,20+hScrollBar2.Valu
e);
hScrollBar2.Maximum=Convert.ToInt32(tChart2.Series[0].XValues.Maximum
);

}

private void hScrollBar1_Scroll(object sender,
System.Windows.Forms.ScrollEventArgs e)
{
tChart1.Axes.Bottom.SetMinMax(0+hScrollBar1.Value,20+hScrollBar1.Valu
e);
hScrollBar1.Maximum=Convert.ToInt16(tChart1.Series[0].XValues.Maximum
);
}

public static void Main()
{

Application.Run(new LogAnalysis());


}

private void menuItem4_Click(object sender, System.EventArgs e)
{
this.Close();
}

private void Fill_Menu()
{

foreach (Performance p in re.PL)
{
if (!(command_name.Contains(p.Command_Name)))
{
this.command_name.Add(p.Command_Name);
}
if(!(class_name.Contains(p.Class_Name)))
{
this.class_name.Add(p.Class_Name);
}
}

this.comboBox =
this.uiCommandManager1.Commands["Command1"].GetUIComboBox();
this.comboBox2=this.uiCommandManager1.Commands["Command2"].GetUICombo
Box();
comboBox.Items.Add("All");

for(int i=0;i<command_name.Count;i++)
{
comboBox.Items.Add(command_name);
}


comboBox2.Items.Add("All");
for(int i=0;i<class_name.Count;i++)
{
comboBox2.Items.Add(class_name);
}


this.comboBox.SelectedIndexChanged+=new
EventHandler(comboBox_SelectedIndexChanged);
this.comboBox2.SelectedIndexChanged+=new
EventHandler(comboBox2_SelectedIndexChanged);

comboBox.SelectedIndex = 0;
comboBox2.SelectedIndex = 0;

}


private void comboBox_SelectedItemChanged(object sender, EventArgs e)
{
string command_name,class_name;
command_name=this.comboBox.SelectedValue.ToString();
class_name=this.comboBox2.SelectedValue.ToString();
re.Menu_Coll(command_name,class_name);
this.menu_flag=true;
this.Chart_Source();
this.Grid_Source();

}

private void comboBox_SelectedIndexChanged(object sender, EventArgs e)
{
this.counter++;
if(counter>1)
{
string command_name,class_name;
try
{

command_name=this.comboBox.SelectedValue.ToString();
class_name=this.comboBox2.SelectedValue.ToString();
re.Menu_Coll(command_name,class_name);
this.menu_flag=true;
this.Chart_Source();
this.Grid_Source();
}
catch(Exception ex)
{
this.msbx.ShowDialog(ex.ToString());
MessageBox.Show("Please input class name");
}

//re.ALP.Clear();
this.counter--;
}
}


private void uiCommandBar1_CommandClick(object sender,
Janus.Windows.UI.CommandBars.CommandEventArgs e)
{
switch(e.Command.Key)
{
case "Open":
OpenFileDialog ofd = new OpenFileDialog();
ofd.ShowDialog();
this.file_name=ofd.FileName;
if(file_name.Length==0)
MessageBox.Show("Please choose a file");
else
{

Reader re2=new Reader(this.file_name);
re=re2;
this.Fill_Menu();
Chart_Source();
Grid_Source();
statusBar1.Text=file_name;
statusBar2.Text=file_name;
statusBar3.Text=file_name;
statusBar4.Text=file_name;
statusBar6.Text=file_name;

}

break;
case "Exit":
this.Close();
break;
case "Command3":
tChart1.Series[0].Clear();
tChart2.Series[0].Clear();

this.gridex_per.ClearStructure();
this.gridex_mem.ClearStructure();
break;
}
}



private void uiTab1_SelectedTabChanged(object sender,
Janus.Windows.UI.Tab.TabEventArgs e)
{
if((e.Page.Index==1) || (e.Page.Index==2))
this.Analysis.Enabled=Janus.Windows.UI.InheritableBoolean.True;
else
this.Analysis.Enabled=Janus.Windows.UI.InheritableBoolean.False;
}


private void gridex_sql_exception_ColumnButtonClick(object sender,
Janus.Windows.GridEX.ColumnActionEventArgs e)
{
this.msbx.ShowDialog(re.ESL.Get_Val(this.gridex_sql_exception.Row).Ge
t_StuckInfo());
}

private void comboBox2_SelectedIndexChanged(object sender, EventArgs
e)
{
this.counter++;
if(this.counter>1)
{
string command_name,class_name;
try
{

command_name=this.comboBox.SelectedValue.ToString();
class_name=this.comboBox2.SelectedValue.ToString();
re.Menu_Coll(command_name,class_name);
this.menu_flag=true;

this.Chart_Source();
this.Grid_Source();
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
MessageBox.Show("Please input class name");
}

//re.ALP.Clear();
this.counter--; //In order to check if the results are taken form
the both comboBoxes.
}

}
}



}
 
I found something that is probably causing confusion, but I don't know
if I would call it a "problem", because I don't know exactly what it
does.

In FillMenu, there are two lines that say:

this.comboBox =
this.uiCommandManager1.Commands["Command1"].GetUIComboBox();

this.comboBox2=this.uiCommandManager1.Commands["Command2"].G­etUICombo

Box();

what is happening here is that you are _replacing_ the combo boxes on
your form with (possibly) _new_ combo boxes that are returned from this
uiCommandManager object (whatever that is). This is going to cause some
interesting effects.

First of all, nowhere do you set this.comboBox.Parent, or do a

this.Controls.Add(this.comboBox)

again. To understand why you might have to do this, or what all of this
means, think about the following.

In the code that Visual Studio put into your program, this.comboBox and
this.comboBox2 are created:

this.comboBox = new System.Windows.Forms.ComboBox();
this.comboBox2 = new System.Windows.Forms.ComboBox();

then the designer sets various fields to "set up" the combo boxes and
make them look the way you want them to. Then, at the end, it adds them
to the form:

this.Controls.Add(this.comboBox);
this.Controls.Add(this.comboBox2);

these last two lines are what make the combo boxes actually appear on
the form. Otherwise, they're just Windows controls floating in space,
with no place to display themselves.

Now, in Fill_Menu, you say:

this.comboBox =
this.uiCommandManager1.Commands["Command1"].GetUIComboBox();
this.comboBox2 =
this.uiCommandManager1.Commands["Command2"].GetUIComboBox();

What this does is _replaces_ the combo box controls that are in
this.comboBox and this.comboBox2 with _new_ combo box controls returned
by this uiCommandManager1. However, the _original_ combo boxes that
comboBox and comboBox2 _used to_ point to are still displayed on the
form, and these new combo boxes are... well, who knows where, depending
upon how this uiCommandManager1 manages things.

So now if you subscribe to the events coming from the _new_ combo
boxes:

this.comboBox.SelectedIndexChanged+=new
EventHandler(comboBox_SelectedIndexChanged);
this.comboBox2.SelectedIndexChanged+=new
EventHandler(comboBox2_SelectedIndexChanged);

these aren't the same combo boxes as the ones you see on your form,
because up above you changed what this.comboBox and this.comboBox2
point to. You're subscribing to selected index changed events from the
_new_ combo boxes, not the ones on your form.

That is probably why the event handlers "aren't working". They're
waiting for events from the wrong combo boxes.

Unfortunately, I can't tell you how to fix this, because I don't
understand what the uiCommandManager thing is and what it's supposed to
do, so I don't know whether the correct solution is remove the old
combo boxes and parent the new ones to the form, or to not change the
combo box variables in the first place.
 
Thank you very much for your help!
About the declaration of the comboBox: I declare it once at the
beggining of my program and than doing the this.combo=... .How can I do
it otherwise??
I need it to be part of the UiManagerControl because it represents a
menu and the comboBoxes are part of the menu.
Thank you!
 
Thank you very much!
I had a problem you suspected (with the combo) and it helped.
Thanks again for your attention.
 
Back
Top