public EditorContext(IViewManagerPool pool)
 {
     IsRestored   = false;
     Pool         = pool;
     CurrentState = new TypingState(this);
     Caretaker    = new Caretaker(this);
 }
Exemple #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="musicLoader">We need the musicloader so it can set our staffs.</param>
        public StaffsViewModel(IViewManagerPool pool)
        {
            _viewManager = pool.GetInstance <PsamViewManager>();
            _viewManager.RegisterViewModel(this);

            Staffs = new ObservableCollection <MusicalSymbol>();
        }
        public LilypondViewModel(IViewManagerPool pool, EditorContext context, Invoker invoker)
        {
            _invoker = invoker;

            _context = context;
            _context.CurrentEditorContent = "Lilypond will appear here";

            _pressedKeys = new Shortcut();

            var viewManager = pool.GetInstance <LilypondViewManager>();

            viewManager.RegisterViewModel(this);

            _handler = new SaveToPdfHandler(_invoker, new Shortcut(Key.LeftCtrl, Key.P, Key.S), _context); // first
            var next = _handler.SetNext(new SaveToLilypondHandler(_invoker, new Shortcut(Key.LeftCtrl, Key.S), _context));

            _strategies = new Dictionary <string, ISaveStrategy>
            {
                { ".mid", new MidiSaveStrategy() },
                { ".pdf", new PdfSaveStrategy() },
                { ".ly", new LilypondSaveStrategy() }
            };

            // NOTE: LeftAlt is not working; something about Windows interfering as it expects ALT-F4 or some other menu bar item
            next = next.SetNext(new InsertHandler(_invoker, new Shortcut(Key.LeftCtrl, Key.LeftShift, Key.T, Key.D3), this, "\\time 3/6"));
            next = next.SetNext(new InsertHandler(_invoker, new Shortcut(Key.LeftCtrl, Key.LeftShift, Key.T, Key.D6), this, "\\time 6/8"));
            next = next.SetNext(new InsertHandler(_invoker, new Shortcut(Key.LeftCtrl, Key.LeftShift, Key.T, Key.D4), this, " \\time 4/4"));
            next = next.SetNext(new InsertHandler(_invoker, new Shortcut(Key.LeftCtrl, Key.LeftShift, Key.T), this, "\\time 4/4"));
            next = next.SetNext(new InsertHandler(_invoker, new Shortcut(Key.LeftCtrl, Key.LeftShift, Key.S), this, "\\tempo 4=120"));
            next = next.SetNext(new InsertHandler(_invoker, new Shortcut(Key.LeftCtrl, Key.LeftShift, Key.C), this, "\\clef treble"));
        }
Exemple #4
0
 public MusicLoader(IViewManagerPool pool)
 {
     _strategies = new Dictionary <string, IFileStrategy>
     {
         { ".mid", new MidiFileStrategy(new MidiLoadStrategy(pool)) },
         { ".ly", new LilypondFileStrategy(new LilypondLoadStrategy(pool)) }
     };
 }
Exemple #5
0
        public MidiPlayerViewModel(IViewManagerPool pool)
        {
            var viewManager = pool.GetInstance <MidiPlayerViewManager>();

            viewManager.RegisterViewModel(this);

            // The OutputDevice is a midi device on the midi channel of your computer.
            // The audio will be streamed towards this output.
            // DeviceID 0 is your computer's audio channel.
            _outputDevice = new OutputDevice(0);
            _sequencer    = new Sequencer();

            _sequencer.ChannelMessagePlayed += ChannelMessagePlayed;

            // Wanneer de sequence klaar is moeten we alles closen en stoppen.
            _sequencer.PlayingCompleted += (playingSender, playingEvent) =>
            {
                _sequencer.Stop();
                _running = false;
            };
        }
 public MidiLoadStrategy(IViewManagerPool pool)
 {
     _pool = pool;
 }
Exemple #7
0
 public LilypondLoadStrategy(IViewManagerPool pool)
 {
     _pool = pool;
 }