Exemplo n.º 1
0
        private void List_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (ViewModel.LoadedAnimVer >= 3)
            {
                var dialog = new SingleInputDialog()
                {
                    Text        = ViewModel.SelectedAnimation.Name,
                    Description = "Please select the name of the animation"
                };

                if (dialog.ShowDialog() == true)
                {
                    if (string.IsNullOrWhiteSpace(dialog.Text))
                    {
                        MessageBox.Show("You have specified an empty file name.",
                                        "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                    else if (!ViewModel.ChangeCurrentAnimationName(dialog.Text))
                    {
                        MessageBox.Show("An animation with the name {dialog.Name} already exists.\nPlease specify another name.",
                                        "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
            }
        }
Exemplo n.º 2
0
    public static void Show(string textCaption, string defaultText, string buttonCaption,
                            Action <string> OnButtonClick, CheckErrorDelegate checkError)
    {
        SingleInputDialog dialog = ScriptableObject.CreateInstance <SingleInputDialog>();

        dialog._textCaption   = textCaption;
        dialog._text          = defaultText;
        dialog._buttonCaption = buttonCaption;
        dialog._onButtonClick = OnButtonClick;
        dialog._checkError    = checkError;
        dialog.Show(true);
    }
Exemplo n.º 3
0
        private void List_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var dialog = new SingleInputDialog()
            {
                Text        = ViewModel.SelectedAnimationDef.Name,
                Description = "Insert the animation name"
            };

            if (dialog.ShowDialog() == true)
            {
                ViewModel.ChangeAnimationDefinitionName(dialog.Text);
            }
        }
Exemplo n.º 4
0
 public void Execute(object parameter)
 {
     if (_vm.SelectedProjectEntry is ProjectFolderViewModel directory)
     {
         var dialog = new SingleInputDialog()
         {
             Title       = "Create a new folder",
             Description = "Please specify the name of the folder that you want to create",
             Text        = "new folder"
         };
         if (dialog.ShowDialog() ?? false)
         {
             var entry = (directory.Entry as IProjectDirectory).AddDirectory(dialog.Text);
             directory.AddDirectory(entry);
         }
     }
 }
Exemplo n.º 5
0
        private void ListBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (DataContext is ActionsViewModel vm && vm.IsItemSelected)
            {
                var item = vm.SelectedItem;

                var dialog = new SingleInputDialog()
                {
                    Title       = "Action name",
                    Description = "Change the action name",
                    Text        = item.Name,
                };

                if (dialog.ShowDialog() == true)
                {
                    item.Name = dialog.Text;
                }
            }
        }
Exemplo n.º 6
0
        public ProjectSettingsViewModel(IProject project)
        {
            mProject        = project;
            ProjectSettings = Settings.GetProjectConfiguration(mProject);

            AddCommand = new RelayCommand(param =>
            {
                var dialog = new SingleInputDialog()
                {
                    Title       = "New configuration",
                    Description = "Choose a name for the new configuration:"
                };

                if (dialog.ShowDialog() == true)
                {
                    var name = dialog.Text;

                    if (ProjectSettings.Configurations == null)
                    {
                        ProjectSettings.Configurations = new List <ProjectConfiguration>();
                    }

                    if (!ProjectSettings.Configurations.Any(x => x.Name == name))
                    {
                        ProjectSettings.Configurations.Add(new ProjectConfiguration()
                        {
                            Name = dialog.Text
                        });

                        OnPropertyChanged(nameof(Configurations));
                        OnPropertyChanged(nameof(RealConfigurations));
                    }
                }
            }, x => true);

            EditCommand = new RelayCommand(param =>
            {
                var dialog = new SingleInputDialog()
                {
                    Title       = "Rename configuration",
                    Description = $"New name for {param} configuration:",
                    Text        = param?.ToString()
                };

                if (dialog.ShowDialog() == true)
                {
                    var name = dialog.Text;

                    if (!ProjectSettings.Configurations.Any(x => x.Name == name))
                    {
                        SelectedConfiguration.Value.Name = dialog.Text;

                        OnPropertyChanged(nameof(Configurations));
                        OnPropertyChanged(nameof(RealConfigurations));
                    }
                }
            }, x => x != null);

            RemoveCommand = new RelayCommand(param =>
            {
                if (MessageBox.Show(
                        $"Do you want to remove {param} configuration?",
                        "Remove",
                        MessageBoxButton.YesNo,
                        MessageBoxImage.Warning) == MessageBoxResult.Yes)
                {
                    ProjectSettings.Configurations.RemoveAt(SelectedConfigurationIndex);
                    OnPropertyChanged(nameof(Configurations));
                    OnPropertyChanged(nameof(RealConfigurations));
                }
            }, x => ProjectSettings.Configurations != null && SelectedConfigurationIndex >= 0);

            MoveUpCommand = new RelayCommand(param =>
            {
                if (SelectedConfigurationIndex > 0)
                {
                    var configs       = ProjectSettings.Configurations;
                    var selectedIndex = SelectedConfigurationIndex;
                    var item          = configs[selectedIndex];
                    configs.RemoveAt(selectedIndex);
                    configs.Insert(--selectedIndex, item);
                    SelectedConfigurationIndex = selectedIndex;

                    OnPropertyChanged(nameof(Configurations));
                    OnPropertyChanged(nameof(RealConfigurations));
                }
            }, x => ProjectSettings.Configurations != null && SelectedConfigurationIndex > 0);

            MoveDownCommand = new RelayCommand(x =>
            {
                var configs = ProjectSettings.Configurations;
                if (SelectedConfigurationIndex >= 0 && SelectedConfigurationIndex + 1 < (configs?.Count ?? 0))
                {
                    var selectedIndex = SelectedConfigurationIndex;
                    var item          = configs[selectedIndex];
                    configs.RemoveAt(selectedIndex);
                    configs.Insert(++selectedIndex, item);
                    SelectedConfigurationIndex = selectedIndex;

                    OnPropertyChanged(nameof(Configurations));
                    OnPropertyChanged(nameof(RealConfigurations));
                }
            }, x => ProjectSettings.Configurations != null && SelectedConfigurationIndex >= 0 && SelectedConfigurationIndex + 1 < (ProjectSettings.Configurations?.Count ?? 0));
        }