예제 #1
0
        private void PopulateTheComboBoxes()
        {
            IReadCommand cmd        = new ReadCommand();
            string       statusText = "SELECT STATUSTEXT FROM STATUS";

            StatusComBox.DataSource = cmd.Execute(statusText);

            string streamText = "SELECT STREAMTEXT FROM STREAM";

            StreamComBox.DataSource = cmd.Execute(streamText);
        }
        public void ReturnAllUserPostsInPayloadWhenSuccessfullyExecuted()
        {
            var userRepository = new UserRepository();
            var user           = userRepository.RegisterUser("alice");

            user.Posts.AddRange(
                new List <Post> {
                new Post("test1"), new Post("test2")
            }
                );

            var arguments = new List <string>
            {
                "alice"
            };

            var readCommand = new ReadCommand()
            {
                Arguments      = arguments,
                UserRepository = userRepository
            };
            var commandResult = readCommand.Execute();

            Assert.That(commandResult.Payload.Count, Is.EqualTo(2));
            Assert.That(commandResult.Payload[0], Is.EqualTo("test1 (0 seconds ago)"));
            Assert.That(commandResult.Payload[1], Is.EqualTo("test2 (0 seconds ago)"));
        }
        public async Task WhenReadSourceToVhdDestinationThenReadDataIsIdentical()
        {
            // arrange
            var sourcePath              = $"{Guid.NewGuid()}.img";
            var destinationPath         = $"{Guid.NewGuid()}.vhd";
            var fakeCommandHelper       = new FakeCommandHelper(new [] { sourcePath });
            var cancellationTokenSource = new CancellationTokenSource();

            // assert: destination path vhd doesn't exist
            Assert.False(File.Exists(destinationPath));

            // act: read source img to destination vhd
            var readCommand = new ReadCommand(new NullLogger <ReadCommand>(), fakeCommandHelper, Enumerable.Empty <IPhysicalDrive>(), sourcePath, destinationPath);
            var result      = await readCommand.Execute(cancellationTokenSource.Token);

            Assert.True(result.IsSuccess);

            // get source bytes
            var sourceBytes = fakeCommandHelper.GetMedia(sourcePath).GetBytes();

            // get destination bytes from vhd
            var destinationBytes = await ReadMediaBytes(fakeCommandHelper, destinationPath, FakeCommandHelper.ImageSize);

            var destinationPathSize = new FileInfo(destinationPath).Length;

            // assert length is not the same (vhd file format different than img) and bytes are the same
            Assert.NotEqual(sourceBytes.Length, destinationPathSize);
            Assert.Equal(sourceBytes, destinationBytes);

            // delete destination path vhd
            File.Delete(destinationPath);
        }
        public async Task WhenReadSourceToImgDestinationThenReadDataIsIdentical()
        {
            // arrange
            var sourcePath              = $"{Guid.NewGuid()}.img";
            var destinationPath         = $"{Guid.NewGuid()}.img";
            var fakeCommandHelper       = new FakeCommandHelper(new [] { sourcePath }, new [] { destinationPath });
            var cancellationTokenSource = new CancellationTokenSource();

            // act - read source img to destination img
            var readCommand = new ReadCommand(new NullLogger <ReadCommand>(), fakeCommandHelper, new List <IPhysicalDrive>(), sourcePath, destinationPath);
            DataProcessedEventArgs dataProcessedEventArgs = null;

            readCommand.DataProcessed += (_, args) =>
            {
                dataProcessedEventArgs = args;
            };
            var result = await readCommand.Execute(cancellationTokenSource.Token);

            Assert.True(result.IsSuccess);

            Assert.NotNull(dataProcessedEventArgs);
            Assert.NotEqual(0, dataProcessedEventArgs.PercentComplete);
            Assert.NotEqual(0, dataProcessedEventArgs.BytesProcessed);
            Assert.Equal(0, dataProcessedEventArgs.BytesRemaining);
            Assert.NotEqual(0, dataProcessedEventArgs.BytesTotal);

            // assert data is identical
            var sourceBytes      = fakeCommandHelper.GetMedia(sourcePath).GetBytes();
            var destinationBytes = fakeCommandHelper.GetMedia(destinationPath).GetBytes();

            Assert.Equal(sourceBytes, destinationBytes);
        }
예제 #5
0
        public async ValueTask Handle(IBackgroundTaskContext context)
        {
            if (context.BackgroundTask is not ReadBackgroundTask readBackgroundTask)
            {
                return;
            }

            try
            {
                var physicalDrives = await physicalDriveManager.GetPhysicalDrives();

                var commandHelper = new CommandHelper();
                var readCommand   =
                    new ReadCommand(loggerFactory.CreateLogger <ReadCommand>(), commandHelper, physicalDrives,
                                    readBackgroundTask.SourcePath, readBackgroundTask.DestinationPath);
                readCommand.DataProcessed += async(_, args) =>
                {
                    await progressHubConnection.UpdateProgress(new Progress
                    {
                        Title               = readBackgroundTask.Title,
                        IsComplete          = false,
                        PercentComplete     = args.PercentComplete,
                        BytesProcessed      = args.BytesProcessed,
                        BytesRemaining      = args.BytesRemaining,
                        BytesTotal          = args.BytesTotal,
                        MillisecondsElapsed = args.PercentComplete > 0
                            ? (long)args.TimeElapsed.TotalMilliseconds
                            : new long?(),
                        MillisecondsRemaining = args.PercentComplete > 0
                            ? (long)args.TimeRemaining.TotalMilliseconds
                            : new long?(),
                        MillisecondsTotal = args.PercentComplete > 0
                            ? (long)args.TimeTotal.TotalMilliseconds
                            : new long?()
                    }, context.Token);
                };

                var result = await readCommand.Execute(context.Token);

                await progressHubConnection.UpdateProgress(new Progress
                {
                    Title           = readBackgroundTask.Title,
                    IsComplete      = true,
                    HasError        = result.IsFaulted,
                    ErrorMessage    = result.IsFaulted ? result.Error.Message : null,
                    PercentComplete = 100
                }, context.Token);
            }
            catch (Exception e)
            {
                await progressHubConnection.UpdateProgress(new Progress
                {
                    Title           = readBackgroundTask.Title,
                    IsComplete      = true,
                    HasError        = true,
                    ErrorMessage    = e.Message,
                    PercentComplete = 100
                }, context.Token);
            }
        }
예제 #6
0
        public void GivenAReadCommandWhenExecuteMethodIsCalledThenItCallsReadInTheCommandReceiver()
        {
            var command = new ReadCommand(this.receiver, BobUserHandle);

            command.Execute();

            this.receiver.Received().Read(BobUserHandle);
        }
예제 #7
0
        public void GivenAReadCommandWhenExecuteMethodIsCalledThenItStoresTheExecutionResultInResults()
        {
            var command = new ReadCommand(this.receiver, BobUserHandle);

            this.receiver.Read(BobUserHandle).Returns(new[] { new Message(null, PostMessageText) });

            command.Execute();

            ((IQueryCommand)command).Results.Should().Contain(m => m.Body == PostMessageText);
        }
예제 #8
0
        public List <string> Execute(string qry)
        {
            string        cmdString = "select Status.StatusText from Status";
            IReadCommand  cmd       = new ReadCommand();
            DataTable     dt        = cmd.Execute(cmdString);
            List <string> status    = new List <string>();

            status = (from row in dt.AsEnumerable() select Convert.ToString(row["STATUSTEXT"])).ToList();
            return(status);
        }
예제 #9
0
        public List<string> Execute(string qry)
        {
            string cmdString = "select Status.StatusText from Status";
            IReadCommand cmd = new ReadCommand();
            DataTable dt = cmd.Execute(cmdString);
            List<string> status = new List<string>();

            status = (from row in dt.AsEnumerable() select Convert.ToString(row["STATUSTEXT"])).ToList();
            return status;
        }
        public void ReturnAPayloadContainingAnErrorMessageOnUnsuccessfulExecution()
        {
            var arguments = new List <string>
            {
                "alice"
            };
            var emptyUserRepository = new UserRepository();

            var readCommand = new ReadCommand()
            {
                Arguments      = arguments,
                UserRepository = emptyUserRepository
            };
            var commandResult = readCommand.Execute();

            Assert.That(commandResult.Payload[0].StartsWith("System.NullReferenceException"));
        }
        public void SetCommandResultStatusToErrorOnUnsuccessfulExecution()
        {
            var arguments = new List <string>
            {
                "alice"
            };
            var emptyUserRepository = new UserRepository();

            var readCommand = new ReadCommand()
            {
                Arguments      = arguments,
                UserRepository = emptyUserRepository
            };
            var commandResult = readCommand.Execute();

            Assert.That(commandResult.Status, Is.EqualTo(CommandResponseStatus.Error));
        }
        public void SetCommandResultStatusToOkOnSuccessfulExecution()
        {
            var arguments = new List <string>
            {
                "alice"
            };
            var userRepository = new UserRepository();

            userRepository.RegisterUser("alice");

            var readCommand = new ReadCommand()
            {
                Arguments      = arguments,
                UserRepository = userRepository
            };
            var commandResult = readCommand.Execute();

            Assert.That(commandResult.Status, Is.EqualTo(CommandResponseStatus.Ok));
        }
예제 #13
0
        public async void ReadCommand_Execute()
        {
            // ARRANGE
            var user = "******";

            var arguments = new Dictionary <string, string>
            {
                { nameof(user), user }
            };

            var storage = new Mock <IStorageProvider>();
            var posts   = new Post[]
            {
                new Post {
                    Author = "andrea", Message = "message1", Time = new DateTime(1970, 1, 1, 0, 0, 1)
                },
                new Post {
                    Author = "andrea", Message = "message2", Time = new DateTime(1970, 1, 1, 0, 0, 2)
                },
                new Post {
                    Author = "andrea", Message = "message3", Time = new DateTime(1970, 1, 1, 0, 0, 3)
                }
            };

            storage.Setup(_ => _.GetMessagesByUser(user)).Returns(
                Task.FromResult <IEnumerable <Post> >(posts));

            var interaction = new Mock <IInteractionProvider>();
            var time        = new Mock <ITimeProvider>();
            var command     = new ReadCommand(storage.Object, interaction.Object, time.Object, arguments);

            // ACT
            await command.Execute();

            // ASSERT
            storage.Verify(_ => _.GetMessagesByUser(user));
            interaction.Verify(_ => _.Write(Resources.Message_ReadFormat, It.IsAny <string>(), It.IsAny <string>()), Times.Exactly(posts.Length));
        }
예제 #14
0
        public List<DbJob> Execute(string stream, string status, string location, string company, List<string> skills)
        {
            List<DbJob> finalJobs = new List<DbJob>();
            List<string> sortedJobs = new List<string>();

            // search based on stream, status, skills, company and location

            // get jobs with stream, status, loaction and company match
            string qry = "SELECT JOBPOST.job_id FROM JOBPOST JOIN STREAM ON JOBPOST.stream_id = STREAM.stream_id JOIN STATUS ON JOBPOST.status_id = STATUS.status_id WHERE statusText = '" + status + "' AND streamText = '" + stream + "' AND company = '" + company + "' AND location = '" + location + "'";

            IReadCommand read = new ReadCommand();
            DataTable dt = read.Execute(qry);
            List<string> jobs = (from row in dt.AsEnumerable() select Convert.ToString(row["JOB_ID"])).ToList();

            for (int i = 0; i < jobs.Count(); i++)
            {
                sortedJobs.Add(jobs[i]);
            }

            // match skills

            return finalJobs;
        }
        public async Task WhenReadSourceToImgDestinationWithSizeThenReadDataIsIdentical()
        {
            // arrange
            var sourcePath              = $"{Guid.NewGuid()}.img";
            var destinationPath         = $"{Guid.NewGuid()}.img";
            var size                    = 16 * 512;
            var fakeCommandHelper       = new FakeCommandHelper(new [] { sourcePath }, new [] { destinationPath });
            var cancellationTokenSource = new CancellationTokenSource();

            // act - read source img to destination img
            var readCommand = new ReadCommand(new NullLogger <ReadCommand>(), fakeCommandHelper, new List <IPhysicalDrive>(), sourcePath, destinationPath, size);
            var result      = await readCommand.Execute(cancellationTokenSource.Token);

            Assert.True(result.IsSuccess);

            // assert data is identical
            var sourceBytes = fakeCommandHelper.GetMedia(sourcePath).GetBytes(size);

            Assert.Equal(size, sourceBytes.Length);
            var destinationBytes = fakeCommandHelper.GetMedia(destinationPath).GetBytes();

            Assert.Equal(sourceBytes, destinationBytes);
        }
예제 #16
0
        public void ReadCommandReturnsAListOfTweet()
        {
            var userRepo = new Mock <InMemoryRepo <User> >();

            var username = "******";
            var user     = new User(username);

            userRepo.Object.Add(user);
            userRepo.Object.Save(user);

            var userService = new UserService(userRepo.Object);

            var tweet1 = "This could be my first tweet.";
            var tweet2 = "And this could be my second...";

            userService.PostTweet(username, tweet1);
            userService.PostTweet(username, tweet2);

            var readCommand = new ReadCommand(new Receiver(userService));
            var tweets      = readCommand.Execute(username, string.Empty);

            Assert.Equal(2, tweets.Count);
        }
예제 #17
0
        public List <DbJob> Execute(string stream, string status, string location, string company, List <string> skills)
        {
            List <DbJob>  finalJobs  = new List <DbJob>();
            List <string> sortedJobs = new List <string>();

            // search based on stream, status, skills, company and location

            // get jobs with stream, status, loaction and company match
            string qry = "SELECT JOBPOST.job_id FROM JOBPOST JOIN STREAM ON JOBPOST.stream_id = STREAM.stream_id JOIN STATUS ON JOBPOST.status_id = STATUS.status_id WHERE statusText = '" + status + "' AND streamText = '" + stream + "' AND company = '" + company + "' AND location = '" + location + "'";

            IReadCommand  read = new ReadCommand();
            DataTable     dt   = read.Execute(qry);
            List <string> jobs = (from row in dt.AsEnumerable() select Convert.ToString(row["JOB_ID"])).ToList();

            for (int i = 0; i < jobs.Count(); i++)
            {
                sortedJobs.Add(jobs[i]);
            }


            // match skills

            return(finalJobs);
        }
예제 #18
0
        private void GoToNotification(NotificationModel x)
        {
            var subject = x.Subject.Type.ToLower();

            if (subject.Equals("issue"))
            {
                ReadCommand.Execute(x);
                var node = x.Subject.Url.Substring(x.Subject.Url.LastIndexOf('/') + 1);
                ShowViewModel <IssueViewModel>(new IssueViewModel.NavObject {
                    Username = x.Repository.Owner.Login, Repository = x.Repository.Name, Id = long.Parse(node)
                });
            }
            else if (subject.Equals("pullrequest"))
            {
                ReadCommand.Execute(x);
                var node = x.Subject.Url.Substring(x.Subject.Url.LastIndexOf('/') + 1);
                ShowViewModel <PullRequestViewModel>(new PullRequestViewModel.NavObject {
                    Username = x.Repository.Owner.Login, Repository = x.Repository.Name, Id = long.Parse(node)
                });
            }
            else if (subject.Equals("commit"))
            {
                ReadCommand.Execute(x);
                var node = x.Subject.Url.Substring(x.Subject.Url.LastIndexOf('/') + 1);
                ShowViewModel <ChangesetViewModel>(new ChangesetViewModel.NavObject {
                    Username = x.Repository.Owner.Login, Repository = x.Repository.Name, Node = node
                });
            }
            else if (subject.Equals("release"))
            {
                ReadCommand.Execute(x);
                ShowViewModel <BranchesAndTagsViewModel>(new BranchesAndTagsViewModel.NavObject {
                    Username = x.Repository.Owner.Login, Repository = x.Repository.Name, IsShowingBranches = false
                });
            }
        }
예제 #19
0
        static async Task Run(Arguments arguments)
        {
            Log.Logger = new LoggerConfiguration()
                         .Enrich.FromLogContext()
                         .WriteTo.Console()
                         .CreateLogger();

            var serviceProvider = new ServiceCollection()
                                  .AddLogging(loggingBuilder => loggingBuilder.AddSerilog(dispose: true))
                                  .BuildServiceProvider();

            var loggerFactory = serviceProvider.GetService <ILoggerFactory>();

            var isAdministrator = OperatingSystem.IsAdministrator();

            if (!isAdministrator)
            {
                Console.WriteLine("Requires administrator rights!");
            }

            var commandHelper           = new CommandHelper();
            var physicalDrives          = (await GetPhysicalDrives(arguments)).ToList();
            var cancellationTokenSource = new CancellationTokenSource();

            switch (arguments.Command)
            {
            case Arguments.CommandEnum.List:
                var listCommand = new ListCommand(loggerFactory.CreateLogger <ListCommand>(), commandHelper, physicalDrives);
                listCommand.ListRead += (_, args) =>
                {
                    //
                    // await Task.Run(() =>
                    // {
                    //     Console.WriteLine(JsonSerializer.Serialize(physicalDrivesList, JsonSerializerOptions));
                    // });
                    InfoPresenter.PresentInfo(args.MediaInfos);
                };
                var listResult = await listCommand.Execute(cancellationTokenSource.Token);

                Console.WriteLine(listResult.IsSuccess ? "Done" : $"ERROR: Read failed, {listResult.Error}");
                break;

            case Arguments.CommandEnum.Info:
                var infoCommand = new InfoCommand(loggerFactory.CreateLogger <InfoCommand>(), commandHelper, physicalDrives, arguments.SourcePath);
                infoCommand.DiskInfoRead += (_, args) => { InfoPresenter.PresentInfo(args.MediaInfo); };
                var infoResult = await infoCommand.Execute(cancellationTokenSource.Token);

                Console.WriteLine(infoResult.IsSuccess ? "Done" : $"ERROR: Read failed, {infoResult.Error}");
                break;

            case Arguments.CommandEnum.Read:
                Console.WriteLine("Reading physical drive to image file");

                GenericPresenter.PresentPaths(arguments);

                var readCommand = new ReadCommand(loggerFactory.CreateLogger <ReadCommand>(), commandHelper, physicalDrives, arguments.SourcePath,
                                                  arguments.DestinationPath,
                                                  arguments.Size);
                readCommand.DataProcessed += (_, args) => { GenericPresenter.Present(args); };
                var readResult = await readCommand.Execute(cancellationTokenSource.Token);

                Console.WriteLine(readResult.IsSuccess ? "Done" : $"ERROR: Read failed, {readResult.Error}");
                break;

            case Arguments.CommandEnum.Convert:
                Console.WriteLine("Converting source image to destination image file");

                GenericPresenter.PresentPaths(arguments);

                var convertCommand = new ConvertCommand(loggerFactory.CreateLogger <ConvertCommand>(), commandHelper, arguments.SourcePath,
                                                        arguments.DestinationPath,
                                                        arguments.Size);
                convertCommand.DataProcessed += (_, args) => { GenericPresenter.Present(args); };
                var convertResult = await convertCommand.Execute(cancellationTokenSource.Token);

                Console.WriteLine(
                    convertResult.IsSuccess ? "Done" : $"ERROR: Convert failed, {convertResult.Error}");
                break;

            case Arguments.CommandEnum.Write:
                Console.WriteLine("Writing source image file to physical drive");

                GenericPresenter.PresentPaths(arguments);

                var writeCommand = new WriteCommand(loggerFactory.CreateLogger <WriteCommand>(), commandHelper, physicalDrives, arguments.SourcePath,
                                                    arguments.DestinationPath,
                                                    arguments.Size);
                writeCommand.DataProcessed += (_, args) => { GenericPresenter.Present(args); };
                var writeResult = await writeCommand.Execute(cancellationTokenSource.Token);

                Console.WriteLine(writeResult.IsSuccess ? "Done" : $"ERROR: Write failed, {writeResult.Error}");
                break;

            case Arguments.CommandEnum.Verify:
                Console.WriteLine("Verifying source image to destination");

                GenericPresenter.PresentPaths(arguments);

                var verifyCommand = new VerifyCommand(loggerFactory.CreateLogger <VerifyCommand>(), commandHelper, physicalDrives, arguments.SourcePath,
                                                      arguments.DestinationPath,
                                                      arguments.Size);
                verifyCommand.DataProcessed += (_, args) => { GenericPresenter.Present(args); };
                var verifyResult = await verifyCommand.Execute(cancellationTokenSource.Token);

                Console.WriteLine(verifyResult.IsSuccess ? "Done" : $"ERROR: Verify failed, {verifyResult.Error}");
                break;

            case Arguments.CommandEnum.Blank:
                Console.WriteLine("Creating blank image");
                Console.WriteLine($"Path: {arguments.SourcePath}");
                var blankCommand = new BlankCommand(loggerFactory.CreateLogger <BlankCommand>(), commandHelper, arguments.SourcePath, arguments.Size);
                var blankResult  = await blankCommand.Execute(cancellationTokenSource.Token);

                Console.WriteLine(blankResult.IsSuccess ? "Done" : $"ERROR: Blank failed, {blankResult.Error}");
                break;

            case Arguments.CommandEnum.Optimize:
                Console.WriteLine("Optimizing image file");
                Console.WriteLine($"Path: {arguments.SourcePath}");
                var optimizeCommand = new OptimizeCommand(loggerFactory.CreateLogger <OptimizeCommand>(), commandHelper, arguments.SourcePath);
                var optimizeResult  = await optimizeCommand.Execute(cancellationTokenSource.Token);

                Console.WriteLine(optimizeResult.IsSuccess
                        ? "Done"
                        : $"ERROR: Optimize failed, {optimizeResult.Error}");
                break;
            }
        }
예제 #20
0
        public ESPViewModel()
        {
            timeoutTimer = new DispatcherTimer();
            _Connect     = new DelegateCommand(async(x) =>
            {
                try
                {
                    await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                    {
                        this.Status = "Opening " + port;
                    });
                    await ConnectToPort();

                    await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                    {
                        this.Status = port + " Opened";
                        RaisePropertyChangedEventHandlers();
                        if (x is Action <object> && x != null)
                        {
                            (x as Action <object>)(true);
                        }
                    });
                }
                catch (Exception ex)
                {
                    if (x is Action <object> && x != null)
                    {
                        (x as Action <object>)(false);
                    }
                    await PostException(ex);
                }
            }, (y) => { return(!Connected()); });

            _Disconnect = new DelegateCommand(async(x) =>
            {
                await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                {
                    this.Status = "Closing" + port;
                });
                try
                {
                    CancelReadTask();
                    CloseDevice();
                    ReceivedText = string.Empty;
                    await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                    {
                        this.Status = "UART0 Closed";
                        RaisePropertyChangedEventHandlers();
                        if (x is Action <object> && x != null)
                        {
                            (x as Action <object>)(true);
                        }
                    });
                }
                catch (Exception ex)
                {
                    if (x is Action <object> && x != null)
                    {
                        (x as Action <object>)(false);
                    }
                    await PostException(ex);
                }
            }, (y) => { return(Connected()); });
            _SendTextCommand = new DelegateCommand(async(x) =>
            {
                try
                {
                    await SendCommand(SendText);
                }
                catch (Exception ex)
                {
                    await PostException(ex);
                }
            }, (y) => { return(Connected()); });
            _ReadCommand = new DelegateCommand(async(x) =>
            {
                try
                {
                    if (x != null)
                    {
                        string command = (x as dynamic).command;
                        System.Diagnostics.Debug.WriteLine("ReadCommand:" + command);
                        returnAction = (x as dynamic).action as Action <object>;
                        if ((x as dynamic).timeout != null)
                        {
                            double timeout = (x as dynamic).timeout;
                            System.Diagnostics.Debug.WriteLine("Timeout: " + timeout);
                            timeoutTimer.Stop();
                            timeoutTimer.Interval = TimeSpan.FromSeconds(timeout);
                            RemoveHandlers();
                            timeoutTimer.Tick += TimeoutTimer_Tick;
                            timeoutTimer.Start();
                        }
                        await SendCommand(command);
                    }
                }
                catch (Exception ex)
                {
                    if (x != null)
                    {
                        (x as dynamic).action(null);
                    }
                    await PostException(ex);
                }
            }, (y) => { return(Connected()); });
            _GetIP = new DelegateCommand((x) =>
            {
                ReadCommand.Execute((object)(new
                {
                    action = (Action <object>)((value) =>
                    {
                        System.Diagnostics.Debug.WriteLine("ReadCommand Action:" + value);
                    }),
                    command = "= wifi.sta.getip()",
                    timeout = 5.0,
                }));
            }, (y) => { return(Connected()); });
            _ClearWifi = new DelegateCommand(async(x) =>
            {
                await SendCommand("wifi.setmode(wifi.STATION) wifi.sta.config(\"\",\"\") file.remove(\".wifi\")");
            }, (y) => { return(Connected()); });
            _GetFiles = new DelegateCommand(async(x) =>
            {
                await SendCommand("for k,v in pairs(file.list()) do l = string.format(\" % -15s\",k) print(l..\"   \"..v..\" bytes\") end");
            }, (y) => { return(Connected()); });
            _Restart = new DelegateCommand(async(x) =>
            {
                await SendCommand("node.restart()");
            }, (y) => { return(Connected()); });
            _StopTimers = new DelegateCommand(async(x) =>
            {
                await SendCommand("tmr.stop(0)");
                await SendCommand("tmr.stop(1)");
            }, (y) => { return(Connected()); });
        }