Exemplo n.º 1
0
        public void Initialize(Dock workspace, Application app, GLib.Menu padMenu)
        {
            var      layers      = new LayersListWidget();
            DockItem layers_item = new DockItem(layers, "Layers")
            {
                Label = Translations.GetString("Layers")
            };

            var layers_tb = layers_item.AddToolBar();

            layers_tb.Add(PintaCore.Actions.Layers.AddNewLayer.CreateDockToolBarItem());
            layers_tb.Add(PintaCore.Actions.Layers.DeleteLayer.CreateDockToolBarItem());
            layers_tb.Add(PintaCore.Actions.Layers.DuplicateLayer.CreateDockToolBarItem());
            layers_tb.Add(PintaCore.Actions.Layers.MergeLayerDown.CreateDockToolBarItem());
            layers_tb.Add(PintaCore.Actions.Layers.MoveLayerUp.CreateDockToolBarItem());
            layers_tb.Add(PintaCore.Actions.Layers.MoveLayerDown.CreateDockToolBarItem());

            // TODO-GTK3 (docking)
#if false
            layers_item.Icon         = Gtk.IconTheme.Default.LoadIcon(Resources.Icons.LayerMergeDown, 16);
            layers_item.DefaultWidth = 100;
            layers_item.Behavior    |= DockItemBehavior.CantClose;
#endif
            workspace.AddItem(layers_item, DockPlacement.Right);

            var show_layers = new ToggleCommand("layers", Translations.GetString("Layers"), null, Resources.Icons.LayerMergeDown)
            {
                Value = true
            };
            app.AddAction(show_layers);
            padMenu.AppendItem(show_layers.CreateMenuItem());

            show_layers.Toggled += (val) => { layers_item.Visible = val; };
            layers_item.VisibilityNotifyEvent += (o, args) => { show_layers.Value = layers_item.Visible; };
        }
Exemplo n.º 2
0
        public void Initialize(Dock workspace, Application app, GLib.Menu padMenu)
        {
            var      history      = new HistoryTreeView();
            DockItem history_item = new DockItem(history, "History")
            {
                Label = Translations.GetString("History")
            };

            // TODO-GTK3 (docking)
#if false
            history_item.DefaultLocation = "Images/Bottom";
            history_item.Icon            = Gtk.IconTheme.Default.LoadIcon(Resources.Icons.LayerDuplicate, 16);
            history_item.DefaultWidth    = 100;
            history_item.Behavior       |= DockItemBehavior.CantClose;
#endif
            var history_tb = history_item.AddToolBar();
            history_tb.Add(PintaCore.Actions.Edit.Undo.CreateDockToolBarItem());
            history_tb.Add(PintaCore.Actions.Edit.Redo.CreateDockToolBarItem());

            workspace.AddItem(history_item, DockPlacement.Right);

            var show_history = new ToggleCommand("history", Translations.GetString("History"), null, Resources.Icons.LayerDuplicate)
            {
                Value = true
            };
            app.AddAction(show_history);
            padMenu.AppendItem(show_history.CreateMenuItem());

            show_history.Toggled += (val) => { history_item.Visible = val; };
            history_item.VisibilityNotifyEvent += (o, args) => { show_history.Value = history_item.Visible; };
        }
Exemplo n.º 3
0
        private void InitializeContext()
        {
            components = new System.ComponentModel.Container();

            CreateNotifyIcon();
            CreateMonitor();

            _logCommand = new ToggleCommand(
                new ActionCommand("Show Log", () => {
                _logForm = new LogForm();
                _logForm.Bind(_journalLog);
                _logForm.Show();
                _logForm.Closed += (s, ea) => _logCommand.Reset();
                _logCommand.Toggle();
            }
                                  ),
                new ActionCommand("Hide Log", () => {
                _logForm?.Close();
            }
                                  ),
                false
                );

            if (_configuration.AutoConnect)
            {
                SynchronizationContext.Current.Post(_ => _monitor.ControlCommand.Execute(), null);
            }
        }
Exemplo n.º 4
0
        public BooleanNotifierViewModel()
        {
            ToggleCommand.Subscribe(BooleanNotifier.SwitchValue).AddTo(DisposeCollection);
            ONCommand.Subscribe(BooleanNotifier.TurnOn).AddTo(DisposeCollection);
            OFFCommand.Subscribe(BooleanNotifier.TurnOff).AddTo(DisposeCollection);

            BooleanNotifier.Subscribe(_ => CountNotifier.Increment()).AddTo(DisposeCollection);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Called from the platform dependent renderers & interaction handlers
 /// to fire the toggle event to the button's user
 /// </summary>
 /// <param name="e"></param>
 protected /*async Task*/ void FireToggled(EventArgs e)
 {
     //await Task.Run(() =>
     //{
     //    Xamarin.Forms.Device.BeginInvokeOnMainThread(() =>
     //    {
     Toggled?.Invoke(this, e);
     ToggleCommand?.Execute(this);
     //    });
     //});
 }
Exemplo n.º 6
0
        public void SwitchToggleCommand(ToggleCommand command)
        {
            toggleCommand = command;

            switch (toggleCommand)
            {
            case ToggleCommand.EngineOn:
                text.text = "엔진 ON";
                break;

            case ToggleCommand.EngineOff:
                text.text = "엔진 OFF";
                break;

            case ToggleCommand.EngineReset:
                text.text = "엔진 RESET";
                break;

            default:
                text.text = "";
                break;
            }
        }
Exemplo n.º 7
0
        /**
         * The Toggle Command
         *
         * @return the Task<CommandResult> command result Task
         */
        public Task <CommandResult> ToggleCommand()
        {
            ToggleCommand command = new ToggleCommand();

            return(Send(command));
        }