예제 #1
0
        public PinPointMain()
        {
            InitializeComponent();

            string currentUTCTime = DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffZ");

            log.Info(currentUTCTime + " >>> OnStart");

            // Init component values
            this.initUnitType.DataSource = PinPointConstants.UNIT_TYPES;
            this.unitTime.SelectedIndex  = 0;

            // Loading Config
            PinPointConfig.LoadSettings();
            if (PinPointConfig.DebugMode)
            {
                pushToolStripMenuItem.Visible = true;
            }
            else
            {
                pushToolStripMenuItem.Visible = false;
            }

            // If there are missing values, bring up settings overlay
            if (PinPointConfig.isInitSettingRequired())
            {
                initConfigGroup.Visible = true;
            }
            else
            {
                initializeGPS();
            }
        }
예제 #2
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();
        }
예제 #3
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();
        }