public meteo_frm(environmentVars stateIni, MainMdiForm _mainmdiform) { SetStyle(ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.UserPaint, true); stateCore = stateIni; mainForm = _mainmdiform; SuspendLayout(); InitializeComponent(); ResumeLayout(); if (!stateCore.addonsLoaded || !stateCore.addons.ContainsKey("weather")) { translations.load("errorMessages"); string message3 = translations.getText("errorWeatherAddonNotFound") + ". " + translations.getText("contactEnterpriseSupport"); translations.load("messagebox"); msgbox = new messageBoxForm(message3 + ". ", translations.getText("warning"), MessageBoxButtons.OK, MessageBoxIcon.Information, Location.X + Width / (double)2, Location.Y + Height / (double)2); msgbox.ShowDialog(); mainForm.busy.Close(true); return; } _weather_pic.Name = "weather_pic"; _city_txt.Name = "city_txt"; _site_combo.Name = "site_combo"; _select_location_lbl.Name = "select_location_lbl"; _descricao_txt.Name = "descricao_txt"; _meteo_txt.Name = "meteo_txt"; _PictureBoxDoubleBuffer1.Name = "PictureBoxDoubleBuffer1"; _AlphaGradientPanel1.Name = "AlphaGradientPanel1"; _LabelDoubleBuffer1.Name = "LabelDoubleBuffer1"; _LabelDoubleBuffer2.Name = "LabelDoubleBuffer2"; _Label1.Name = "Label1"; }
private void validateCode() { enVars.successLogin = false; cardId.Enabled = false; codetxt.Enabled = false; statusMessage.Text = My.Resources.strings.commServer; statusMessage.Visible = true; if (codetxt.Text.Equals("") | !Information.IsNumeric(codetxt.Text) | cardId.Text.Equals("") | !Information.IsNumeric(cardId.Text)) { msgbox = new messageBoxForm(My.Resources.strings.loginFailed + ". " + My.Resources.strings.tryAgain + " ?", My.Resources.strings.question, MessageBoxButtons.RetryCancel, MessageBoxIcon.Information, this.Location.X + this.Width / 2, this.Location.Y + this.Height / 2); if (msgbox.ShowDialog == DialogResult.Cancel) { Application.Exit(); return; } access_code.Text = My.Resources.strings.accessCode; codetxt.Enabled = true; cardId.Enabled = true; cardId.Enabled = true; statusMessage.Visible = true; codetxt.Text = ""; cardId.Text = ""; return; } panelLogin.Visible = false; panelLogin.Refresh(); startupBackgroundTasks.doLogin(cardId.Text.ToString(), codetxt.Text.ToString()); }
private void registerPC_dataarrived(object sender, string responseData, Dictionary <string, string> msic) { if (!IsResponseOk(responseData)) { translations.load("messagebox"); msgbox = new messageBoxForm(GetMessage(responseData), translations.getText("warning"), MessageBoxButtons.RetryCancel, MessageBoxIcon.Information); BringToFront(); Application.DoEvents(); if (msgbox.ShowDialog == DialogResult.Retry) { SaveSettingsOwnExisting(); return; } else { translations.load("setupWizard"); string message = translations.getText("cannotContinue"); translations.load("messagebox"); msgbox = new messageBoxForm(message, translations.getText("information"), MessageBoxButtons.OK, MessageBoxIcon.Information); BringToFront(); msgbox.ShowDialog(); Application.Exit(); return; } } ProgressBar.Value = 66; progressValueTop = 100; // SAVE SETTINGS FILE mainform.enVars.secretKey = mainform.enVars.SettingsSecretKey; mainform.settings.updateState(mainform.enVars); Application.DoEvents(); mainform.settings.save(); ProgressBar.Value = 100; }
private void iconMenuSettings_Click(object sender, EventArgs e) { if (optionsIsOnpen) { optionsIsOnpen = false; if (!Information.IsNothing(currentForm)) { currentForm.Close(); } panelMenuOptionsContainer.Height = 0; } else { optionsIsOnpen = true; Type loadedType; FormCustomized formToLoad; loadedType = AssembliesManager.friendlyLoadTypeObjectFromAssembly("sideBarSettings"); if (loadedType is null) { msgbox = new messageBoxForm(resources.GetString("exitApp", CultureInfo.CurrentCulture) + " ?", resources.GetString("question", CultureInfo.CurrentCulture), MessageBoxButtons.YesNo, MessageBoxIcon.Question, this.Location.X + this.Width / 2, this.Location.Y + this.Height / 2, enVars); msgbox.ShowDialog(); return; } formToLoad = Activator.CreateInstance(loadedType, enVars) as FormCustomized; panelMenuOptionsContainer.Height = formToLoad.Height; openChildForm(panelMenuOptionsContainer, formToLoad); } }
private void mainAppLayoutForm_FormClosing(object sender, FormClosingEventArgs e) { System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo(enVars.currentLang); msgbox = new messageBoxForm(resources.GetString("exitApp", CultureInfo.CurrentCulture) + " ?", resources.GetString("question", CultureInfo.CurrentCulture), MessageBoxButtons.YesNo, MessageBoxIcon.Question, this.Location.X + this.Width / 2, this.Location.Y + this.Height / 2, enVars); if (msgbox.ShowDialog().Equals(MsgBoxResult.No)) { e.Cancel = true; } Application.RemoveMessageFilter((IMessageFilter)this); }
private void loadAssembly() { try { var assembly = Assembly.LoadFile(enVars.libraryPath + "setup.dll"); TypesOnAssemblies = assembly; } catch (Exception ex) { messageBoxForm msgbox; msgbox = new messageBoxForm("Setup error. You need to download and install the lastest version of the program at ", "exclamation", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); msgbox.ShowDialog(); Application.Exit(); return; } }
private void loadCloudSettingsData_dataArrived(object sender, string responseData, Dictionary <string, string> misc) { bool errorFlag = false; string errorMsg = ""; if (!ManagementNetwork.IsResponseOk(responseData)) { errorMsg = ManagementNetwork.GetMessage(responseData); errorFlag = true; goto Lastline; } Dictionary <string, List <string> > DBsettings; DBsettings = loadCloudSettingsData.ConvertDataToArray("settings", state.querySettingsFields, responseData); if (Information.IsNothing(DBsettings)) { errorMsg = loadCloudSettingsData.errorMessage; errorFlag = true; goto Lastline; } state.maxWorkHoursDay = TimeSpan.Parse(DBsettings["work_hours"][0]); state.delayDaysValidationAttendance = Conversions.ToInteger(DBsettings["max_days_delay_validation"][0]); state.customization.businessname = DBsettings["company_name"][0]; Lastline: ; if (errorFlag) { var MsgBox = new messageBoxForm(errorMsg + ". " + My.Resources.strings.tryAgain + " ?", My.Resources.strings.question, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (MsgBox.ShowDialog() == DialogResult.Yes) { loadServerSettings(); } else { loginError?.Invoke(this, errorMsg); } return; } LoadingCounter += 1; updatePrgressBar?.Invoke(this, (int)(LoadingCounter / (double)LoadingCounterTotalTasks * 100)); updateStatusMessage?.Invoke(this, "Loading cloud settings...done"); taskManager.setStatus("loadServerSettings", Conversions.ToInteger(tasksManager.tasksManagerClass.FINISHED)); }
private void TimerCheckIsOnline_Tick(object sender, EventArgs e) { if (IsValidUrl("http|https", server_web_addr.Text).Equals(true)) { if (IsOnline(server_web_addr.Text)) // check if is online and working { mainform.settings.serverWebAddr = server_web_addr.Text; mainform.settings.isNewServer = false; mainform.settings.ApiServerAddrPath = mainform.defaultApiServerAddrPath; selectionOkpic.Visible = true; } else { messageBoxForm msgbox; msgbox = new messageBoxForm(translations.getText("serverOffline"), "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, -1, -1, mainform.enVars); msgbox.ShowDialog(); } } }
private void closeBtn_Click(object sender, EventArgs e) { if (!currentFormData["cardId"].Equals(currentUID) | !currentFormData["authString"].Equals(currentCode)) { translations.load("smartcard"); string message = translations.getText("questionLoadValuesIntoForm"); translations.load("messagebox"); msgbox = new messageBoxForm(message + " ?", translations.getText("question"), MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (msgbox.ShowDialog() == DialogResult.Yes) { var sendData = new Dictionary <string, string>(); sendData.Add("CardId", AddSpaces(currentUID, 3)); sendData.Add("authString", currentCode.Substring(0, 4) + " - " + currentCode.Substring(4, 3) + " - " + currentCode.Substring(7, 5)); getSmartCardDetails?.Invoke(this, sendData); } } Close(); }
private void sendEmailHttp_dataArrived(object sender, string responseData, Dictionary <string, string> misc) { if (!IsResponseOk(responseData)) { translations.load("messagebox"); msgbox = new messageBoxForm(GetMessage(responseData), translations.getText("warning"), MessageBoxButtons.OK, MessageBoxIcon.Information, -1, -1, mainform.enVars); BringToFront(); Application.DoEvents(); msgbox.ShowDialog(); } else { translations.load("messagebox"); msgbox = new messageBoxForm(GetMessage(responseData), translations.getText("information"), MessageBoxButtons.OK, MessageBoxIcon.Information, -1, -1, mainform.enVars); BringToFront(); Application.DoEvents(); msgbox.ShowDialog(); } }
private void QueueTimerTick(object sender, ElapsedEventArgs e) { if (QueuesToComplete(queue).Equals(0) & QueuesToSend(queue).Equals(0)) { RestartQueueTimer.Stop(); queue = new List <_queue_data_struct>(); requestCompleted?.Invoke(this, null); IsBusy = false; return; } if (Conversions.ToBoolean(Operators.ConditionalCompareObjectGreaterEqual(retryAttempts.counter, numberOfRetryAttempts, false))) // ToDo a retry number of attempts before quits { System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo(state.currentLang); messageBoxForm MsgBox; MsgBox = new messageBoxForm(retryAttempts.errorMessage + ". " + resources.GetString("tryAgain") + " ?", resources.GetString("question"), MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (MsgBox.ShowDialog() == DialogResult.Yes) { _retry_attempts retry; retry.counter = 0; retry.previousPattern = -1; retry.pattern = 0; retry.errorMessage = ""; retryAttempts = retry; startSendQueue(); } else { RestartQueueTimer.Stop(); queue = new List <_queue_data_struct>(); requestCompleted?.Invoke(this, null); IsBusy = false; return; } return; } else if (!sendToQueue & QueuesToSend(queue) > 0) { startSendQueue(); } }
private void wizardGoForward() { server_web_addr.Text = server_web_addr.Text[server_web_addr.Text.Length - 1].Equals("/") ? server_web_addr.Text.Substring(0, server_web_addr.Text.Length - 2) : server_web_addr.Text; server_ftp_addr.Text = server_ftp_addr.Text[server_ftp_addr.Text.Length - 1].Equals("/") ? server_ftp_addr.Text.Substring(0, server_ftp_addr.Text.Length - 2) : server_ftp_addr.Text; if (!IsValidUrl("http|https", server_web_addr.Text) && !IsOnline(server_web_addr.Text)) // check if is online and working { messageBoxForm msgbox; msgbox = new messageBoxForm(translations.getText("serverOffline"), "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, -1, -1, mainform.enVars); msgbox.ShowDialog(); server_web_addr.Focus(); } bool connectType = false; if (connectionType.SelectedIndex.Equals(0)) { connectType = true; // with ssl } if (!password.Text.Equals("") & !username.Text.Equals("") & !IsValidUrl("ftp", server_ftp_addr.Text) && !IsFtpOnline(connectType, server_ftp_addr.Text, username.Text, password.Text)) // check if is online and working { messageBoxForm msgbox; msgbox = new messageBoxForm(translations.getText("serverOffline"), "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, -1, -1, mainform.enVars); msgbox.ShowDialog(); server_web_addr.Focus(); } // web server mainform.settings.serverWebAddr = server_web_addr.Text; mainform.settings.ApiServerAddrPath = mainform.defaultApiServerAddrPath; // ftp server mainform.settings.serverFtpAddr = server_ftp_addr.Text; mainform.settings.serverFtpPort = server_ftp_port.Text; mainform.settings.serverFtpPwd = password.Text; mainform.settings.serverFtpUser = username.Text; mainform.settings.serverFtpSsl = connectType; // 'TODO // 'setupWizard_createDB.Show() }
private void iconMenuSettings_Click(object sender, EventArgs e) { if (optionsIsOnpen) { optionsIsOnpen = false; if (!Information.IsNothing(currentForm)) { currentForm.Close(); enVars.AssembliesManager.unload("sideBarSettings"); } panelMenuOptionsContainer.Height = 0; } else { optionsIsOnpen = true; Type loadedType; FormCustomized formToLoad; loadedType = enVars.AssembliesManager.friendlyLoadTypeObjectFromAssembly("sideBarSettings"); if (loadedType is null) { msgbox = new messageBoxForm(resources.GetString("errorPlugIn", CultureInfo.CurrentCulture) + " ! \n\r" + enVars.AssembliesManager.errorMessage, resources.GetString("exclamation", CultureInfo.CurrentCulture), MessageBoxButtons.OK, MessageBoxIcon.Exclamation, this.Location.X + this.Width / 2, this.Location.Y + this.Height / 2, enVars); msgbox.ShowDialog(); return; } try { formToLoad = Activator.CreateInstance(loadedType, enVars) as FormCustomized; panelMenuOptionsContainer.Height = formToLoad.Height; openChildForm(panelMenuOptionsContainer, formToLoad); } catch (Exception ex) { Interaction.MsgBox("Error loading plugin. \r\n(" + ex.Message + ")"); } } }
private void checkCredentialsHttp_dataArrived(object sender, string responseData, Dictionary <string, string> misc) { if (!IsResponseOk(responseData)) { translations.load("messagebox"); msgbox = new messageBoxForm(GetMessage(responseData), translations.getText("warning"), MessageBoxButtons.OK, MessageBoxIcon.Information, -1, -1, mainform.enVars); BringToFront(); Application.DoEvents(); msgbox.ShowDialog(); if (authByCard) { doCardAuth(); } mainform.forwardPicBtn.Visible = true; mainform.backPicBtn.Visible = true; return; } mainform.settings.userId = sign_id.Text; mainform.forwardPicBtn.Visible = true; mainform.backPicBtn.Visible = true; }
private void getfiles_requestCompleted(object sender, string responseData) { try { // TODO review for (int i = 0, loopTo = state.assemblies.Count - 1; i <= loopTo; i++) { var assembly = System.Reflection.Assembly.LoadFile(state.libraryPath + state.assemblies.ElementAt(i).Key); state.assemblies[i.ToString()].Values.ElementAt(0).AssemblyObject = assembly.GetType(state.assemblies[i.ToString()].Values.ElementAt(0).spaceName); } } catch (Exception ex) { // TODO save crash report taskManager.unload(); messageBoxForm msgbox; msgbox = new messageBoxForm("Error Loading libraries. You need to download and install the lastest version of the program at " + state.customization.websiteToLoadProgram, "exclamation", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); msgbox.ShowDialog(); Application.Exit(); return; } taskManager.setStatus("loadCloudFiles", Conversions.ToInteger(tasksManager.tasksManagerClass.FINISHED)); }
private void startupBackgroundTasks_loginError(object sender, string message) { msgbox = new messageBoxForm(message + " " + My.Resources.strings.tryAgain + " ?", My.Resources.strings.question, MessageBoxButtons.RetryCancel, MessageBoxIcon.Question); if (!message.Equals("skip") && msgbox.ShowDialog == DialogResult.Cancel) { Application.Exit(); return; } else { codetxt.Invoke(() => { codetxt.Enabled = true; codetxt.Text = ""; }); cardId.Invoke(() => { cardId.Enabled = true; cardId.Text = ""; }); panelLogin.Invoke(() => panelLogin.Visible = true); if (authByCard) { cancelCard_lbl.Invoke(() => cancelCard_lbl.Visible = true); } else { cardId.Invoke(() => cardId.Visible = true); } if (authByCard) { doCardAuthByNFC(); } } }
private void SaveAuthString_Click(object sender, EventArgs e) { nfCard = new smartCard(); if (!nfCard.SelectDevice()) { return; } else { nfCard.establishContext(); } StartBtn.Enabled = false; readCodeOnly.Enabled = false; if (nfCard.connectCard()) { progressBar.Value = 0; if (!nfCard.readCardUID()) { progressBar.Value = 0; StartBtn.Enabled = true; readCodeOnly.Enabled = true; mainForm.statusMessage = "erro ao ler ID cartao"; return; } else if (nfCard.getCardUIDString().Equals("")) { progressBar.Value = 0; StartBtn.Enabled = true; readCodeOnly.Enabled = true; mainForm.statusMessage = "erro ao ler ID vazio"; return; } string cardUID = nfCard.getCardUIDString(); progressBar.Value = 50; if (cardUID.Equals(currentFormData["cardId"].Replace(" ", "")) & !currentFormData["authString"].Equals("")) { translations.load("smartcard"); string message = translations.getText("questionCardIsInitialized"); translations.load("messagebox"); msgbox = new messageBoxForm(message, translations.getText("question"), MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (msgbox.ShowDialog() != DialogResult.Yes) { StartBtn.Enabled = true; readCodeOnly.Enabled = true; return; } } string workerCode = ""; var rnd = new Random(); VBMath.Randomize(); if (Conversions.ToInteger(currentFormData["userCode"]) < 10) { workerCode = "00" + Conversions.ToInteger(currentFormData["userCode"]).ToString(); } else if (Conversions.ToInteger(currentFormData["userCode"]) < 100) { workerCode = "0" + Conversions.ToInteger(currentFormData["userCode"]).ToString(); } else { workerCode = Conversions.ToInteger(currentFormData["userCode"]).ToString(); } // auth format is PIN number (4 digits) + cod_worker DB(3 digits including left zeros) + 5 digit random string for a total of 12 bytes or 3 blocks string newAuthStr; if (currentFormData.ContainsKey("pin")) { newAuthStr = currentFormData.ContainsKey("pin") + workerCode + randomString[5]; } else { newAuthStr = rnd.Next(1000, 10000).ToString() + workerCode + randomString[5]; } if (!nfCard.SaveStringOnCard(newAuthStr, 5)) // Please make sure you do not write data into these Authentication Blocks 0-4 for mifare ntag 215. { translations.load("messagebox"); msgbox = new messageBoxForm(nfCard.errorMessage, translations.getText("exclamation"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); msgbox.ShowDialog(); nfCard.Close(); StartBtn.Enabled = true; readCodeOnly.Enabled = true; return; } nfCard.Close(); progressBar.Value = 100; authCode_lbl.Text = translations.getText("authCode") + ": " + newAuthStr.Substring(0, 4) + " - " + newAuthStr.Substring(4, 3) + " - " + newAuthStr.Substring(7, 5); cardIdCode.Text = translations.getText("cardId") + ": " + AddSpaces(Convert.ToInt64(cardUID, 16).ToString(), 3); base.Refresh(); currentUID = Convert.ToInt64(cardUID, 16).ToString(); currentCode = newAuthStr; currentPin = currentCode.Substring(0, 4); var sendData = new Dictionary <string, string>(); sendData.Add("CardId", AddSpaces(currentUID, 3)); sendData.Add("authString", currentCode.Substring(0, 4) + " - " + currentCode.Substring(4, 3) + " - " + currentCode.Substring(7, 5)); getSmartCardDetails?.Invoke(this, sendData); } else { cardIdCode.Text = translations.getText("cardId") + ": - -"; authCode_lbl.Text = translations.getText("authCode") + ": - -"; base.Refresh(); var sendData = new Dictionary <string, string>(); sendData.Add("CardId", ""); sendData.Add("authString", ""); getSmartCardDetails?.Invoke(this, sendData); currentUID = ""; currentCode = ""; currentPin = ""; } StartBtn.Enabled = true; readCodeOnly.Enabled = true; }
private void menuPanel_Click(object sender, EventArgs e) { string menukey = ""; int subMenuPos = 0; Control ctrl = (Control)sender; var clickedMenuPanel = new Control(); if (sender is Panel) { if (!ctrl.Name.Equals(menuPanel.Name)) { clickedMenuPanel = ctrl; } else if (ctrl.Parent is object) { if (ctrl.Parent.Parent.Name.Equals("panelLateral")) { clickedMenuPanel = ctrl.Parent; } } } if (sender is LabelDoubleBuffer) { clickedMenuPanel = ctrl.Parent; } if (sender is PictureBox) // menu icon { clickedMenuPanel = ctrl.Parent; menukey = clickedMenuPanel.Name.Substring(0, clickedMenuPanel.Name.IndexOf("-")); subMenuPos = Conversions.ToInteger(clickedMenuPanel.Name.Substring(clickedMenuPanel.Name.IndexOf("-") + 1)); if (clickedMenuPanel.Width.Equals(enVars.layoutDesign.MENU_OPEN_STATE)) // ' its open the lateral bar { if (enVars.layoutDesign.menu.items.ElementAt(subMenuPos).isOpen.Equals(false)) // ' menu is closed { enVars.layoutDesign.menu.items.ElementAt(subMenuPos).isOpen = true; MenuUpdate(true); } else { MenuItemStateReset(false); MenuUpdate(false); } } else { enVars.layoutDesign.menu.items.ElementAt(subMenuPos).isOpen = true; MenuUpdate(true); } return; } // 'is the submenu wrapper panel ? if (clickedMenuPanel.Name.IndexOf("-") > -1) { menukey = clickedMenuPanel.Name.Substring(0, clickedMenuPanel.Name.IndexOf("-")); subMenuPos = Conversions.ToInteger(clickedMenuPanel.Name.Substring(clickedMenuPanel.Name.IndexOf("-") + 1)); } else { menukey = clickedMenuPanel.Name; subMenuPos = 0; } // 'no content to load and is also menu title if (enVars.layoutDesign.menu.items.ElementAt(subMenuPos).formWithContentsToLoad is null & enVars.layoutDesign.menu.items.ElementAt(subMenuPos).subMenuIndex.Equals(0)) { enVars.layoutDesign.menu.items.ElementAt(subMenuPos).isOpen = !enVars.layoutDesign.menu.items.ElementAt(subMenuPos).isOpen; // 'leave lateral pane open MenuUpdate(true); } //Load contents Type loadedType; FormCustomized formToLoad; loadedType = enVars.AssembliesManager.friendlyLoadTypeObjectFromAssembly(enVars.layoutDesign.menu.items.ElementAt(subMenuPos).assemblyFriendlyUID); if (loadedType is null) { messageBoxForm msgbox = new messageBoxForm(resources.GetString("errorPlugIn", CultureInfo.CurrentCulture) + " ! \n\r" + enVars.AssembliesManager.errorMessage, resources.GetString("exclamation", CultureInfo.CurrentCulture), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); msgbox.ShowDialog(); return; } formToLoad = Activator.CreateInstance(loadedType, enVars, updateMainApp) as FormCustomized; if (enVars.layoutDesign.menu.items.ElementAt(subMenuPos).formWithContentsToLoad != null) { MenuUpdate(false); MenuItemActiveBarReset(); enVars.layoutDesign.menu.items.ElementAt(subMenuPos).menuActiveBarPanel.BackColor = enVars.layoutDesign.menu.properties.activeBarColor; menuPanelClick?.Invoke(sender, subMenuPos); } }
/* TODO ERROR: Skipped EndRegionDirectiveTrivia */ /* TODO ERROR: Skipped RegionDirectiveTrivia */ private void loadCloudFiles() { taskManager.setStatus("loadCloudFiles", Conversions.ToInteger(tasksManager.tasksManagerClass.BUSY)); LoadingCounter += 1; updatePrgressBar?.Invoke(this, (int)(LoadingCounter / (double)LoadingCounterTotalTasks * 100)); updateStatusMessage?.Invoke(this, "Loading cloud settings..."); // TODO review dynamicAssembliesToLoadIndex = new List <int>(); bool found = false; for (int i = 0, loopTo = state.assemblies.Count - 1; i <= loopTo; i++) { found = false; for (int j = 0, loopTo1 = dynamicAssembliesToLoad.Count - 1; j <= loopTo1; j++) { if (dynamicAssembliesToLoad.ElementAt(j).Equals(state.assemblies.ElementAt(i).Key)) { dynamicAssembliesToLoadIndex.Add(i); found = true; break; } } if (!found) { messageBoxForm msgbox; msgbox = new messageBoxForm("Incorrect Dll files. You need to download and install the lastest version of the program at " + state.customization.websiteToLoadProgram, "exclamation", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); msgbox.ShowDialog(); taskManager.unload(); Application.Exit(); return; } } if (!Directory.Exists(state.tmpPath) | !Directory.Exists(state.libraryPath) | !Directory.Exists(state.templatesPath)) { messageBoxForm msgbox; msgbox = new messageBoxForm("Folders not found. You need to download and install the lastest version of the program at " + state.customization.websiteToLoadProgram, "exclamation", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); msgbox.ShowDialog(); Application.Exit(); return; } var myDir = new DirectoryInfo(state.tmpPath); if (myDir.EnumerateFiles().Any()) { try { FileSystem.Kill(string.Format("{0}", state.tmpPath + "*.*")); } catch (Exception ex) { messageBoxForm msgbox; msgbox = new messageBoxForm("Unable do delete temporary files. Clear tmp folder and start the App again.", "exclamation", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); msgbox.ShowDialog(); Application.Exit(); return; } } myDir = new DirectoryInfo(state.templatesPath); if (myDir.EnumerateFiles().Any()) { try { FileSystem.Kill(string.Format("{0}", state.templatesPath + "*.*")); } catch (Exception ex) { messageBoxForm msgbox; msgbox = new messageBoxForm("Unable do delete templates files. Clear templates folder and start the App again.", "exclamation", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); msgbox.ShowDialog(); Application.Exit(); return; } } if (Directory.EnumerateFiles(state.libraryPath, "*.dll").Count() > 0) { try { FileSystem.Kill(string.Format("{0}", state.libraryPath + "*.dll")); } catch (Exception ex) { messageBoxForm msgbox; msgbox = new messageBoxForm("Unable do delete dll files. Clear dll files in library folder and start the App again.", "exclamation", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); msgbox.ShowDialog(); taskManager.unload(); Application.Exit(); return; } } getFiles = new HttpDataFilesDownload(state); getFiles.initialize(); // add DLLS to queue for (int j = 0, loopTo2 = dynamicAssembliesToLoad.Count - 1; j <= loopTo2; j++) { var vars = new Dictionary <string, string>(); vars.Add("task", "1100"); vars.Add("file", dynamicAssembliesToLoad.ElementAt(j)); getFiles.loadQueue(vars, null, state.libraryPath); } // add templates to queue if (state.authorizedFileTemplates is object) { var templates = state.authorizedFileTemplates; for (int j = 0, loopTo3 = templates.Count - 1; j <= loopTo3; j++) { var vars = new Dictionary <string, string>(); vars.Add("task", "1050"); vars.Add("file", templates.ElementAt(j).Key); getFiles.loadQueue(vars, null, state.templatesPath); } } getFiles.startRequest(); }
private void loadingForm_shown(global::System.Object sender, EventArgs e) { FileInfo setupFile; setupFile = new FileInfo(Path.Combine(enVars.libraryPath, "custom.eon")); setupFile.Refresh(); // LOAD SETUP FILE if (setupFile.Exists & enVars.customization.hasSetup) { // TODO // LOAD SETUP FILE } if (!enVars.customization.expireDate.Equals("")) { var today = new MonthCalendar(); var oneYear = new MonthCalendar(); oneYear.SetDate(DateTime.ParseExact(enVars.customization.expireDate, "dd/MM/yyyy", System.Globalization.DateTimeFormatInfo.InvariantInfo)); if (today.TodayDate > oneYear.SelectionStart) // APP EXPIRE DATE OVERDUE { messageBoxForm msgbox; msgbox = new messageBoxForm("You need to download and install the lastest version of the program at " + enVars.customization.websiteToLoadProgram, "exclamation", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); msgbox.ShowDialog(); Application.Exit(); return; } } // check if local settings files exists FileInfo settingsFile; settingsFile = new FileInfo(Path.Combine(enVars.libraryPath, "settings.eon")); settingsFile.Refresh(); if (enVars.customization.hasLocalSettings & settingsFile.Exists) { // 'DEFINE TASKS TO DO { var withBlock = taskManager; withBlock.registerTask("loadLocalSettings", AeonLabs.tasksManager.tasksManagerClass.TO_START); if (enVars.checkForUpdatesIsEnabled & enVars.userSettings.checkForUpdatesIsEnabled) { withBlock.registerTask("checkUpdates", AeonLabs.tasksManager.tasksManagerClass.TO_START); } withBlock.registerTask("checkPackages", AeonLabs.tasksManager.tasksManagerClass.TO_START); } taskManager.startListening(); // LOAD LOCAL SETTINGS loadLocalSettings(); if (enVars.checkForUpdatesIsEnabled & enVars.userSettings.checkForUpdatesIsEnabled) { // CHECK CORE FILES UPDATES var dlVars = enVars; dlVars.ApiServerAddrPath = enVars.customization.updateServerAddr; getUpdates = new AeonLabs.Network.HttpDataPostData(dlVars); getUpdates.initialize(); // add DLLS to queue var vars = new Dictionary <string, string>(); vars.Add("task", "update"); getUpdates.loadQueue(vars, default, default);
private void getSecretHttp_dataarrived(object sender, string responseData, Dictionary <string, string> msic) { if (!IsResponseOk(responseData)) { translations.load("messagebox"); msgbox = new messageBoxForm(GetMessage(responseData), translations.getText("warning"), MessageBoxButtons.RetryCancel, MessageBoxIcon.Information); BringToFront(); Application.DoEvents(); if (msgbox.ShowDialog == DialogResult.Retry) { SaveSettingsOwnExisting(); return; } else { translations.load("setupWizard"); string message = translations.getText("cannotContinue"); translations.load("messagebox"); msgbox = new messageBoxForm(message, translations.getText("information"), MessageBoxButtons.OK, MessageBoxIcon.Information); BringToFront(); Application.DoEvents(); msgbox.ShowDialog(); Application.Exit(); return; } } try { var data = JsonConvert.DeserializeObject <Dictionary <string, object> >(responseData); if (data.ContainsKey("key")) { mainform.settings.ApiEncryptionKey = data["key"].ToString(); } else { translations.load("errorMessages"); string message = translations.getText("errorLoadingDataFile") + ". " + translations.getText("contactEnterpriseSupport"); translations.load("messagebox"); msgbox = new messageBoxForm(message, translations.getText("warning"), MessageBoxButtons.OK, MessageBoxIcon.Information); BringToFront(); Application.DoEvents(); msgbox.ShowDialog(); Application.Exit(); return; } } catch (Exception e) { translations.load("errorMessages"); string message = translations.getText("errorLoadingDataFile") + ". " + translations.getText("contactEnterpriseSupport"); translations.load("messagebox"); msgbox = new messageBoxForm(message, translations.getText("warning"), MessageBoxButtons.OK, MessageBoxIcon.Information); BringToFront(); Application.DoEvents(); msgbox.ShowDialog(); Application.Exit(); return; } ProgressBar.Value = 33; progressValueTop = 66; // REGISTER COMPUTER programID ON DB registerComputerPIDonDB(); }