Exemplo n.º 1
0
 private void mnuDeviceInfo_Click(object sender, EventArgs e)
 {
     try
     {
         txtInfo.Text = string.Empty;
         txtInfo.Text = string.Format("Device ID: {0}", DeviceConfigManager.GetDeviceId());
     }
     catch (Exception ex)
     {
         ExceptionHandler.HandleException(ex, true, true);
     }
 }
        private void mnuLog_Click(object sender, EventArgs e)
        {
            string originalStatus = statusMain.Text;

            try
            {
                if (string.IsNullOrEmpty(txtFunction.Text))
                {
                    txtFunction.Focus();
                    UIHelper.DisplayError("Function not entered.");
                    return;
                }
                ServiceFunctionResultOfDeviceConfigAction result = null;
                using (WaitCursor w = new WaitCursor())
                {
                    statusMain.Text = "Logging action to server ...";
                    string deviceId        = DeviceConfigManager.GetDeviceId();
                    string applicationName = Path.GetFileName(Assembly.GetExecutingAssembly().GetName().CodeBase);
                    result = DeviceConfigOptions.Instance.Service.LogDeviceConfigAction(
                        txtFunction.Text,
                        deviceId,
                        applicationName,
                        string.IsNullOrEmpty(txtTag.Text) ? null : txtTag.Text);
                }
                if (ServiceResultHandler.HandleServiceResult(result))
                {
                    return;
                }
                UIHelper.DisplayInformation("Device Action logged successfully.");
            }
            catch (Exception ex)
            {
                ExceptionHandler.HandleException(ex, true, true);
            }
            finally
            {
                statusMain.Text = originalStatus;
            }
        }
Exemplo n.º 3
0
        private void mnuGetDeviceConfig_Click(object sender, EventArgs e)
        {
            string originalStatus = statusMain.Text;

            try
            {
                using (WaitCursor w = new WaitCursor())
                {
                    statusMain.Text = "Getting device configuration ...";
                    Application.DoEvents();
                    string applicationName = Path.GetFileName(Assembly.GetExecutingAssembly().GetName().CodeBase);
                    DeviceConfigManager.GetDeviceConfig(applicationName);
                    UIHelper.DisplayInformation("Configuration downloaded successfully!");
                }
            }
            catch (Exception ex)
            {
                ExceptionHandler.HandleException(ex, true, true);
            }
            finally
            {
                statusMain.Text = originalStatus;
            }
        }