示例#1
0
        private void addProgram(Process aProc)
        {
            WindowsProgram addProgram = new WindowsProgram()
            {
                Id = WindowsProgram.NextId(SelectedProfile.Id)
            };

            addProgram.StartPath    = aProc.MainModule.FileName;
            addProgram.WindowWidth  = WindowController.GetWindowWidth(aProc);
            addProgram.WindowHeight = WindowController.GetWindowHeight(aProc);
            addProgram.XPos         = WindowController.WindowXPosition(aProc);
            addProgram.YPos         = WindowController.WindowYPosition(aProc);
            addProgram.WindowState  = WindowController.GetWindowStatus(aProc);
            addProgram.ProcessName  = aProc.ProcessName;

            if (aProc.ProcessName == "chrome")
            {
                ReturnStringDialogViewModel ArgumentSetter = new ReturnStringDialogViewModel("Chrome website", "Which website should be opened when chrome is launched?");
                if (ArgumentSetter.DialogResult == 1)
                {
                    addProgram.Argument = ArgumentSetter.Value;
                }
            }

            Configuration.ProfileById(SelectedProfile.Id).Programs.Add(addProgram);
            Configuration.Save();
        }
示例#2
0
        private void _renameProfile(object parameter)
        {
            ReturnStringDialogViewModel ProfileNamer = new ReturnStringDialogViewModel("Rename profile", "Please chooose a new name for profile: " + SelectedProfile.Name);

            if (ProfileNamer.DialogResult == 1)
            {
                SelectedProfile.Name = ProfileNamer.Value;
            }
        }
示例#3
0
        private void _addProfile(object parameter)
        {
            ReturnStringDialogViewModel ProfileNamer = new ReturnStringDialogViewModel("Add new profile", "Please chooose a unique name for your new profile");

            if (ProfileNamer.DialogResult == 1)
            {
                int id = Profile.NextId();
                if (Configuration.Instance.Profiles == null)
                {
                    Configuration.Instance.Profiles = new List <Profile>();
                }
                Configuration.Instance.Profiles.Add(new Profile()
                {
                    Id = id, Name = ProfileNamer.Value, Programs = new List <WindowsProgram>()
                });
                Configuration.Save();
                OnPropertyChanged("Profiles");
                SelectedProfile = Configuration.ProfileById(id);
            }
        }