Exemplo n.º 1
0
        private void submitInit_Click(object sender, EventArgs e)
        {
            // Validating Input
            if (String.IsNullOrEmpty(this.initUnitId.Text))
            {
                lblUnitId.ForeColor = System.Drawing.Color.Red;
                return;
            }

            // Setting Values
            int interval = 0;

            // If the interval is in seconds
            if (this.unitTime.SelectedIndex == 0)
            {
                interval = Convert.ToInt32(this.initRate.Value);
            }

            // If the interval is in minutes
            if (this.unitTime.SelectedIndex == 1)
            {
                interval = Convert.ToInt32(this.initRate.Value * 60);
            }

            PinPointConfig.UnitID              = initUnitId.Text;
            PinPointConfig.UnitType            = PinPointConstants.NIEM_TYPES[this.initUnitType.SelectedIndex];
            PinPointConfig.PostIntervalSeconds = interval;
            PinPointConfig.SaveSettings();

            // Hiding settings pane and re-enabling options
            initConfigGroup.Visible          = false;
            optionsToolStripMenuItem.Enabled = true;
            initializeGPS();
        }
Exemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(this.newId))
            {
                string            messageBoxText = "All Unit Settings need to be completed.";
                string            caption        = "Setting";
                MessageBoxButtons button         = MessageBoxButtons.OK;
                MessageBoxIcon    icon           = MessageBoxIcon.Warning;
                MessageBox.Show(messageBoxText, caption, button, icon);
                return;
            }

            PinPointConfig.UnitID = this.newId;
            PinPointConfig.PostIntervalSeconds = this.newRate;
            PinPointConfig.UnitType            = this.newType;
            PinPointConfig.SaveSettings();
            Close();
        }