private void SetupFunctionDropdown() { repositoryItemImageComboBox1.Items.Clear(); AnalogInputConfiguration obj; for (int i = 1; i <= 30; i++) { obj = Session.DefaultSession.FindObject<AnalogInputConfiguration>(CriteriaOperator.Parse("[CardSerial] == ? AND [CardRevision] == ? AND [CardModel] == ? AND [Input] == ?", _CardSerialNumber, _CardRevision, _CardModel, i)); ImageComboBoxItem item; string ButtonDescription = obj.InputName; item = new ImageComboBoxItem { Description = string.Format("Input {0} Button On ({1})", i, ButtonDescription), Value = i + "|down", ImageIndex = 6 }; repositoryItemImageComboBox1.Items.Add(item); item = new ImageComboBoxItem { Description = string.Format("Input {0} Button Off ({1})", i, ButtonDescription), Value = i + "|up", ImageIndex = 5 }; repositoryItemImageComboBox1.Items.Add(item); } ilFunction.EditValue = "1|down"; }
private void frmSST30IA_Load(object sender, EventArgs e) { // Set Code Box... fastColoredTextBox1.Language = Language.VB; // Load Card Details obj = Session.DefaultSession.FindObject<Cards>(CriteriaOperator.Parse("[CardSerialNumber] == ? AND [CardModel] == ? AND [CardRevision] == ?", _CardSerialNumber, _CardModel, _CardRevision)); Text = obj.CardName; // Card Details LogEvent("Card Model Number: " + _CardModel, "X001", clsEventLogType.EventLogType.Info); LogEvent("Card Revision: " + _CardRevision, "X002", clsEventLogType.EventLogType.Info); LogEvent("Card Serial Number: " + _CardSerialNumber, "X003", clsEventLogType.EventLogType.Info); // Check to see if the card details exist in the database XPView CardDetails = new XPView(Session.DefaultSession, typeof(Database.AnalogInputConfiguration)); CardDetails.AddProperty("Serial", "CardSerial"); CardDetails.Criteria = CriteriaOperator.Parse(String.Format("[CardRevision] = '{0}' And [CardModel] = '{1}' And [CardSerial] == {2}", _CardRevision, _CardModel, _CardSerialNumber), null); bool CardAdded; if (CardDetails.Count > 0) CardAdded = true; else CardAdded = false; if (!CardAdded) { for (int i = 1; i <= 30; i++) { Database.AnalogInputConfiguration dbConfiguration = new Database.AnalogInputConfiguration(); dbConfiguration.Input = i; dbConfiguration.InputName = "Input #" + i; dbConfiguration.InputStatus = false; dbConfiguration.CodeButtonUp = ""; dbConfiguration.CodeButtonDown = ""; dbConfiguration.CardSerial = _CardSerialNumber; dbConfiguration.CardRevision = _CardRevision; dbConfiguration.CardModel = _CardModel; dbConfiguration.Save(); } } xpCollectionCardInfo.Criteria = CriteriaOperator.Parse(String.Format("[CardModel] = '{0}' And [CardRevision] = '{1}' And [CardSerialNumber] = {2}", _CardModel, _CardRevision, _CardSerialNumber), null); xpCollectionConfiguration.Criteria = CriteriaOperator.Parse(String.Format("[CardRevision] = '{0}' And [CardModel] = '{1}' And [CardSerial] = {2}", _CardRevision, _CardModel, _CardSerialNumber), null); // Setup Code Dropdown SetupFunctionDropdown(); // Setup Group Control Boxes gcCardConfiguration.Dock = DockStyle.Fill; gcCardSettings.Dock = DockStyle.Fill; gcDebugLog.Dock = DockStyle.Fill; gcInputScripts.Dock = DockStyle.Fill; // Hide Group Control Boxes gcCardConfiguration.Visible = false; gcDebugLog.Visible = false; gcInputScripts.Visible = false; // Enable Timers tmrInputConfigRefresh.Enabled = true; tmrCheckUSB.Enabled = true; tmrCheckFormDetails.Enabled = true; // Set Form Details objCardsDB = Session.DefaultSession.FindObject<Cards>(CriteriaOperator.Parse("[CardSerialNumber] == ? AND [CardModel] == ? AND [CardRevision] == ?", _CardSerialNumber, _CardModel, _CardRevision)); DataBindings.Add("Text", objCardsDB, "CardName"); chkUSBConnected.DataBindings.Add("Text", objCardsDB, "CardConnected"); }
private void bbtnFactoryReset_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e) { if (XtraMessageBox.Show("Are you sure you wish to perform a factory reset on this card? It will clear out all data.", "Factory Reset", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.No) return; // Clear all data AnalogInputConfiguration obj; for (int i = 1; i <= 30; i++) { obj = Session.DefaultSession.FindObject<AnalogInputConfiguration>(CriteriaOperator.Parse("[CardSerial] == ? AND [CardRevision] == ? AND [CardModel] == ? AND [Input] == ?", _CardSerialNumber, _CardRevision, _CardModel, i)); obj.InputDescription = ""; obj.InputEnabled = false; obj.InputName = "Input #" + i; obj.CodeButtonDown = ""; obj.CodeButtonUp = ""; obj.Save(); } Cards obj2 = Session.DefaultSession.FindObject<Cards>(CriteriaOperator.Parse("[CardModel] == ? AND [CardRevision] == ? AND [CardSerialNumber] ==?", _CardModel, _CardRevision, _CardSerialNumber)); obj2.CardName = String.Format("{0}{1} [{2}]", _CardModel, _CardRevision, _CardSerialNumber); obj2.CardDescription = ""; obj2.Save(); // Reset dropdown... SetupFunctionDropdown(); // Reset Code Box fastColoredTextBox1.Text = ""; }
private void frmEditCardDetails_Load(object sender, EventArgs e) { switch (_DialogType) { case clsEditCardDetailsDialogType.DialogType.CardEdit: objCards = Session.DefaultSession.FindObject<Cards>(CriteriaOperator.Parse("[CardSerialNumber] == ? AND [CardModel] == ? AND [CardRevision] == ?", _CardSerial, _CardModel, _CardRevision)); tbName.DataBindings.Add("Text", objCards, "CardName"); tbDescription.DataBindings.Add("Text", objCards, "CardDescription"); lblName.Text = "Card Name:"; lblDescription.Text = "Card Description:"; break; case clsEditCardDetailsDialogType.DialogType.InputEdit: objSST30IC = Session.DefaultSession.FindObject<AnalogInputConfiguration>(CriteriaOperator.Parse("[CardSerial] == ? AND [CardRevision] == ? AND [Input] == ?", _CardSerial, _CardRevision, _Input)); tbName.DataBindings.Add("Text", objSST30IC, "InputName"); tbDescription.DataBindings.Add("Text", objSST30IC, "InputDescription"); lblName.Text = "Input Name:"; lblDescription.Text = "Input Description:"; break; } tbName.Select(); }
private void frmSSTPSUA_Load(object sender, EventArgs e) { // Load Card Details obj = Session.DefaultSession.FindObject<Cards>(CriteriaOperator.Parse("[CardSerialNumber] == ? AND [CardModel] == ? AND [CardRevision] == ?", _CardSerialNumber, _CardModel, _CardRevision)); Text = obj.CardName; // Card Details LogEvent("Card Model Number: " + _CardModel, "X001", clsEventLogType.EventLogType.Info); LogEvent("Card Revision: " + _CardRevision, "X002", clsEventLogType.EventLogType.Info); LogEvent("Card Serial Number: " + _CardSerialNumber, "X003", clsEventLogType.EventLogType.Info); xpCollectionCardInfo.Criteria = CriteriaOperator.Parse(String.Format("[CardModel] = '{0}' And [CardRevision] = '{1}' And [CardSerialNumber] = {2}", _CardModel, _CardRevision, _CardSerialNumber), null); // Setup Group Control Boxes gcCardConfiguration.Dock = DockStyle.Fill; gcCardSettings.Dock = DockStyle.Fill; gcDebugLog.Dock = DockStyle.Fill; // Hide Group Control Boxes gcCardConfiguration.Visible = false; gcDebugLog.Visible = false; // Enable Timers tmrCheckUSB.Enabled = true; tmrCheckFormDetails.Enabled = true; // Set Form Details objCardsDB = Session.DefaultSession.FindObject<Cards>(CriteriaOperator.Parse("[CardSerialNumber] == ? AND [CardModel] == ? AND [CardRevision] == ?", _CardSerialNumber, _CardModel, _CardRevision)); DataBindings.Add("Text", objCardsDB, "CardName"); chkUSBConnected.DataBindings.Add("Text", objCardsDB, "CardConnected"); }
private void frmSST24OA_Load(object sender, EventArgs e) { // Set Code Box... fastColoredTextBox1.Language = Language.VB; // Load Card Details obj = Session.DefaultSession.FindObject<Cards>(CriteriaOperator.Parse("[CardSerialNumber] == ? AND [CardModel] == ? AND [CardRevision] == ?", _CardSerialNumber, _CardModel, _CardRevision)); Text = obj.CardName; //lblCardDescription.Text = obj.CardDescription; // Card Details LogEvent("Card Model Number: " + _CardModel, "X001", clsEventLogType.EventLogType.Info); LogEvent("Card Revision: " + _CardRevision, "X002", clsEventLogType.EventLogType.Info); LogEvent("Card Serial Number: " + _CardSerialNumber, "X003", clsEventLogType.EventLogType.Info); // Check to see if the card details exist in the database XPView CardDetails = new XPView(Session.DefaultSession, typeof(Database.AnalogOutputConfiguration)); CardDetails.AddProperty("Serial", "CardSerial"); CardDetails.Criteria = CriteriaOperator.Parse(String.Format("[CardRevision] = '{0}' And [CardModel] = '{1}' And [CardSerial] == {2}", _CardRevision, _CardModel, _CardSerialNumber), null); bool CardAdded; if (CardDetails.Count > 0) CardAdded = true; else CardAdded = false; if (!CardAdded) { for (int i = 1; i <= 24; i++) { Database.AnalogOutputConfiguration dbConfiguration = new Database.AnalogOutputConfiguration(); dbConfiguration.Output = i; dbConfiguration.OutputName = "Output #" + i; dbConfiguration.OutputStatus = false; dbConfiguration.CardSerial = _CardSerialNumber; dbConfiguration.CardRevision = _CardRevision; dbConfiguration.CardModel = _CardModel; dbConfiguration.Save(); } } // Initilize Datatable _dtOutputs = new DataTable(); _dtOutputs.Columns.Add("output", typeof(int)); _dtOutputs.Columns.Add("value", typeof(bool)); DataRow row; for (int i = 1; i <= 24; i++) { row = _dtOutputs.NewRow(); row["output"] = i; row["value"] = false; _dtOutputs.Rows.Add(row); } _dtOffsets = new DataTable(); _dtOffsets.Columns.Add("offset", typeof(string)); _dtOffsets.Columns.Add("bytes", typeof(int)); _dtOffsets.Columns.Add("bit", typeof(int)); _dtOffsets.Columns.Add("value", typeof(int)); SetupScriptDatatable(); xpCollectionCardInfo.Criteria = CriteriaOperator.Parse(String.Format("[CardModel] = '{0}' And [CardRevision] = '{1}' And [CardSerialNumber] = {2}", _CardModel, _CardRevision, _CardSerialNumber), null); xpCollectionConfiguration.Criteria = CriteriaOperator.Parse(String.Format("[CardRevision] = '{0}' And [CardModel] = '{1}' And [CardSerial] = {2}", _CardRevision, _CardModel, _CardSerialNumber), null); // Setup Group Control Boxes gcCardConfiguration.Dock = DockStyle.Fill; gcCardSettings.Dock = DockStyle.Fill; gcDebugLog.Dock = DockStyle.Fill; gcScripts.Dock = DockStyle.Fill; // Hide Group Control Boxes gcCardConfiguration.Visible = false; gcDebugLog.Visible = false; gcScripts.Visible = false; // Set Form Details objCardsDB = Session.DefaultSession.FindObject<Cards>(CriteriaOperator.Parse("[CardSerialNumber] == ? AND [CardModel] == ? AND [CardRevision] == ?", _CardSerialNumber, _CardModel, _CardRevision)); DataBindings.Add("Text", objCardsDB, "CardName"); //lblCardDescription.DataBindings.Add("Text", objCardsDB, "CardDescription"); chkUSBConnected.DataBindings.Add("Text", objCardsDB, "CardConnected"); xpCollectionConfiguration.Load(); gridControl1.DataSource = xpCollectionConfiguration; gridControl1.ForceInitialize(); SetupScriptDropDown(); // Enable Timers //tmrInputConfigRefresh.Enabled = true; tmrCheckUSB.Enabled = true; tmrCheckFormDetails.Enabled = true; }