Exemple #1
0
 public void ShowRemoveActionObjectDialog(string type)
 {
     confirmationDialog.Open("Delete object",
                             "Are you sure you want to delete action object " + type + "?",
                             () => RemoveActionObject(type),
                             () => confirmationDialog.Close());
 }
    public async void UpdateUsingRobot()
    {
        if (isOrientationDetail)
        {
            try {
                string armId = null;
                if (SceneManager.Instance.SelectedRobot.MultiArm())
                {
                    armId = SceneManager.Instance.SelectedArmId;
                }
                await WebsocketManager.Instance.UpdateActionPointOrientationUsingRobot(SceneManager.Instance.SelectedRobot.GetId(), SceneManager.Instance.SelectedEndEffector.GetName(), orientation.Id, armId);

                Notifications.Instance.ShowToastMessage("Orientation updated successfully");
            } catch (ItemNotFoundException ex) {
                Debug.LogError(ex);
                Notifications.Instance.ShowNotification("Failed update orientation", ex.Message);
            } catch (RequestFailedException ex) {
                Notifications.Instance.ShowNotification("Failed to update orientation", ex.Message);
            }
        }
        else //joints
        {
            try {
                await WebsocketManager.Instance.UpdateActionPointJointsUsingRobot(joints.Id);

                Notifications.Instance.ShowToastMessage("Joints updated successfully");
            } catch (RequestFailedException ex) {
                Notifications.Instance.ShowNotification("Failed to update joints", ex.Message);
            }
        }
        ConfirmationDialog.Close();
        UpdateMenu();
    }
Exemple #3
0
    public async void UpdateUsingRobot()
    {
        if (isOrientationDetail)
        {
            try {
                string robotId = SceneManager.Instance.RobotNameToId((string)RobotsList.GetValue());
                await WebsocketManager.Instance.UpdateActionPointOrientationUsingRobot(robotId, (string)EndEffectorList.GetValue(), orientation.Id);

                Notifications.Instance.ShowToastMessage("Orientation updated successfully");
            } catch (ItemNotFoundException ex) {
                Debug.LogError(ex);
                Notifications.Instance.ShowNotification("Failed update orientation", ex.Message);
            } catch (RequestFailedException ex) {
                Notifications.Instance.ShowNotification("Failed to update orientation", ex.Message);
            }
        }
        else //joints
        {
            try {
                await WebsocketManager.Instance.UpdateActionPointJointsUsingRobot(joints.Id);

                Notifications.Instance.ShowToastMessage("Joints updated successfully");
            } catch (RequestFailedException ex) {
                Notifications.Instance.ShowNotification("Failed to update joints", ex.Message);
            }
        }
        ConfirmationDialog.Close();
        UpdateMenu();
    }
Exemple #4
0
 public void ShowUpdatePositionConfirmationDialog()
 {
     confirmationDialog.Open("Update position",
                             "Do you want to update position of action point " + CurrentActionPoint.Data.Name,
                             () => UpdateActionPointPosition(),
                             () => confirmationDialog.Close());
 }
Exemple #5
0
    public async void DeleteAP()
    {
        Debug.Assert(CurrentActionPoint != null);
        try {
            await WebsocketManager.Instance.RemoveActionPoint(CurrentActionPoint.Data.Id);

            ConfirmationDialog.Close();
            MenuManager.Instance.HideMenu(MenuManager.Instance.ActionPointMenu);
        } catch (RequestFailedException e) {
            Notifications.Instance.ShowNotification("Failed to remove action point", e.Message);
        }
    }
    public async void DeleteActionObject()
    {
        IO.Swagger.Model.RemoveFromSceneResponse response = await Base.GameManager.Instance.RemoveFromScene(CurrentObject.Data.Id);

        if (!response.Result)
        {
            Notifications.Instance.ShowNotification("Failed to remove object " + CurrentObject.Data.Name, response.Messages[0]);
            return;
        }
        CurrentObject = null;
        ConfirmationDialog.Close();
        MenuManager.Instance.ActionObjectMenuSceneEditor.Close();
    }
    public async void DeleteAction()
    {
        ConfirmationDialog.Close();
        if (CurrentAction == null)
        {
            return;
        }
        try {
            await WebsocketManager.Instance.RemoveAction(CurrentAction.Data.Id, false);

            MenuManager.Instance.PuckMenu.Close();
        } catch (RequestFailedException e) {
            Notifications.Instance.ShowNotification("Failed to remove action point", e.Message);
        }
    }
Exemple #8
0
    public async void ShowCloseSceneDialog()
    {
        (bool success, _) = await Base.GameManager.Instance.CloseScene(false);

        if (!success)
        {
            GameManager.Instance.HideLoadingScreen();
            string message = "Are you sure you want to close current scene? ";
            if (SceneManager.Instance.SceneChanged)
            {
                message += "Unsaved changes will be lost";
                if (SceneManager.Instance.SceneStarted)
                {
                    message += " and system will go offline";
                }
                message += ".";
            }
            else if (SceneManager.Instance.SceneStarted)
            {
                message += "System will go offline.";
            }

            ConfirmationDialog.Open("Close scene",
                                    message,
                                    () => CloseScene(),
                                    () => ConfirmationDialog.Close());
        }
    }
Exemple #9
0
    public async void RemoveScene()
    {
        bool result = await Base.GameManager.Instance.RemoveScene(sceneTile.SceneId);

        if (result)
        {
            confirmationDialog.Close();
            Close();
        }
    }
    public async void RemoveProject()
    {
        bool result = await Base.GameManager.Instance.RemoveProject(projectTile.ProjectId);

        if (result)
        {
            confirmationDialog.Close();
            Close();
        }
    }
 public async void RunDebug(bool pause)
 {
     try {
         ConfirmationDialog.Close();
         GameManager.Instance.ShowLoadingScreen("Starting...");
         await WebsocketManager.Instance.TemporaryPackage(ProjectManager.Instance.GetAllBreakpoints(), pause);
     } catch (RequestFailedException ex) {
         Notifications.Instance.ShowNotification("Failed to debug project", ex.Message);
         GameManager.Instance.HideLoadingScreen();
     }
 }
    public async void RemovePackage()
    {
        GameManager.Instance.ShowLoadingScreen();
        if (await GameManager.Instance.RemovePackage(packageTile.PackageId))
        {
            await GameManager.Instance.LoadPackages();

            confirmationDialog.Close();
            Close();
        }
        GameManager.Instance.HideLoadingScreen();
    }
Exemple #13
0
    private async void CancelObjectAiming()
    {
        try {
            await WebsocketManager.Instance.CancelObjectAiming();

            ActionObjectAimingMenu.Instance.AimingInProgress = false;
            ActionObjectAimingMenu.Instance.Highlight(true);
            DeactivateAllSubmenus();
            ConfirmationDialog.Close();
        } catch (RequestFailedException ex) {
            Notifications.Instance.ShowNotification("Failed to cancel object aiming", ex.Message);
        }
    }
    public async void CloseProject()
    {
        if (SceneManager.Instance.SceneStarted)
        {
            WebsocketManager.Instance.StopScene(false, null);
        }
        GameManager.Instance.ShowLoadingScreen("Closing project..");
        _ = await GameManager.Instance.CloseProject(true);

        ConfirmationDialog.Close();
        MainMenu.Instance.Close();
        GameManager.Instance.HideLoadingScreen();
    }
Exemple #15
0
    public async void CloseScene()
    {
        if (SceneManager.Instance.SceneStarted)
        {
            WebsocketManager.Instance.StopScene(false, null);
        }
        (bool success, string message) = await Base.GameManager.Instance.CloseScene(true);

        if (success)
        {
            ConfirmationDialog.Close();
            MainMenu.Instance.Close();
        }
    }
Exemple #16
0
    public async void RemovePackage()
    {
        GameManager.Instance.ShowLoadingScreen();
        try {
            await WebsocketManager.Instance.RemovePackage(packageTile.PackageId);

            WebsocketManager.Instance.LoadPackages(MainScreen.Instance.LoadPackagesCb);
            confirmationDialog.Close();
            Close();
        } catch (RequestFailedException e) {
            Notifications.Instance.ShowNotification("Failed to remove package", e.Message);
        } finally {
            GameManager.Instance.HideLoadingScreen();
        }
    }
Exemple #17
0
        //�Public�Methods�(1)�

        /// <summary>
        /// Show alert message
        /// </summary>
        /// <param name="title"></param>
        /// <param name="message"></param>
        /// <param name="onClosedCallback"></param>
        public void Alert(string title, string message, Action <DialogResult> onClosedCallback)
        {
            _confirmationDialog.Close();
            _alertDialog.Title   = title;
            _alertDialog.Message = message;
            _alertDialog.Closed += (s, e) =>
            {
                if (onClosedCallback != null)
                {
                    DialogResult result = new DialogResult();
                    result.Result = _alertDialog.DialogResult;
                    onClosedCallback(result);
                }
            };
            _alertDialog.Width  = Width;
            _alertDialog.Height = Height;
            _alertDialog.Show();
        }
Exemple #18
0
 private void RemoveObject(InteractiveObject obj)
 {
     obj.Remove();
     ConfirmationDialog.Close();
 }