Пример #1
0
        /// <summary>
        /// Create a new OCPP reset response.
        /// </summary>
        /// <param name="Status">The success or failure of the reset command.</param>
        public ResetResponse(ResetStatus Status)

            : base(Result.OK())

        {
            this.Status = Status;
        }
Пример #2
0
        /// <summary>
        /// Create a new reset response.
        /// </summary>
        /// <param name="Request">The start transaction request leading to this response.</param>
        /// <param name="Status">The success or failure of the reset command.</param>
        public ResetResponse(CS.ResetRequest Request,
                             ResetStatus Status)

            : base(Request,
                   Result.OK())

        {
            this.Status = Status;
        }
Пример #3
0
        private void TestButton_Click(object sender, RoutedEventArgs e)
        {
            Func <string, string> strip = i => Regex.Replace(i, "[\r\n \t]+", "").Trim();

            if (ResetStatus != null)
            {
                ResetStatus.Stop();
            }
            ThreadPool.QueueUserWorkItem((h) =>
            {
                CompileCSharp(false);
                CompileD();

                if (strip(CSharpOutput ?? "") == strip(CppOutput ?? ""))
                {
                    Dispatcher.Invoke(() =>
                    {
                        TestStatus.Content    = "PASSED";
                        TestStatus.Background =
                            new SolidColorBrush(System.Windows.Media.Color.FromRgb(Color.GreenYellow.R,
                                                                                   Color.GreenYellow.G, Color.GreenYellow.B));

                        ViewModel.CompilerErrors = String.Format("Test Passed:\n\nCSharpOutput:\n{0}DlangOutPut:\n{1}",
                                                                 CSharpOutput, CppOutput);
                    });
                }
                else
                {
                    Dispatcher.Invoke(() =>
                    {
                        TestStatus.Content    = "FAILED";
                        TestStatus.Background =
                            new SolidColorBrush(System.Windows.Media.Color.FromRgb(Color.Red.R, Color.Red.G, Color.Red.B));
                        ViewModel.CompilerErrors = "Test Failed\n" + ViewModel.CompilerErrors;
                    });
                }
                if (ResetStatus == null)
                {
                    ResetStatus           = new Timer(2000);
                    ResetStatus.AutoReset = false;
                    ResetStatus.Elapsed  += (o, args) => Dispatcher.Invoke(() =>
                    {
                        TestStatus.Content    = "TEST STATUS";
                        TestStatus.Background =
                            new SolidColorBrush(System.Windows.Media.Color.FromRgb(Color.White.R, Color.White.G,
                                                                                   Color.White.B));
                    });
                }
                ResetStatus.Start();
            });
        }
Пример #4
0
        public static String AsText(this ResetStatus ResetStatus)
        {
            switch (ResetStatus)
            {
            case ResetStatus.Accepted:
                return("Accepted");

            case ResetStatus.Rejected:
                return("Rejected");


            default:
                return("unknown");
            }
        }
Пример #5
0
        /// <summary>
        /// Generate the necessary parameters
        /// </summary>
        public List <KeyValuePair <string, string> > GetParams()
        {
            var p = new List <KeyValuePair <string, string> >();

            if (UniqueName != null)
            {
                p.Add(new KeyValuePair <string, string>("UniqueName", UniqueName));
            }

            if (CallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("CallbackMethod", CallbackMethod.ToString()));
            }

            if (CallbackUrl != null)
            {
                p.Add(new KeyValuePair <string, string>("CallbackUrl", Serializers.Url(CallbackUrl)));
            }

            if (FriendlyName != null)
            {
                p.Add(new KeyValuePair <string, string>("FriendlyName", FriendlyName));
            }

            if (RatePlan != null)
            {
                p.Add(new KeyValuePair <string, string>("RatePlan", RatePlan.ToString()));
            }

            if (Status != null)
            {
                p.Add(new KeyValuePair <string, string>("Status", Status.ToString()));
            }

            if (CommandsCallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("CommandsCallbackMethod", CommandsCallbackMethod.ToString()));
            }

            if (CommandsCallbackUrl != null)
            {
                p.Add(new KeyValuePair <string, string>("CommandsCallbackUrl", Serializers.Url(CommandsCallbackUrl)));
            }

            if (SmsFallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("SmsFallbackMethod", SmsFallbackMethod.ToString()));
            }

            if (SmsFallbackUrl != null)
            {
                p.Add(new KeyValuePair <string, string>("SmsFallbackUrl", Serializers.Url(SmsFallbackUrl)));
            }

            if (SmsMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("SmsMethod", SmsMethod.ToString()));
            }

            if (SmsUrl != null)
            {
                p.Add(new KeyValuePair <string, string>("SmsUrl", Serializers.Url(SmsUrl)));
            }

            if (VoiceFallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("VoiceFallbackMethod", VoiceFallbackMethod.ToString()));
            }

            if (VoiceFallbackUrl != null)
            {
                p.Add(new KeyValuePair <string, string>("VoiceFallbackUrl", Serializers.Url(VoiceFallbackUrl)));
            }

            if (VoiceMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("VoiceMethod", VoiceMethod.ToString()));
            }

            if (VoiceUrl != null)
            {
                p.Add(new KeyValuePair <string, string>("VoiceUrl", Serializers.Url(VoiceUrl)));
            }

            if (ResetStatus != null)
            {
                p.Add(new KeyValuePair <string, string>("ResetStatus", ResetStatus.ToString()));
            }

            if (AccountSid != null)
            {
                p.Add(new KeyValuePair <string, string>("AccountSid", AccountSid.ToString()));
            }

            return(p);
        }