static void Main() { // TODO: change application type in Flavor properties to hide console Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //suppress russian language user interface System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("ru-RU"); // TODO: load config to use proper Commander and set proper form parameters Config.getInitialDirectory(); EventHandler onLoad = null; try { Config.loadGlobalConfig(); } catch (Config.ConfigLoadException cle) { onLoad = (s, e) => cle.visualise(); } var commander = new AlmazovCommander(); //var commander = new SevMorGeoCommader(); ConsoleWriter.Subscribe(commander); var MSControl = new MainForm2(commander); MSControl.Load += onLoad; MSControl.WindowState = FormWindowState.Maximized; commander.Bind(MSControl); Application.Run(MSControl); }
/// <summary> /// Constructor for MainForm /// </summary> /// <param name="mainForm"></param> /// <param name="progressFile"></param> /// <param name="progressAll"></param> /// <param name="progressText"></param> /// <param name="progressDetails"></param> /// <param name="launcherButton"></param> public Downloader(MainForm2 mainForm, Installer installerWorker, Windows7ProgressBar progressFile, Windows7ProgressBar progressAll, Label progressCurFile, Label progressText, Label progressDetails, DoubleBufferFlowPanel flowpanelAddonPacks, PictureBox cancelButton, MaterialFlatButton repoValidateBtn) { this.mainForm = mainForm; this.installer = installerWorker; // define controls this.progressCurFile = progressCurFile; this.progressFile = progressFile; this.progressAll = progressAll; this.progressText = progressText; this.progressDetails = progressDetails; this.cancelButton = cancelButton; this.repoValidateBtn = repoValidateBtn; this.flowpanelAddonPacks = flowpanelAddonPacks; // define calculate worker this.calculateFiles.DoWork += CalculateFiles_DoWork; this.calculateFiles.RunWorkerCompleted += CalculateFiles_RunWorkerCompleted; this.calculateFiles.WorkerSupportsCancellation = true; // define download worker this.downloadFiles.DoWork += DownloadFiles_DoWork; this.downloadFiles.RunWorkerCompleted += DownloadFiles_RunWorkerCompleted; this.downloadFiles.WorkerSupportsCancellation = true; }
public static Form GetMainForm() { bool bShowChangeDefaultSqlServerButton = true; MainForm2 mainForm2 = null; SqlConnectionStringBuilder defaultConnectionStringBuilder; defaultConnectionStringBuilder = MainForm2.GetDefaultLocalSqlConnection(); // defaultConnectionStringBuilder = null; // remove this line if (defaultConnectionStringBuilder != null) { bShowChangeDefaultSqlServerButton = false; } else { defaultConnectionStringBuilder = MainForm2.GetDefaultNetworkSqlConnection(); } if (MainForm2.DefaultConnectionDialogResult == DialogResult.OK) { mainForm2 = new MainForm2() { Icon = GetAppIcon() }; mainForm2.DefaultSqlConnectionStringBuilder = defaultConnectionStringBuilder; mainForm2.ShowChangeDefaultSqlServerButton(bShowChangeDefaultSqlServerButton); } return(mainForm2); }
static void Main() { // Allow only one instance to be run if (!SingleInstance.Start()) { //SingleInstance.ShowFirstInstance(); // return; } // Run as admin check IsRunAsAdmin = (new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator)); // Get Commandline args CommandLineArgs.Get(); // Load settings BotSettings.Instance.Load(); Settings.Default.Reload(); if (Settings.Default.AutoPosScreens == null || (Settings.Default.AutoPosScreens != null && Settings.Default.AutoPosScreens.Count == 0)) { AutoPosition.UpdateScreens(); } if (Settings.Default.D3StarterPath.Equals(string.Empty) || Settings.Default.D3StarterPath.Equals("")) { Settings.Default.D3StarterPath = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "ThirdParty\\D3Starter.exe"); } // Start background threads Relogger.Instance.Start(); StatsUpdater.Instance.Start(); if (Settings.Default.FocusCheck) { ForegroundChecker.Instance.Start(); } var comms = new Communicator(); comms.Start(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Mainform = new MainForm2(); Application.Run(Mainform); // Clean up SingleInstance.Stop(); Settings.Default.Save(); Logger.Instance.WriteGlobal("Closed!"); Logger.Instance.ClearBuffer(); }
public RepoReader(MainForm2 mainForm, DoubleBufferFlowPanel flowpanelAddonPacks, TreeView repoTreeView, Downloader downloader, Installer installer, Label lbl_filesOK, Label lbl_filesINVALID, Label lbl_filesMISSING) { this.mainForm = mainForm; this.flowpanelAddonPacks = flowpanelAddonPacks; this.repoTreeView = repoTreeView; this.downloader = downloader; this.installer = installer; this.lbl_filesOK = lbl_filesOK; this.lbl_filesINVALID = lbl_filesINVALID; this.lbl_filesMISSING = lbl_filesMISSING; // define validation worker this.validateRepo.DoWork += ValidateRepo_DoWork; this.validateRepo.RunWorkerCompleted += ValidateRepo_RunWorkerCompleted; this.validateRepo.WorkerSupportsCancellation = true; }
/// <summary> /// Constructor /// </summary> /// <param name="mainForm"></param> /// <param name="progressFile"></param> /// <param name="progressAll"></param> /// <param name="progressText"></param> /// <param name="progressDetails"></param> /// <param name="progressCurFile"></param> /// <param name="launcherButton"></param> public Installer(MainForm2 mainForm, Windows7ProgressBar progressFile, Windows7ProgressBar progressAll, Label progressText, Label progressDetails, Label progressCurFile, DoubleBufferFlowPanel flowpanelAddonPacks, PictureBox cancelButton, MaterialSingleLineTextField gamePathBox, MaterialSingleLineTextField ts3PathBox, MaterialSingleLineTextField addonsPathBox, PictureBox gamePathErase, PictureBox ts3PathErase, PictureBox addonsPathErase, PictureBox gamePathFind, PictureBox ts3PathFind, PictureBox addonsPathFind, MaterialRaisedButton ts3Plugin, MaterialFlatButton repoValidateBtn) { this.activeForm = "mainForm"; this.mainForm = mainForm; // define controls this.progressFile = progressFile; this.progressAll = progressAll; this.progressText = progressText; this.progressDetails = progressDetails; this.progressCurFile = progressCurFile; this.flowpanelAddonPacks = flowpanelAddonPacks; this.cancelButton = cancelButton; this.repoValidateBtn = repoValidateBtn; // define controls (directory fields) this.gamePathBox = gamePathBox; this.gamePathErase = gamePathErase; this.gamePathFind = gamePathFind; this.ts3PathBox = ts3PathBox; this.ts3PathErase = ts3PathErase; this.ts3PathFind = ts3PathFind; this.addonsPathBox = addonsPathBox; this.addonsPathErase = addonsPathErase; this.addonsPathFind = addonsPathFind; // define controls (toolstrip menu items) this.ts3Plugin = ts3Plugin; // define background worker this.installFiles.DoWork += InstallFiles_DoWork; this.installFiles.RunWorkerCompleted += InstallFiles_RunWorkerCompleted; this.validateFiles.DoWork += ValidateFiles_DoWork; this.validateFiles.RunWorkerCompleted += ValidateFiles_RunWorkerCompleted; // define timer this.delayLaunch.Interval = 2000; this.delayLaunch.Tick += DelayLaunch_Tick; }
private void btnUrediSifru_Click(object sender, EventArgs e) { if (!Class.Registracija.dopustenoKreiranjeNovihDokumenta) { return; } if (dgv.RowCount > 0) { string broj = dgv.CurrentRow.Cells["Broj ponude"].Value.ToString(); if (this.MdiParent != null) { var mdiForm = this.MdiParent; mdiForm.IsMdiContainer = true; var childForm = new frmPonude(); childForm.broj_ponude_edit = broj; childForm.MdiParent = mdiForm; childForm.Dock = DockStyle.Fill; childForm.Show(); } else { if (MainForm == null && MainForm2 != null) { MainForm2.broj_ponude_edit = broj; MainForm2.Show(); } else { MainForm.broj_ponude_edit = broj; MainForm.Show(); } this.Close(); } } else { MessageBox.Show("Niste odabrali niti jednu stavku.", "Greška"); } }
private void simpleButton登录_Click(object sender, EventArgs e) { ConnDB conn = new ConnDB(); string strsql, password; password = Common.MD5Encrypt(textEditPsw.Text.ToString().Trim()); strsql = "select password,dept2 from cost_user where cname = '" + textEditName.Text.ToString().Trim() + "'"; if (textEditName.Text.ToString().Trim() != "" && textEditPsw.Text.ToString().Trim() != "") { DataSet ds = conn.ReturnDataSet(strsql); if (ds.Tables[0].Rows.Count>0) { if (password == ds.Tables[0].Rows[0][0].ToString()) { //MainForm2.ShowMe(); cname = textEditName.Text.ToString().Trim(); dept2 = ds.Tables[0].Rows[0][1].ToString().Trim(); MainForm2 frm = new MainForm2(); frm.Show(); // MainForm2.CheckRight(); this.Visible = false; } else { MessageBox.Show("密码不正确!"); } } else { MessageBox.Show("用户名不存在!"); } } else { MessageBox.Show("用户名或密码不能为空!"); } conn.Close(); }
public Packs(MainForm2 mainForm, FlowLayoutPanel packsPanel, MetroComboBox cbServerPacks) { this.mainForm = mainForm; this.packsPanel = packsPanel; this.cbServerPacks = cbServerPacks; }
public PackBlock(MainForm2 mainForm, string packTitle, string packID, string packDescription, XmlDocument RemoteXmlInfo, FlowLayoutPanel packsPanel, bool isOptionalAllowed, List <string> addonsName) { this.SetStyle( System.Windows.Forms.ControlStyles.UserPaint | System.Windows.Forms.ControlStyles.AllPaintingInWmPaint | System.Windows.Forms.ControlStyles.OptimizedDoubleBuffer, true ); InitializeComponent(); this.panel_effectFade.Size = new Size(410, 200); this.flowpanel_packContent.Controls.Clear(); this.moreInfoPanelIO = new PanelIO(panel_moreInfo, 33, 120); this.packInfoPanelIO = new PanelIO(panel_packInfo, 33, 410); this.packsPan = packsPanel; this.txt_title.Text = packTitle; this.packID = packID; this.txt_content.Text = packDescription; this.mainForm = mainForm; this.isOptionalAllowed = isOptionalAllowed; this.addonsName = addonsName; txt_title.Font = customFont.getFont(Properties.Fonts.Lato_Semibold, 10F, FontStyle.Regular); lbl_packcontent.Font = customFont.getFont(Properties.Fonts.Lato_Semibold, 10F, FontStyle.Regular); txt_content.Font = customFont.getFont(Properties.Fonts.ClearSans_Light, 9F, FontStyle.Regular); foreach (string addonName in addonsName) { if (addonName != "@dummy") { Label addon = new Label { AutoSize = true, Text = addonName, Font = customFont.getFont(Properties.Fonts.ClearSans_Light, 9F, FontStyle.Regular) }; int bgColor = rnd.Next(60, 120); addon.BackColor = Color.FromArgb(150, bgColor, bgColor, bgColor); Padding margin = addon.Margin; margin.Left = 0; margin.Right = 0; margin.Top = 0; margin.Bottom = 3; addon.Margin = margin; this.flowpanel_packContent.Controls.Add(addon); } } if (packID == "arma3") { btn_addonsOptionsClose.Visible = false; } loadbackground(packID); if (isOptionalAllowed) { Label addon = new Label { AutoSize = true, Text = "✓ Optional addons allowed", Font = customFont.getFont(Properties.Fonts.ClearSans_Light, 9F, FontStyle.Regular) }; int bgColor = rnd.Next(60, 120); addon.BackColor = Color.FromArgb(150, bgColor, bgColor, bgColor); Padding margin = addon.Margin; margin.Left = 0; margin.Right = 0; margin.Top = 0; margin.Bottom = 3; addon.Margin = margin; this.flowpanel_packContent.Controls.Add(addon); } this.packInfoPanelIO.ShowPanel(); }
private static void Main() { try { // Allow only one instance to be run if (!SingleInstance.Start()) { SingleInstance.ShowFirstInstance(); return; } // Run as admin check WindowsIdentity identity = WindowsIdentity.GetCurrent(); if (identity != null) { IsRunAsAdmin = (new WindowsPrincipal(identity).IsInRole(WindowsBuiltInRole.Administrator)); } // Get Commandline args CommandLineArgs.Get(); if (CommandLineArgs.SafeMode) { DialogResult result = MessageBox.Show("Launching in safe mode!\nThis will reset some features", "YetAnotherRelogger Safe Mode", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (result == DialogResult.Cancel) { return; } } // Load settings BotSettings.Instance.Load(); Settings.Default.Reload(); Settings.Default.Upgrade(); if (Settings.Default.AutoPosScreens == null || (Settings.Default.AutoPosScreens != null && Settings.Default.AutoPosScreens.Count == 0)) { AutoPosition.UpdateScreens(); } // Start background threads Relogger.Instance.Start(); Communicator.Instance.Start(); if (!CommandLineArgs.SafeMode) { if (Settings.Default.StatsEnabled) { StatsUpdater.Instance.Start(); } if (Settings.Default.FocusCheck) { ForegroundChecker.Instance.Start(); } } else { Settings.Default.StatsEnabled = false; Settings.Default.FocusCheck = false; AutoPosition.UpdateScreens(); } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Mainform = new MainForm2(); Application.Run(Mainform); } catch (Exception ex) { Logger.Instance.WriteGlobal(ex.ToString()); } // Clean up SingleInstance.Stop(); Settings.Default.Save(); Logger.Instance.WriteGlobal("Closed!"); Logger.Instance.ClearBuffer(); }
public LaunchCore(DoubleBufferFlowPanel launchOptions, string clientProfile, string serverConfig, string serverProfile, string hcProfile, int hcInstances, bool maxMem, string s_maxMem, bool malloc, string s_malloc, bool exThreads, string s_exThreads, bool cpuCount, string s_cpuCount, DoubleBufferFlowPanel workshopAddons, DoubleBufferFlowPanel optionalAddons, List <string> addonsList, bool isOptionalAllowed, MainForm2 mainForm) { string auxCombinedArguments = AggregateArguments(launchOptions, clientProfile, serverConfig, serverProfile, hcProfile, maxMem, s_maxMem, malloc, s_malloc, exThreads, s_exThreads, cpuCount, s_cpuCount); string auxCoreMods = "-mod=\""; string auxCombinedAddons = string.Empty; this.mainForm = mainForm; this.HcInstances = hcInstances; foreach (string addon in addonsList) { if (addon != null) { if (auxCoreMods != "-mod=\"") { auxCoreMods = auxCoreMods + ";" + AddonsFolder + addon; } else { auxCoreMods = auxCoreMods + AddonsFolder + addon; } } else { break; } } if (auxCombinedArguments != string.Empty) { Arguments = auxCombinedArguments.Remove(auxCombinedArguments.Length - 1); } if (workshopAddons.Controls.Count > 0 && isOptionalAllowed && GlobalVar.workshopEnabled) { try { foreach (MaterialSkin.Controls.MaterialCheckBox waddon in workshopAddons.Controls) { if (waddon.Checked) { if (auxCombinedAddons != string.Empty) { auxCombinedAddons += ";" + WorkshopFolder + waddon.Text; } else { auxCombinedAddons = ";" + WorkshopFolder + waddon.Text; } } } } catch { } } if (optionalAddons.Controls.Count > 0 && isOptionalAllowed && GlobalVar.optionalEnabled) { try { foreach (MaterialSkin.Controls.MaterialCheckBox waddon in optionalAddons.Controls) { if (waddon.Checked) { if (auxCombinedAddons != string.Empty) { auxCombinedAddons += ";" + OptionalFolder + waddon.Text; } else { auxCombinedAddons = ";" + OptionalFolder + waddon.Text; } } } } catch { } } if (addonsList.Count == 0 && auxCombinedAddons != string.Empty) { auxCombinedAddons = auxCombinedAddons.Remove(0, 1); } if (Arguments != string.Empty) { Arguments = Arguments + " " + auxCoreMods + auxCombinedAddons + "\""; } else { Arguments = auxCoreMods + auxCombinedAddons; } //new Windows.MessageBox().Show(Arguments); }