コード例 #1
0
ファイル: SightTrigger.cs プロジェクト: johnying7/Projects
    void toggleDialog()
    {
        Debug.Log("toggledialog called");
        Debug.Log(dialogActive);
        if (!dialogActive)        //activate dialog
        {
            ///make sighted object y and player y equal zero

            noSight();
            sightedObject = actionSight.collider.gameObject;
            DialogCreator dc = sightedObject.GetComponent <DialogCreator>();
            DialogDisplay dd = GetComponent <DialogDisplay>();
            dd.enabled = true;
            dd.startDialog(sightedObject.name, dc.GetDialog().text);

            dialogActive = true;
        }
        else if (dialogActive)        //deactivate dialog
        {
            whiteSight();
            DialogDisplay dd = GetComponent <DialogDisplay>();
            dd.closeDialog();
            dd.enabled = false;

            dialogActive = false;
        }
    }
        private IEnumerable <IContainer> selectContainersToImport(IEnumerable <IContainer> containers)
        {
            using (var modal = Context.Resolve <IModalPresenter>())
            {
                var presenter = Context.Resolve <ISelectManyPresenter <IContainer> >();
                modal.Text = AppConstants.Captions.SelectEntitiesToLoad(_editTask.ObjectName);
                presenter.InitializeWith(containers);
                modal.Encapsulate(presenter);
                if (!modal.Show())
                {
                    return(Enumerable.Empty <IContainer>());
                }

                var containerToImport = presenter.Selections.ToList();
                var allChildContainer = containerToImport
                                        .SelectMany(container => container.GetAllChildren <IContainer>(cont => !cont.IsAnImplementationOf <IParameter>()));

                var containerDoubleImported = containerToImport.Where(allChildContainer.Contains).ToList();
                if (containerDoubleImported.Any())
                {
                    containerDoubleImported.Each(c => containerToImport.Remove(c));
                    DialogCreator.MessageBoxInfo(AppConstants.Exceptions.RemovedToPreventErrorDoubleImport(containerDoubleImported));
                }
                return(containerToImport);
            }
        }
コード例 #3
0
 public SearchResultCollection(ISearchEngine searchEngine, string query, ProgressBar progressBar, DialogCreator dialogCreator)
 {
     _searchEngine  = searchEngine;
     _query         = query;
     _progressBar   = progressBar;
     _dialogCreator = dialogCreator;
 }
コード例 #4
0
        public IMoBiCommand RemoveMultipleSimulations(IReadOnlyList <IMoBiSimulation> simulations)
        {
            var currentProject = _interactionTaskContext.Context.CurrentProject;

            if (DialogCreator.MessageBoxYesNo(AppConstants.Dialog.RemoveSimulationsFromProject(currentProject.Name)) != ViewResult.Yes)
            {
                return(new MoBiEmptyCommand());
            }

            simulations.Each(simulation => _simulationReferenceUpdater.RemoveSimulationFromParameterIdentificationsAndSensitivityAnalyses(simulation));

            var macroCommand = new MoBiMacroCommand
            {
                Description = AppConstants.Commands.RemoveSimulationsFromProject,
                ObjectType  = ObjectTypes.Simulation,
                CommandType = AppConstants.Commands.DeleteCommand
            };

            simulations.Each(simulation =>
            {
                macroCommand.AddCommand(GetRemoveCommand(simulation, currentProject, null).Run(Context));
                Context.PublishEvent(new RemovedEvent(simulation, currentProject));
            });

            return(macroCommand);
        }
コード例 #5
0
ファイル: DialogCreator.cs プロジェクト: thyjukki/Rebelion
    static void Init()
    {
        GetIDCount();
        // Get existing open window or if none, make a new one:
        DialogCreator window = (DialogCreator)EditorWindow.GetWindow(typeof(DialogCreator));

        window.Show();
    }
コード例 #6
0
        /// <summary>
        /// Loads all required resources.
        /// </summary>
        private void Initialise()
        {
#if DEBUG
            Log.Initialise();
#else
            if (ConfigManager.Config.CreateLogFile)
            {
                Log.Initialise();
            }
#endif
            // Load compiled-in resources.
            EmbeddedResources.Load();

            Log.Send("------------------------------");
            Log.Send($"Starting pass-winmenu {Version}");
            Log.Send("------------------------------");

            // Set the security protocol to TLS 1.2 only.
            // We only use this for update checking (Git push over HTTPS is not handled by .NET).
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

            // Create the notification service first, so it's available if initialisation fails.
            notificationService = Notifications.Create();

            // Now load the configuration options that we'll need
            // to continue initialising the rest of the applications.
            LoadConfigFile();

            // Create the GPG wrapper.
            gpg = new GPG();
            gpg.FindGpgInstallation(ConfigManager.Config.Gpg.GpgPath);
            if (ConfigManager.Config.Gpg.GpgAgent.Config.AllowConfigManagement)
            {
                gpg.UpdateAgentConfig(ConfigManager.Config.Gpg.GpgAgent.Config.Keys);
            }
            // Create the Git wrapper, if enabled.
            InitialiseGit(ConfigManager.Config.Git, ConfigManager.Config.PasswordStore.Location);

            // Initialise the internal password manager.
            passwordManager = new PasswordManager(ConfigManager.Config.PasswordStore.Location, EncryptedFileExtension, gpg);
            passwordManager.PinentryFixEnabled = ConfigManager.Config.Gpg.PinentryFix;

            clipboard     = new ClipboardHelper();
            dialogCreator = new DialogCreator(notificationService, passwordManager, git, gpg);
            InitialiseUpdateChecker();

            actionDispatcher = new ActionDispatcher(notificationService, passwordManager, dialogCreator, clipboard, git, updateChecker);

            notificationService.AddMenuActions(actionDispatcher);

            // Assign our hotkeys.
            hotkeys = new HotkeyManager();
            AssignHotkeys(hotkeys);
        }
        private UIElement OutputPathBullet()
        {
            Predicate <string> validityCheck = path => Directory.Exists(path);
            Action <string>    onPathChanged = path => OutputResultPath = path;
            var textBox = InteractiveTextBox.Create(OutputResultPath, validityCheck, onPathChanged, Dispatcher);

            return(HorizontalContainerStrecherd.Create()
                   .AddLeft(TextBlockCreator.RegularTextBlock("Result Output Folder").WithBullet())
                   .AddRight(ButtonCreator.Create("...", () => DialogCreator.ChooseFolder(path => textBox.Text = path)))
                   .AsDock(textBox));
        }
コード例 #8
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
コード例 #9
0
 public ActionDispatcher(INotificationService notificationService,
                         IPasswordManager passwordManager,
                         DialogCreator dialogCreator,
                         ClipboardHelper clipboard,
                         ISyncService syncService,
                         UpdateChecker updateChecker)
 {
     this.notificationService = notificationService;
     this.passwordManager     = passwordManager;
     this.dialogCreator       = dialogCreator;
     this.clipboard           = clipboard;
     this.syncService         = syncService;
     this.updateChecker       = updateChecker;
 }
コード例 #10
0
        private void Submit_Click(object sender, EventArgs e)
        {
            try
            {
                if (editApplicationName.Text == "" || editUsername.Text == "" ||
                    editPassword.Text == "" || editEmail.Text == "")
                {
                    throw new NullReferenceException();
                }

                var ExistUser = db.Query <Password>("SELECT * FROM Password WHERE Id = ?", selectedPassword.Id).FirstOrDefault();

                if (ExistUser != null)
                {
                    ExistUser.AppName       = editApplicationName.Text;
                    ExistUser.Username      = editUsername.Text;
                    ExistUser.Email         = editEmail.Text;
                    ExistUser.PasswordValue = editPassword.Text;
                }

                db.RunInTransaction(() =>
                {
                    db.Update(ExistUser);
                });

                DialogCreator.CreateDialog(this, "Success", "Password have been changed Successfully",
                                           "Okay", delegate {
                    var intent = new Intent(this, typeof(PasswordDetailActivity));
                    intent.PutExtra("passwordId", ExistUser.Id);
                    this.Finish();
                    StartActivity(intent);
                });
            }

            catch (NullReferenceException)
            {
                DialogCreator.CreateDialog(this, "Error", "You must fill all the boxes !",
                                           "Okay", delegate { });
            }

            catch
            {
                var dialog = new AlertDialog.Builder(this);
                dialog.SetTitle("Error");
                dialog.SetMessage("Something wrong Happened");
                dialog.SetNeutralButton("Okay", delegate { });
                dialog.Show();
            }
        }
        /// <summary>
        ///    Clones the specified object with the name enterd by user.
        /// </summary>
        /// <param name="buildingBlockToClone">The object to clone.</param>
        public IMoBiCommand Clone(TBuildingBlock buildingBlockToClone)
        {
            var name = DialogCreator.AskForInput(AppConstants.Dialog.AskForNewName(AppConstants.CloneName(buildingBlockToClone)),
                                                 AppConstants.Captions.NewName,
                                                 AppConstants.CloneName(buildingBlockToClone), _editTask.GetForbiddenNames(buildingBlockToClone, Context.CurrentProject.All <TBuildingBlock>()));

            if (string.IsNullOrEmpty(name))
            {
                return(new MoBiEmptyCommand());
            }

            var clone = InteractionTask.Clone(buildingBlockToClone).WithName(name);

            return(AddToProject(clone));
        }
        private UIElement InputGraphBullet()
        {
            Predicate <string> validityCheck = path => File.Exists(path) && GraphEmbedding.CanParse(path);
            Action <string>    onPathChanged = path =>
            {
                InputGraphPath = path;
                SetGraph(GraphEmbedding.FromText(File.ReadLines(path)));
            };
            var textBox = InteractiveTextBox.Create(InputGraphPath, validityCheck, onPathChanged, Dispatcher);

            InputGraphTextBox = textBox;
            return(HorizontalContainerStrecherd.Create()
                   .AddLeft(TextBlockCreator.RegularTextBlock("Input Graph").WithBullet())
                   .AddRight(ButtonCreator.Create("...", () => DialogCreator.ChooseFile(path => textBox.Text = path)))
                   .AsDock(textBox));
        }
コード例 #13
0
        private void OpenGraphButton_OnClick(object __, RoutedEventArgs _)
        {
            try
            {
                void FileChosen(string path)
                {
                    var embedding = GraphEmbedding.FromText(File.ReadLines(path));

                    this.GraphVisual.SetNewEmbedding(embedding);
                }
                DialogCreator.ChooseFile(FileChosen);
            }
            catch (Exception e)
            {
                MessageBox.Show("An error occured. file is malformed:" + Environment.NewLine + e.Message);
            }
        }
コード例 #14
0
    public override void OnInspectorGUI()
    {
        DialogCreator dc = target as DialogCreator;

        dc.idCount = EditorGUILayout.IntField("ID Count: ", dc.idCount);

        for (int i = 0; i < dc.dialogList.Count; i++)
        {
            EditorGUILayout.BeginHorizontal();
            dc.dialogList[i].dialogOption = EditorGUILayout.Foldout(dc.dialogList[i].dialogOption, "Option " + dc.dialogList[i].id);
            if (GUILayout.Button("DELETE"))
            {
                dc.dialogList.RemoveAt(i);
            }
            EditorGUILayout.EndHorizontal();

            if (dc.dialogList[i].dialogOption == true)
            {
                EditorGUI.indentLevel = 2;

                dc.dialogList[i].id   = EditorGUILayout.IntField("Dialog ID: ", dc.dialogList[i].id);
                dc.dialogList[i].text = EditorGUILayout.TextArea(dc.dialogList[i].text);

                EditorGUI.indentLevel = 0;
            }
        }

        if (GUILayout.Button("Add New Dialog"))
        {
            Dialog newDialog = (Dialog)ScriptableObject.CreateInstance <Dialog>();
            newDialog.text         = "Enter new dialog here.";
            newDialog.id           = dc.idCount;
            newDialog.dialogOption = false;
            dc.idCount++;
            dc.dialogList.Add(newDialog);
        }
    }
コード例 #15
0
 public ActionDispatcher(DialogCreator dialogCreator, Dictionary <HotkeyAction, IAction> actions)
 {
     this.dialogCreator = dialogCreator;
     this.actions       = actions;
 }
コード例 #16
0
 public SearchResultsVm(ISearchEngine searchEngine, DialogCreator dialogCreator)
 {
     _searchEngine  = searchEngine;
     _dialogCreator = dialogCreator;
 }