void ChangePage(object sender, EventArgs args) { ToolStripMenuItem tsmi = (sender as ToolStripMenuItem); page newpage = canvas.FindPage(tsmi.Text); if (newpage != null) { canvas.current_page = newpage; } }
public XperdexDefaultForm(string[] args) { bool want_title = false; bool want_page = false; String FirstPage = null; Banner.Show("Initializing...", true); //TopMost = true; InitializeComponent(); canvas = new Canvas(); canvas.Dock = DockStyle.Fill; Process me = Process.GetCurrentProcess(); this.WindowState = FormWindowState.Maximized; foreach (string arg in args) { if (want_page) { want_page = false; FirstPage = arg; continue; } else if (want_title) { want_title = false; Text = arg; continue; } else if (arg.CompareTo("normal") == 0) { this.FormBorderStyle = FormBorderStyle.Sizable; this.WindowState = System.Windows.Forms.FormWindowState.Normal; continue; } else if (arg.CompareTo("noicon") == 0) { ShowInTaskbar = false; continue; } else if (arg.CompareTo("topmost") == 0) { this.TopMost = true; continue; } else if (arg.CompareTo("page") == 0) { want_page = true; continue; } else if (arg.CompareTo("title") == 0) { want_title = true; continue; } core_common.ConfigName = arg; } this.LocationChanged += new EventHandler(Form1_LocationChanged); this.Visible = false; this.Controls.Add(canvas); // the top level form should load a configuration // there are NO pages yet... Banner.Show("Loading...", true); canvas.LoadConfig(); if (FirstPage != null) { canvas.current_page = canvas.FindPage(FirstPage); } //Banner.Show( "Loaded...", true ); this.Visible = true; Banner.End(); }
private void CanvasButtonUp(object sender, MouseEventArgs e) { //Log.log( " --- CLICK UP ----- " ); if (disable_changes) { return; } buttons.Location = e.Location; switch (e.Button) { case MouseButtons.Left: if (buttons.l) { buttons.want_click = false; if (buttons.clicked) { buttons.l = false; buttons.l_delta_up = true; buttons.clicked = false; Refresh(); foreach (IReflectorSecurity security in this.security_tags) { if (!security.Open()) { //foreach( IReflectorSecurity upto in local.security_modules ) { //if( upto == security ) // break; security.Close(); } return; } } foreach (IReflectorSecurity security in security_tags) { if (!security.Test()) { return; } } // if button success (failure will fail from macro, which will fail to here.) // consider multiple failure conditions, perhaps set a failure mode // so we can maybe unwind what has already been done? if (_click.OnClick()) { if (this.NextPage != null) { page page = canvas.FindPage(this.NextPage); page.Select(); } } foreach (IReflectorSecurity security in security_tags) { // if it closes... security.Close(); } } } break; case MouseButtons.Right: if (buttons.r) { buttons.r = false; buttons.r_delta_up = true; Refresh(); } break; case MouseButtons.Middle: buttons.m = false; break; } }