Пример #1
0
        public HitsoundPreviewHelperVm()
        {
            _items = new ObservableCollection <HitsoundZone>();

            RhythmGuideCommand = new CommandImplementation(
                _ => {
                try {
                    if (_rhythmGuideWindow == null)
                    {
                        _rhythmGuideWindow         = new RhythmGuideWindow();
                        _rhythmGuideWindow.Closed += RhythmGuideWindowOnClosed;
                        _rhythmGuideWindow.Show();
                    }
                    else
                    {
                        _rhythmGuideWindow.Focus();
                    }
                } catch (Exception ex) { ex.Show(); }
            });
            AddCommand = new CommandImplementation(
                _ => {
                try {
                    var newZone = new HitsoundZone();
                    if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift))
                    {
                        var editor = EditorReaderStuff.GetBeatmapEditor(EditorReaderStuff.GetFullEditorReader(),
                                                                        out var selected);
                        if (selected.Count > 0)
                        {
                            newZone.XPos = selected[0].Pos.X;
                            newZone.YPos = editor.Beatmap.General["Mode"].IntValue == 3 ? -1 : selected[0].Pos.Y;
                        }
                        else
                        {
                            MessageBox.Show("Please select a hit object to fetch the coordinates.");
                        }
                    }
                    Items.Add(newZone);
                } catch (Exception ex) { ex.Show(); }
            });
            CopyCommand = new CommandImplementation(
                _ => {
                try {
                    int initialCount = Items.Count;
                    for (int i = 0; i < initialCount; i++)
                    {
                        if (Items[i].IsSelected)
                        {
                            Items.Add(Items[i].Copy());
                        }
                    }
                } catch (Exception ex) { ex.Show(); }
            });
            RemoveCommand = new CommandImplementation(
                _ => {
                try {
                    Items.RemoveAll(o => o.IsSelected);
                } catch (Exception ex) { ex.Show(); }
            });
        }
        public HitsoundPreviewHelperVM()
        {
            _items = new ObservableCollection <HitsoundZone>();

            RhythmGuideCommand = new CommandImplementation(
                _ => {
                try {
                    if (_rhythmGuideWindow == null)
                    {
                        _rhythmGuideWindow         = new RhythmGuideWindow();
                        _rhythmGuideWindow.Closed += RhythmGuideWindowOnClosed;
                        _rhythmGuideWindow.Show();
                    }
                    else
                    {
                        _rhythmGuideWindow.Focus();
                    }
                } catch (Exception ex) { MessageBox.Show(ex.Message); }
            });
            AddCommand = new CommandImplementation(
                _ => {
                try {
                    Items.Add(new HitsoundZone());
                } catch (Exception ex) { MessageBox.Show(ex.Message); }
            });
            CopyCommand = new CommandImplementation(
                _ => {
                try {
                    int initialCount = Items.Count;
                    for (int i = 0; i < initialCount; i++)
                    {
                        if (Items[i].IsSelected)
                        {
                            Items.Add(Items[i].Copy());
                        }
                    }
                } catch (Exception ex) { MessageBox.Show(ex.Message); }
            });
            RemoveCommand = new CommandImplementation(
                _ => {
                try {
                    Items.RemoveAll(o => o.IsSelected);
                } catch (Exception ex) { MessageBox.Show(ex.Message); }
            });
        }
Пример #3
0
 private void RhythmGuideWindowOnClosed(object sender, EventArgs e)
 {
     _rhythmGuideWindow = null;
 }