예제 #1
0
        private void btnApply_Click(object sender, EventArgs e)
        {
            mainForm mainform = new mainForm();

            SendDataConfig = new sendDataConfig(mainform.getDataConfig);
            ReportingType none = ReportingType.None;

            if (this.chbRssi.Checked)
            {
                none |= ReportingType.RSSI;
            }
            if (!this.chbChecksum.Checked)
            {
                none |= ReportingType.Checksum;
            }
            if (this.chbRealtime.Checked)
            {
                none |= ReportingType.ReadTime;
            }
            //  this.reader.SetReportingType(none);
            if (this.chbBeep.Checked)
            {
                reader.SetBuzzer(true);
            }
            if (this.chbBeep.Checked == false)
            {
                reader.SetBuzzer(false);
            }
        }
예제 #2
0
        /// <summary>
        /// Traverses the message.
        /// </summary>
        /// <param name="member">The member.</param>
        /// <param name="reportingType">Type of the reporting.</param>
        /// <param name="concat">The concat.</param>
        /// <param name="indent">The indent.</param>
        private static void TraverseMessage(IMessageMember member, ReportingType reportingType, ref StringBuilder concat, ref int indent)
        {
            StringBuilder memberConcat = new StringBuilder();
            string        name         = member.Name;
            object        value        = null;

            if (indent > 0)
            {
                memberConcat.AppendFormat("|{0}", Environment.NewLine);
                memberConcat.AppendFormat("{0}", "+" + new String('-', indent));
            }

            memberConcat.AppendFormat("{0}", Acronyms.BuildPhrase(name));

            if (member.HasValue)
            {
                value = member.GetValue();

                if (null != value)
                {
                    string strValue = String.Format("{0}", value);
                    // verify if value has a description
                    string meaning = Enumerations.GetMeaning(strValue);
                    if (null != meaning)
                    {
                        memberConcat.AppendFormat(" : {0} ({1}){2}", strValue, meaning, Environment.NewLine);
                    }
                    else
                    {
                        memberConcat.AppendFormat(" : {0}{1}", strValue, Environment.NewLine);
                    }
                }
                else
                {
                    memberConcat.AppendFormat("{0}", Environment.NewLine);
                }
            }
            else
            {
                memberConcat.AppendFormat("{0}", Environment.NewLine);
            }

            string line = memberConcat.ToString();

            if (!line.EndsWith("(NULL)" + Environment.NewLine))
            {
                concat.Append(line);
            }

            if (member.HasChildren)
            {
                indent++;
                foreach (IMessageMember child in member.GetChildren())
                {
                    TraverseMessage(child, reportingType, ref concat, ref indent);
                }
                indent--;
            }
        }
예제 #3
0
        /// <summary>
        /// Report a message object in plain text ou html.
        /// <remarks>TODO: xml report</remarks>
        /// </summary>
        /// <param name="instance">The message instance to report.</param>
        /// <param name="reportingType">The reporting type.</param>
        /// <returns>The report.</returns>
        public static string Report(object instance, ReportingType reportingType)
        {
            if (null == instance)
            {
                throw new InvalidOperationException("Error: the message object instance could not be null!");
            }

            StringBuilder concat = new StringBuilder();

            string messageType        = Messages.InferMessageType(instance);
            string messageDescription = Messages.GetMessage(messageType).ToString();

            concat.AppendFormat("{0}{1}", messageDescription, Environment.NewLine);

            List <IMessageMember> list = MessageReporter.GetMembers(instance);
            int indent = 0;

            foreach (IMessageMember member in list)
            {
                TraverseMessage(member, reportingType, ref concat, ref indent);
            }

            return(concat.ToString());
        }
예제 #4
0
 public ReportingService(ReportingType reportingType)
 {
     ReportingType = reportingType;
 }
        /// <summary>
        /// Adds report to the list of report used for reporting purposes.
        /// </summary>
        /// <param name="_reportType">The type of report that needs to be created</param>
        public void CreateReport(ReportingType _reportType)
        {
            switch (_reportType)
            {
            case ReportingType.KpaOverall:
                // Create the KPA Overall Report
                try
                {
                    reports.Add(_reportType, KpaOverallReport.KpaOverallReportInstance);
                }
                catch (ArgumentNullException)
                {
                    MessageBox.Show("Argumment Null Exception was thrown.", "KPA Report Creation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                catch (ArgumentException)
                {
                    // Create a new instance of a KPA Overall Report
                    KpaOverallReport.CreateNewInstance();

                    // Assign that instance to the list of reports
                    reports[ReportingType.KpaOverall] = KpaOverallReport.KpaOverallReportInstance;
                }
                break;

            case ReportingType.KpiOverall:
                // Create the KPI Overall Report
                try
                {
                    reports.Add(_reportType, KpiOverallReport.KpiOverallReportInstance);
                }
                catch (ArgumentNullException)
                {
                    MessageBox.Show("Argumment Null Exception was thrown.", "KPI Report Creation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                catch (ArgumentException)
                {
                    // Create a new instance of a KPI Overall Report
                    KpiOverallReport.CreateNewInstance();

                    // Assign that instance to the list of reports
                    reports[ReportingType.KpiOverall] = KpiOverallReport.KpiOverallReportInstance;
                }
                break;

            case ReportingType.KpaComparisonReport:
                // Create the KPA Report
                try
                {
                    reports.Add(_reportType, KpaComparisonReport.KpaComparisonReportInstance);
                }
                catch (ArgumentNullException)
                {
                    MessageBox.Show("Argumment Null Exception was thrown.", "KPA Comparison Report Creation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                catch (ArgumentException)
                {
                    // Create a new instance of a KPI Overall Report
                    KpaComparisonReport.CreateNewInstance();

                    // Assign that instance to the list of reports
                    reports[ReportingType.KpaComparisonReport] = KpaComparisonReport.KpaComparisonReportInstance;
                }
                break;

            case ReportingType.KpiComparisonReport:
                // Create the KPI Report
                try
                {
                    reports.Add(_reportType, KpiComparisonReport.KpiComparisonReportInstance);
                }
                catch (ArgumentNullException)
                {
                    MessageBox.Show("Argumment Null Exception was thrown.", "KPI Comparison Report Creation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                catch (ArgumentException)
                {
                    // Create a new instance of a KPI Overall Report
                    KpiComparisonReport.CreateNewInstance();

                    // Assign that instance to the list of reports
                    reports[ReportingType.KpiComparisonReport] = KpiComparisonReport.KpiComparisonReportInstance;
                }
                break;

            default:
                break;
            }
        }
예제 #6
0
 public static IReportingType GetWrapper(ReportingType src)
 {
     return(default(IReportingType));
 }
예제 #7
0
        /// <summary>
        /// Traverses the message.
        /// </summary>
        /// <param name="member">The member.</param>
        /// <param name="reportingType">Type of the reporting.</param>
        /// <param name="concat">The concat.</param>
        /// <param name="indent">The indent.</param>
        private static void TraverseMessage( IMessageMember member, ReportingType reportingType, ref StringBuilder concat, ref int indent )
        {

            StringBuilder memberConcat = new StringBuilder();
            string name = member.Name;
            object value = null;

            if (indent > 0)
            {
                memberConcat.AppendFormat( "|{0}", Environment.NewLine );
                memberConcat.AppendFormat( "{0}", "+" + new String( '-', indent ) );
            }

            memberConcat.AppendFormat( "{0}", Acronyms.BuildPhrase( name ) );

            if (member.HasValue)
            {
                value = member.GetValue();

                if (null != value)
                {
                    string strValue = String.Format("{0}", value);
                    // verify if value has a description
                    string meaning = Enumerations.GetMeaning(strValue);
                    if (null != meaning)
                    {
                        memberConcat.AppendFormat(" : {0} ({1}){2}", strValue, meaning, Environment.NewLine);
                    }
                    else
                    {
                        memberConcat.AppendFormat(" : {0}{1}", strValue, Environment.NewLine);
                    }
                }
                else
                {
                    memberConcat.AppendFormat( "{0}", Environment.NewLine );
                }
            }
            else
            {
                memberConcat.AppendFormat( "{0}", Environment.NewLine );
            }

            string line = memberConcat.ToString();
            if (!line.EndsWith( "(NULL)" + Environment.NewLine ))
            {
                concat.Append( line );
            }

            if (member.HasChildren)
            {
                indent++;
                foreach (IMessageMember child in member.GetChildren())
                {
                    TraverseMessage( child, reportingType, ref concat, ref indent );
                }
                indent--;
            }

        }
예제 #8
0
        /// <summary>
        /// Report a message object in plain text ou html.
        /// <remarks>TODO: xml report</remarks>
        /// </summary>
        /// <param name="instance">The message instance to report.</param>
        /// <param name="reportingType">The reporting type.</param>
        /// <returns>The report.</returns>
        public static string Report( object instance, ReportingType reportingType )
        {
            if (null == instance)
            {
                throw new InvalidOperationException("Error: the message object instance could not be null!");
            }

            StringBuilder concat = new StringBuilder();

            string messageType = Messages.InferMessageType(instance);
            string messageDescription = Messages.GetMessage(messageType).ToString();

            concat.AppendFormat("{0}{1}", messageDescription, Environment.NewLine);

            List<IMessageMember> list = MessageReporter.GetMembers( instance );
            int indent = 0;

            foreach (IMessageMember member in list)
            {
                TraverseMessage( member, reportingType, ref concat, ref indent );
            }

            return concat.ToString();
        }