Пример #1
0
 public async void DeleteSimulator(object simulatorId)
 {
     if (simulatorId != null)
     {
         if (await Popups.ConfirmAsync(ClientResources.ConfirmDelete_Title, ClientResources.ConfirmDelete_Msg))
         {
             await PerformNetworkOperation(async() =>
             {
                 var uri    = $"/api/simulator/{simulatorId}";
                 var result = await RestClient.DeleteAsync(uri);
                 if (result.Success)
                 {
                     var removedSimulator = ListItems.Where(sim => sim.Id == simulatorId.ToString()).FirstOrDefault();
                     if (removedSimulator != null)
                     {
                         var simList = ListItems.ToList();
                         simList.Remove(removedSimulator);
                         ListItems = simList;
                     }
                 }
                 return(result.ToInvokeResult());
             });
         }
     }
 }
Пример #2
0
 public async void ResetPassword()
 {
     if (await Popups.ConfirmAsync(Resources.SimulatorCoreResources.UnlockPassword_ResetPassword_Title, Resources.SimulatorCoreResources.UnlockPassword_ResetPassword_Prompt))
     {
         await ViewModelNavigation.NavigateAndPickAsync <SetStoragePasswordViewModel>(this, StorageUnlocked, CancelCredentialsEntry);
     }
 }
Пример #3
0
 public override Task <bool> CanCancelAsync()
 {
     if ((FormAdapter != null && FormAdapter.IsDirty) || HasDirtyChildren)
     {
         return(Popups.ConfirmAsync(ClientResources.Confirm_Unsaved_Title, ClientResources.Confirm_Unsaved_Message));
     }
     else
     {
         return(Task.FromResult(true));
     }
 }
Пример #4
0
 public async override void Edit()
 {
     if (_isConnected)
     {
         if (await Popups.ConfirmAsync("IoT Simulator", Resources.SimulatorCoreResources.Simulator_EditDisconnect))
         {
             EditSimulator();
         }
     }
     else
     {
         EditSimulator();
     }
 }
Пример #5
0
        public async void NewMachine()
        {
            if (CurrentPackage != null || _isDirty)
            {
                if (!await Popups.ConfirmAsync("Lose Changes?", "You have unsaved work, opening a new file will cause you to lose changes.\r\n\r\nContinue?"))
                {
                    return;
                }
            }

            _isDirty    = true;
            _isEditing  = false;
            _pnpMachine = new PnPMachine();

            RaisePropertyChanged(nameof(Packages));
            SaveMachineCommand.RaiseCanExecuteChanged();
        }
Пример #6
0
 public async void ApplyHeightMap()
 {
     if (CanApplyHeightMap())
     {
         if (Machine.GCodeFileManager.HeightMapApplied)
         {
             if (await Popups.ConfirmAsync("Height Map", "Height Map has already been applied, doing so again will likely produce incorrect results.\r\n\r\nYou should reload the original GCode File then re-apply the height map.\r\n\r\nContinue? "))
             {
                 Machine.GCodeFileManager.ApplyHeightMap(Machine.HeightMapManager.HeightMap);
             }
         }
         else
         {
             Machine.GCodeFileManager.ApplyHeightMap(Machine.HeightMapManager.HeightMap);
         }
     }
 }
Пример #7
0
        public async void OpenMachine()
        {
            if (CurrentPackage != null || _isDirty)
            {
                if (!await Popups.ConfirmAsync("Lose Changes?", "You have unsaved work, opening a new file will cause you to lose changes.\r\n\r\nContinue?"))
                {
                    return;
                }
            }

            var fileName = await Popups.ShowOpenFileAsync("PnP Machine (*.pnp)|*.pnp");

            if (!String.IsNullOrEmpty(fileName))
            {
                _pnpMachine = await PnPMachineManager.GetPnPMachineAsync(fileName);

                RaisePropertyChanged(nameof(Packages));
            }
        }
        public async void OpenMachine()
        {
            if (SelectedPartPack != null || _isDirty)
            {
                if (!await Popups.ConfirmAsync("Lose Changes?", "You have unsaved work, opening a new file will cause you to lose changes.\r\n\r\nContinue?"))
                {
                    return;
                }
            }

            _fileName = await Popups.ShowOpenFileAsync("PnP Machine (*.pnp)|*.pnp");

            if (!String.IsNullOrEmpty(_fileName))
            {
                var machine = await PnPMachineManager.GetPnPMachineAsync(_fileName);

                SetMachine(machine);
            }
        }
        public async void NewMachine()
        {
            if (_isDirty)
            {
                if (!await Popups.ConfirmAsync("Lose Changes?", "You have unsaved work, opening a new file will cause you to lose changes.\r\n\r\nContinue?"))
                {
                    return;
                }
            }

            _fileName   = null;
            _pnpMachine = new PnPMachine();

            SaveMachineCommand.RaiseCanExecuteChanged();
            AddPartPackCommand.RaiseCanExecuteChanged();

            RaisePropertyChanged(nameof(PartPacks));
            RaisePropertyChanged(nameof(Slots));
        }
Пример #10
0
        public async void GenerateHoldDownGCode()
        {
            var drillIntoUnderlayment = await Popups.ConfirmAsync("Drill Holes In Underlayment?", "Would you also like to drill the holes in the underlayment?  You only need to use this once when setting up a fixture.  After that you should use the holes that were already created.");

            Machine.GCodeFileManager.SetGCode(GCodeEngine.CreateHoldDownGCode(Machine.PCBManager.Board, Machine.PCBManager.Project, drillIntoUnderlayment));
        }