Beispiel #1
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            try
            {
                Log.instance().LogFolder = Properties.Settings.Default.LogFolder;

                propertyGrid1.SelectedObject = Properties.Settings.Default;

                logit(string.Format("OpenTrac Dashboard Starting. Version={0}", Application.ProductVersion));


                dgvaInboundOt  = new DataGridViewAssistant <TRANSACTION_INBOUND>(dgvInboundOt);
                dgvaOutboundOt = new DataGridViewAssistant <TRANSACTION_OUTBOUND>(dgvOutboundOt);
                dgvaKeyStore   = new DataGridViewAssistant <KeyStore>(dgvKeyStore);

                OtConnection  = Properties.Settings.Default.OpenTracConnection;
                SpcConnection = Properties.Settings.Default.SpcConnection;

                string explanation = "";
                OpentracMessage.ReadFromFile(Properties.Settings.Default.OpenTracMessagesPath, out otMessageList, out explanation);

                refreshViews(OtConnection, SpcConnection);

                timerSecond.Enabled = true;
            }
            catch (Exception ex)
            {
                logit(ex.ToString());
            }
        } // method
Beispiel #2
0
        /// <summary>
        /// Read in a file that defines
        /// </summary>
        /// <param name="filepath"></param>
        /// <param name="explanation"></param>
        /// <returns></returns>
        public static bool ReadFromFile(string filepath, out List <OpentracMessage> messageList, out string explanation)
        {
            explanation = "";
            messageList = new List <OpentracMessage>();
            try
            {
                string[] lines = File.ReadAllLines(filepath);
                foreach (string line in lines)
                {
                    OpentracMessage otm = new OpentracMessage();
                    otm.TableList = new List <string>();

                    string[] tokens = line.Split(',');
                    int      count  = 0;
                    foreach (string token in tokens)
                    {
                        if (count == 0)
                        {
                            otm.Code = token;
                        }
                        else
                        {
                            otm.TableList.Add(token);
                        }
                        count += 1;
                    } // for each token
                    messageList.Add(otm);
                }     // for each line
                return(true);
            }
            catch (Exception ex)
            {
                explanation = string.Format("File={0} Err={1}", filepath, ex.ToString());
                return(false);
            }
        } // method
Beispiel #3
0
        private void buttonOpentracCodeFetch_Click(object sender, EventArgs e)
        {
            try
            {
                OpentracMessage msg = otMessageList.Where(rr => rr.Code.ToUpper() == textOpenTracCode.Text.ToUpper()).First();
                if (msg == null)
                {
                    alert(string.Format("No tables for Code={0} found", msg.Code));
                    return;
                }

                string tables = "";
                foreach (string table in msg.TableList)
                {
                    tables += string.Format(",{0}", table);
                }
                tables = tables.Substring(1);
                textOpenTrackTablesToChange.Text = tables;
            }
            catch (Exception ex)
            {
                alert(ex.ToString());
            }
        }