private void Configuration_Load(object sender, EventArgs e) { this.MaximizeBox = false; this.MinimizeBox = false; this.StartPosition = FormStartPosition.Manual; int x = GetScreen().Width - (this.Width + 20); int y = GetScreen().Height - (this.Height + 80); this.Location = this.PointToScreen(new Point(x, y)); this.KeyPreview = true; try { RegistryHandle reg = new RegistryHandle(); RegistryHandle.Configuration config = reg.ReadConfig(); txtEventName.Text = config.EventName; txtInstallation.Text = config.Installation; txtQueueType.Text = config.QueueOptions; txtQueueNumber.Text = config.QueueNumber.ToString(); txtExecution.Text = config.Execution; txtLocation.Text = config.Location; txtOtherEvent.Text = config.OtherEvent; txtUseReader.Text = config.UseReader.ToString(); } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
private void Configuration_FormClosing(object sender, FormClosingEventArgs e) { try { RegistryHandle reg = new RegistryHandle(); RegistryHandle.Configuration config = null; int QueueNum; bool UseReader; config = new RegistryHandle.Configuration(txtEventName.Text, txtInstallation.Text, txtQueueType.Text, txtExecution.Text, int.TryParse(txtQueueNumber.Text, out QueueNum) ? QueueNum : 1, txtLocation.Text, txtOtherEvent.Text, Boolean.TryParse(txtUseReader.Text, out UseReader) ? UseReader : false); reg.WriteConfig(config); } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
//Process button private void ViewOptions(string ID) { string message = string.Empty; RegistryHandle reg = new RegistryHandle(); RegistryHandle.Configuration config = reg.ReadConfig(); if (config.EventName == string.Empty) { MessageBox.Show("No configuration setup"); this.Close(); return; } /* * if (!CheckRouting(config.Installation, config.EventName)) * { * MessageBox.Show("Routing is incorrect."); * this.Close(); * return; * } */ message = string.Format("<Message><CUMS_AuthorityRFID><SEL_ID>{0}</SEL_ID><STATION_NAME>{1}</STATION_NAME>" + "<LOCAL_USER>{2}</LOCAL_USER><TIME_STAMP>{3}</TIME_STAMP><LOCATION>{4}</LOCATION>" + "<OTHER_EVENT>{5}</OTHER_EVENT></CUMS_AuthorityRFID></Message>", ID, Environment.MachineName, Environment.UserName, DateTime.Now, config.Location, config.OtherEvent); if (clsClarifi.CheckAgentStatus() != clsClarifi.AgentStatus.Started && message != String.Empty) { MessageBox.Show("Clarif-i Agent Stopped"); this.Close(); return; } else { clsClarifi.TriggerAgent(config.EventName, config.Installation, message, config.Execution, config.QueueOptions, config.QueueNumber); this.Close(); return; } }