Пример #1
0
        public EditorController(IEditorInterface panel, EditorModel model)
        {
            this.panel = panel;
            this.model = model;

            panel.ControlKeyDown += panel_KeyDown;
            panel.TimeSelected   += panel_TimeSelected;

            model.WindowState.SubsrcibeByExpression(z => z.Paused, PauseChanged);
            model.WindowState.SubsrcibeByExpression(z => z.CurrentMode, ModeChanged);
            model.WindowState.SubsrcibeByExpression(z => z.SpeedRatio, RatioChanged);
            model.WindowState.SubsrcibeByExpression(z => z.CurrentPosition, PositionChanged);
            model.WindowState.SubsrcibeByExpression(z => z.FaceVideoIsVisible, VideoVisibilityChanged);
            model.WindowState.SubsrcibeByExpression(z => z.DesktopVideoIsVisible, VideoVisibilityChanged);
            model.WindowState.SubsrcibeByExpression(z => z.ArrangeMode, ArrangeModeChanged);
            model.WindowState.SubsrcibeByExpression(z => z.CurrentPatch, CurrentPatchChanged);
            model.WindowState.SubsrcibeByExpression(z => z.VideoPatchPosition, VideoPatchPositionChanged);
            model.WindowState.SubsrcibeByExpression(z => z.PatchPlaying, PatchPlayingChanged);

            ModeChanged();
            RatioChanged();
            ArrangeModeChanged();
            VideoVisibilityChanged();
            CurrentPatchChanged();
            PositionChanged();
            VideoPatchPositionChanged();
            PauseChanged();

            panel.Face.Die();
            panel.Desktop.Die();
            panel.Patch.Die();

            if (model.Locations.FaceVideoThumb.Exists)
            {
                panel.Face.SetFile(model.Locations.FaceVideoThumb);
            }
            else if (model.Locations.FaceVideo.Exists)
            {
                panel.Face.SetFile(model.Locations.FaceVideo);
            }

            if (model.Locations.DesktopVideoThumb.Exists)
            {
                panel.Desktop.SetFile(model.Locations.DesktopVideoThumb);
            }
            else if (model.Locations.DesktopVideo.Exists)
            {
                panel.Desktop.SetFile(model.Locations.DesktopVideo);
            }


            timer          = new DispatcherTimer();
            timer.Interval = TimeSpan.FromMilliseconds(timerInterval);
            timer.Tick    += (s, a) => { CheckPlayTime(); };
            timer.Start();
        }
Пример #2
0
 public void RegisterEditor(IEditorInterface editorInterface)
 {
     EditorInterface = editorInterface;
 }
Пример #3
0
 public EntityParentedCommand(EntityParentedCommandArgs parameters, IEditorInterface editorInterface)
 {
     Args            = parameters;
     EditorInterface = editorInterface;
 }
        private void ObjectToControls()
        {
            IgnoreComponentChange = true;

            checkbuttonEnabled.Active = Notification.Enabled;
            entryName.Text            = Notification.Name;

            if (Notification is PatternNotification && (Notification as PatternNotification).PatterConfigurable)
            {
                LoadPatterns((Notification as PatternNotification).Pattern);
            }
            else
            {
                table2.Remove(labelPattern);
                table2.Remove(comboboxPattern);
                table2.Remove(buttonEditPatterns);

                if (Notification is DeviceNotification)
                {
                    table2.NRows -= 1;
                }
            }

            if (Notification is DeviceNotification)
            {
                if (((DeviceNotification)Notification).BlinkStickSerial == "" || ((DeviceNotification)Notification).BlinkStickSerial == null)
                {
                    if (this.DataModel.Devices.Count == 1)
                    {
                        deviceComboboxWidget.SelectBySerial(this.DataModel.Devices[0].Serial);
                    }
                }
                else
                {
                    deviceComboboxWidget.SelectBySerial(((DeviceNotification)Notification).BlinkStickSerial);
                }

                spinbuttonLedsFrom.Value = ((DeviceNotification)Notification).LedFirstIndex;
                spinbuttonLedsTo.Value   = ((DeviceNotification)Notification).LedLastIndex;
                comboboxChannel.Active   = ((DeviceNotification)Notification).LedChannel;
            }
            else
            {
                table2.Remove(labelBlinkStick);
                table2.Remove(deviceComboboxWidget);
                table2.Remove(labelLeds);
                table2.Remove(hboxLedConfiguration);
                table2.Remove(labelChannel);
                table2.Remove(hboxChannel);
                table2.NRows -= 4;
            }

            HSeparator hseparator;

            Type editorType = NotificationRegistry.FindEditorType(Notification.GetType());

            object editorWidgetObject = null;

            if (editorType != null)
            {
                editorWidgetObject = Activator.CreateInstance(editorType);
            }

            if (editorWidgetObject != null && editorWidgetObject is Widget)
            {
                Widget editorWidget = (Widget)editorWidgetObject;

                hseparator = new HSeparator();
                vbox3.PackEnd(hseparator);
                hseparator.ShowAll();

                if (editorWidget is IEditorInterface)
                {
                    editorInterface = (editorWidget as IEditorInterface);
                    editorInterface.SetNotification(Notification);
                }

                vbox3.PackEnd(editorWidget, true, true, 0);

                editorWidget.SizeAllocated += (o, args) => {
                    int x, y, w, h, myw, myh;
                    ParentForm.GetPosition(out x, out y);
                    ParentForm.GetSize(out w, out h);

                    GetSize(out myw, out myh);

                    this.GdkWindow.Move(x + (w - myw) / 2, y + (h - myh) / 2);
                };

                editorWidget.ShowAll();
            }

            OnDeviceComboboxWidgetDeviceChanged(null, null);

            hseparator = new HSeparator();
            vbox3.PackEnd(hseparator);
            hseparator.ShowAll();

            deviceComboboxWidget.Sensitive = this.ApplicationSettings.AllowModeChange;

            IgnoreComponentChange = false;
        }