static void Main() { bool isNewApp; using (Mutex mutex = new Mutex(true, Application.ProductName, out isNewApp)) { if (isNewApp) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { FrmWelcome frmWelcome = new FrmWelcome(); DialogResult dr = frmWelcome.ShowDialog(); if (DialogResult.Cancel == dr) { return; } frmWelcome.Dispose(); } catch (Exception ex) { MessageBox.Show("发生错误在程序启动时"); Console.Out.WriteLine(ex.InnerException); throw ex; } } else { MessageBox.Show("一次只能运行一个程序"); } } }
private void FrmStep_Load(object sender, EventArgs e) { var welcome = new FrmWelcome(); welcome.TopLevel = false; welcome.FormBorderStyle = FormBorderStyle.None; this.pnlMain.Controls.Add(welcome); welcome.Visible = true; forms.Add(1, welcome); welcome.btnOpen.Click += BtnOpen_Click; this.btnCancel.Click += BtnCancel_Click; this.btnNext.Click += BtnNext_Click; this.btnPrev.Click += BtnPrev_Click; this.btnInstall.Click += BtnInstallClick; this.btnFinish.Click += BtnFinish_Click; OnStepChanged(); }
private void FrmStep_Load(object sender, EventArgs e) { var welcome = new FrmWelcome(); this.pnlMain.Controls.Add(SetFrom(welcome)); welcome.Visible = true; forms.Add(1, welcome); welcome.btnCreateNew.Click += BtnCreateNew_Click; welcome.btnCreatePatcher.Click += BtnCreatePatcher_Click; welcome.btnOpen.Click += BtnOpen_Click; this.btnCancel.Click += BtnCancel_Click; this.btnNext.Click += BtnNext_Click; this.btnPrev.Click += BtnPrev_Click; this.btnBuild.Click += BtnBuild_Click; this.btnSave.Click += BtnSave_Click; this.btnFinish.Click += BtnFinish_Click; OnStepChanged(true); }
/// <inheritdoc /> public FrmDesigner(FrmWelcome ParentFrmWelcome = null) { InitializeComponent(); //Connections = new Dictionary<BaseBlock, BaseBlock>(); PnlCommandPalette.Hide(); SContainer_Workspace.Panel2.Paint += DrawLinks; SContainer_Workspace.Panel2.Refresh(); MovementTicker = new Timer { Interval = 10, Enabled = false }; MovementTicker.Tick += DoMove; _ParentFrmWelcome = ParentFrmWelcome; BlockTree.NodeMouseDoubleClick += AddBlock; BlockTree.KeyPress += BlockTree_KeyPress; TxtCommandPaletteSearch.TextChanged += (S, E) => { DoSearch(); }; BtnHideCommandPalette.Click += (S, E) => { TxtCommandPaletteSearch.Text = ""; PnlCommandPalette.Hide(); }; KeyUp += OnKeyRelease; LViewSearchResults.ItemActivate += LViewSearchResults_Activated; SContainer_Workspace.Panel2.SuspendLayout(); /*{ * var VarBlock = new DeclareVarBlock { * Location = new Point(300, 10), * Id = (int) BasicBlockIds.Starter, * Size = new Size(200, 100), * TabIndex = (int) BasicBlockIds.Starter * }; * * VarBlock.MouseDown += Block_OnMouseDown; * VarBlock.MouseUp += Block_OnMouseUp; * * SContainer_Workspace.Panel2.Controls.Add(VarBlock); * }*/ { var StartBlock = new StartBlock { Location = new Point(10, 10), Id = (int)BasicBlockIds.Starter, Size = new Size(100, 100), TabIndex = (int)BasicBlockIds.Starter }; StartBlock.Name = StartBlock.GetType().Name + StartBlock.Id; StartBlock.MouseDown += Block_OnMouseDown; StartBlock.MouseUp += Block_OnMouseUp; SContainer_Workspace.Panel2.Controls.Add(StartBlock); } { var DeclarationBlock = new VarDeclareBlock { Location = new Point(SContainer_Workspace.Panel2.Width - 210, 10), Id = (int)BasicBlockIds.Variable, Size = new Size(100, 100), TabIndex = (int)BasicBlockIds.Variable }; DeclarationBlock.Name = DeclarationBlock.GetType().Name + DeclarationBlock.Id; DeclarationBlock.MouseDown += Block_OnMouseDown; DeclarationBlock.MouseUp += Block_OnMouseUp; SContainer_Workspace.Panel2.Controls.Add(DeclarationBlock); } SContainer_Workspace.Panel2.ResumeLayout(true); }