示例#1
0
        public LaunchpadWindow(Launchpad launchpad)
        {
            InitializeComponent();
            #if DEBUG
            this.AttachDevTools();
            #endif

            UpdateTopmost(Preferences.AlwaysOnTop);
            Preferences.AlwaysOnTopChanged += UpdateTopmost;

            _launchpad = launchpad;

            Title = TitleText.Text = TitleCenter.Text = _launchpad.Name;

            for (int i = 0; i < 100; i++)
            {
                Grid.SetColor(LaunchpadGrid.SignalToGrid(i), launchpad.GetColor(i).ToScreenBrush());
            }

            observables.Add(Grid.GetObservable(Visual.BoundsProperty).Subscribe(Grid_Updated));

            observables.Add(this.GetObservable(Visual.BoundsProperty).Subscribe(Bounds_Updated));
            observables.Add(TitleText.GetObservable(Visual.BoundsProperty).Subscribe(Bounds_Updated));
            observables.Add(TitleCenter.GetObservable(Visual.BoundsProperty).Subscribe(Bounds_Updated));
            observables.Add(CenteringLeft.GetObservable(Visual.BoundsProperty).Subscribe(Bounds_Updated));
            observables.Add(CenteringRight.GetObservable(Visual.BoundsProperty).Subscribe(Bounds_Updated));
        }
示例#2
0
        public TrackWindow(Track track)
        {
            InitializeComponent();
            #if DEBUG
            this.AttachDevTools();
            #endif

            UpdateTopmost(Preferences.AlwaysOnTop);
            Preferences.AlwaysOnTopChanged += UpdateTopmost;

            _track = track;

            ChainViewer chainViewer = new ChainViewer(_track.Chain);
            chainViewer.PointerWheelChanged += Track_Scroll;

            Selection = new SelectionManager(() => _track.Chain.Devices.FirstOrDefault());

            Root = chainViewer.Get <Grid>("Layout");
            UpdateContentAlignment(Preferences.CenterTrackContents);
            Preferences.CenterTrackContentsChanged += UpdateContentAlignment;

            Contents.Content = chainViewer;

            SetEnabled();

            observables.Add(this.GetObservable(Visual.BoundsProperty).Subscribe(Bounds_Updated));
            observables.Add(TitleText.GetObservable(Visual.BoundsProperty).Subscribe(Bounds_Updated));
            observables.Add(TitleCenter.GetObservable(Visual.BoundsProperty).Subscribe(Bounds_Updated));
            observables.Add(CenteringLeft.GetObservable(Visual.BoundsProperty).Subscribe(Bounds_Updated));
            observables.Add(CenteringRight.GetObservable(Visual.BoundsProperty).Subscribe(Bounds_Updated));
        }
示例#3
0
        public ProjectWindow()
        {
            InitializeComponent();
            #if DEBUG
            this.AttachDevTools();
            #endif

            UpdateTopmost(Preferences.AlwaysOnTop);
            Preferences.AlwaysOnTopChanged += UpdateTopmost;

            this.AddHandler(DragDrop.DropEvent, Drop);
            this.AddHandler(DragDrop.DragOverEvent, DragOver);

            for (int i = 0; i < Program.Project.Count; i++)
            {
                Contents_Insert(i, Program.Project[i]);
            }

            Selection = new SelectionManager(() => Program.Project.Tracks.FirstOrDefault());

            BPM.Text = Program.Project.BPM.ToString();
            observables.Add(BPM.GetObservable(TextBox.TextProperty).Subscribe(BPM_Changed));

            for (int i = 0; i < 4; i++)
            {
                ((Dial)MacroDials.Children[i]).RawValue = Program.Project.GetMacro(i + 1);
            }

            Author.Text = Program.Project.Author.ToString();
            observables.Add(Author.GetObservable(TextBox.TextProperty).Subscribe(Author_Changed));

            UpdateTime(null, EventArgs.Empty);
            Timer = new DispatcherTimer()
            {
                Interval = new TimeSpan(0, 0, 1)
            };
            Timer.Tick += UpdateTime;
            Timer.Start();

            Started.Text = $"Started {Program.Project.Started.LocalDateTime.ToString("MM/dd/yyyy HH:mm")}";

            observables.Add(this.GetObservable(Visual.BoundsProperty).Subscribe(Bounds_Updated));
            observables.Add(TitleText.GetObservable(Visual.BoundsProperty).Subscribe(Bounds_Updated));
            observables.Add(TitleCenter.GetObservable(Visual.BoundsProperty).Subscribe(Bounds_Updated));
            observables.Add(CenteringLeft.GetObservable(Visual.BoundsProperty).Subscribe(Bounds_Updated));
            observables.Add(CenteringRight.GetObservable(Visual.BoundsProperty).Subscribe(Bounds_Updated));
        }
示例#4
0
        public ProjectWindow()
        {
            InitializeComponent();
            #if DEBUG
            this.AttachDevTools();
            #endif

            UpdateTopmost(Preferences.AlwaysOnTop);
            Preferences.AlwaysOnTopChanged += UpdateTopmost;

            TrackContextMenu = (ContextMenu)this.Resources["TrackContextMenu"];
            TrackContextMenu.AddHandler(MenuItem.ClickEvent, TrackContextMenu_Click);

            this.AddHandler(DragDrop.DropEvent, Drop);
            this.AddHandler(DragDrop.DragOverEvent, DragOver);

            for (int i = 0; i < Program.Project.Count; i++)
            {
                Contents_Insert(i, Program.Project[i]);
            }

            BPM.Text = Program.Project.BPM.ToString();
            BPM.GetObservable(TextBox.TextProperty).Subscribe(BPM_Changed);

            Page.RawValue = Program.Project.Page;

            Author.Text = Program.Project.Author.ToString();
            Author.GetObservable(TextBox.TextProperty).Subscribe(Author_Changed);

            UpdateTime(null, EventArgs.Empty);
            Timer = new DispatcherTimer()
            {
                Interval = new TimeSpan(0, 0, 1)
            };
            Timer.Tick += UpdateTime;
            Timer.Start();

            Started.Text = $"Started {Program.Project.Started.LocalDateTime.ToString("MM/dd/yyyy HH:mm")}";

            this.GetObservable(Visual.BoundsProperty).Subscribe(Bounds_Updated);
            TitleText.GetObservable(Visual.BoundsProperty).Subscribe(Bounds_Updated);
            TitleCenter.GetObservable(Visual.BoundsProperty).Subscribe(Bounds_Updated);
            CenteringLeft.GetObservable(Visual.BoundsProperty).Subscribe(Bounds_Updated);
            CenteringRight.GetObservable(Visual.BoundsProperty).Subscribe(Bounds_Updated);
        }