Ejemplo n.º 1
0
 public void UpdateDownloadStatus(OmApi.OM_DOWNLOAD_STATUS status, int value)
 {
     downloadStatus = status;
     downloadValue = value;
     hasChanged = true;
     om.OnChanged(new OmDeviceEventArgs(this, status));
 }
Ejemplo n.º 2
0
        // /*OmDevice*/ public delegate void OmDeviceDownloadCompleteCallback(ushort id, OmApi.OM_DOWNLOAD_STATUS status, string filename);
        public void DownloadCompleteCallback(ushort id, OmApi.OM_DOWNLOAD_STATUS status, string filename)
        {
            string timeNow, type;

            timeNow = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            type = "DOWNLOAD-OK";

            string logLine = "" + timeNow + "," + type + "," + Path.GetFileName(filename);

            if (downloadDumpFile != null)
            {
                for (; ; )  // [dump]
                {
                    string errorMessage = "Problem while appending to download log file (" + downloadDumpFile + ") - check the folder exists, you have write permission, and the file is not locked open by another process.";

                    try
                    {
                        StreamWriter sw = File.AppendText(downloadDumpFile);
                        sw.WriteLine(logLine);
                        sw.Close();
                        break;
                    }
                    catch (Exception ex)
                    {
                        errorMessage = errorMessage + "\r\n\r\nDetails: " + ex.Message + "";
                        Console.WriteLine("Warning: " + errorMessage);
                    }

                    DialogResult ddr = MessageBox.Show(null, errorMessage, "Warning", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
                    if (ddr != System.Windows.Forms.DialogResult.Retry) { break; }
                }
            }
        }
Ejemplo n.º 3
0
 public bool SetLed(OmApi.OM_LED_STATE state)
 {
     ledColor = state;
     if (OmApi.OM_FAILED(OmApi.OmSetLed(deviceId, (int)ledColor)))
     {
         return false;
     }
     hasChanged = true;
     om.OnChanged(new OmDeviceEventArgs(this));
     return true;
 }