/// <summary>
        /// Setup View for the gameplay
        /// </summary>
        private void SetupView()
        {
            view         = new XnaUIFrame(this);
            view.DrawBox = new Rectangle(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT);
            MapView mainView = new MapView(this);

            mainView.DrawBox = new Rectangle(0, 0, 1280, 720);

            SelectionState selectionState = model.GetSelectionState();
            SelectionView  selectionView  = new SelectionView(this, selectionState);

            selectionView.DrawBox = new Rectangle(275, 520, 730, 200);
            SameSizeChildrenFlowLayout selectedEntityUIHolder = new SameSizeChildrenFlowLayout(this);

            selectedEntityUIHolder.DrawBox = new Rectangle(215, 25, 450, 150);
            selectionView.AddChild(selectedEntityUIHolder);

            CommandView commandView = new CommandView(this);

            commandView.DrawBox = new Rectangle(1005, 445, 275, 275);
            SameSizeChildrenFlowLayout commandViewButtonBox = new SameSizeChildrenFlowLayout(this);

            selectionView.commandBar = commandView;             // Register commandView to selection View

            view.AddChild(mainView);
            view.AddChild(selectionView);
            view.AddChild(commandView);
        }
示例#2
0
        void InitServerCommandView()
        {
            CommandView commandView;

            commandView = new CommandView();
            //grid_second.Children.Add(commandView);
        }
示例#3
0
        public static void ToggleCommand(ICommandView a, ICommandView b)
        {
            var c = new CommandView(a);

            SetCommand(a, b);
            SetCommand(b, c);
        }
示例#4
0
 private void CommandViewer_Load(object sender, EventArgs e)
 {
     if (mCommand != null)
     {
         CommandView.LoadCommand(mCommand);
     }
 }
示例#5
0
        public override void DoAction()
        {
            string[] command = CommandView.AskUser().ToArray();
            switch (command[0])
            {
            case "raise":
                try
                {
                    uint.Parse(command[1]);
                }
                catch (Exception)
                {
                    PrintMessageView.PrintNewLineMessage("Invalid data type!");
                    this.DoAction();
                    break;
                }
                if (uint.Parse(command[1]) > this.Balance)
                {
                    PrintMessageView.PrintNewLineMessage("Invalid amount! Amount must be lower than user's balance!");
                    this.DoAction();
                    break;
                }
                else
                {
                    base.Raise(uint.Parse(command[1]));
                }
                break;

            case "call":
                if (BetController.PlayerCanCall(this))
                {
                    base.Call();
                }
                break;

            case "fold": base.Fold(); break;

            case "stop":
            case "end": Engine.Playing = false; break;

            default: PrintMessageView.PrintNewLineMessage($"{Name} passed");
                ContextsData.MessageLogContext.AddMessageLog($"{Name} passed");
                break;
            }
        }
示例#6
0
        void button_Click(object sender, EventArgs e)
        {
            refresh.IsEnabled = false;

            Button selectedComponent = (Button)sender;

            Utility.componentIndex = Int32.Parse(selectedComponent.Content.ToString()) - 1;

            if ((string)selectedComponent.Tag == "Light")
            {
                Utility.componentIndex += Utility.lrDoors.Length;
            }

            selectedComponent = Utility.componentButtons[Utility.componentIndex];

            Component component = Utility.components[Utility.componentIndex];

            ModernDialog commandView = new CommandView(component, this);

            commandView.Buttons = new Button[] { commandView.CloseButton };

            Utility.refreshWorker.CancelAsync();

            commandView.ShowDialog();

            Utility.refreshWorker                            = new BackgroundWorker();
            Utility.refreshWorker.DoWork                    += commandResult;
            Utility.refreshWorker.RunWorkerCompleted        += new RunWorkerCompletedEventHandler(complete);
            Utility.refreshWorker.WorkerSupportsCancellation = true;
            Utility.refreshWorker.RunWorkerAsync();

            if (PanelLoading)
            {
                disableButtons();
            }

            else
            {
                refresh_Click(null, null);
                refresh.IsEnabled = true;
            }
        }
示例#7
0
        protected virtual void Compose()
        {
            var options = new AlignerOptions {
                Dimension       = Dimension.X,
                PointOrderDelta = 40,
                Collisions      = Collisions.NextFree //| Collisions.Toggle
            };

            Action action = () => Columns(options);

            LogicalLayoutLeafCommand = new CommandView {
                Action = (s) => {
                    action = () => LogicalLayoutLeaf(options);
                    action();
                },
                Image       = Iconery.LogicalLayoutLeaf,
                Size        = DefaultSize,
                ToolTipText = "arrange leaf of selected"
            };

            LogicalLayoutCommand = new CommandView {
                Action = (s) => {
                    action = () => LogicalLayout(options);
                    action();
                },
                Image       = Iconery.LogicalLayout,
                Size        = DefaultSize,
                ToolTipText = "arrange siblings of selected"
            };

            FullLayoutCommand = new CommandView {
                Action = (s) => {
                    action = () => FullLayout(options);
                    action();
                },
                Image       = Iconery.FullLayout,
                Size        = DefaultSize,
                ToolTipText = "arrange all"
            };

            ColumnsCommand = new CommandView {
                Action = (s) => {
                    action = () => Columns(options);
                    action();
                },
                Image       = Iconery.ArrageRows,
                Size        = DefaultSize,
                ToolTipText = "arrange in columns"
            };

            OneColumnCommand = new CommandView {
                Action = (s) => {
                    action = () => OneColumn(options);
                    action();
                },
                Image       = Iconery.ArrangeOneRow,
                Size        = DefaultSize,
                ToolTipText = "arrange in one column"
            };

            ArrangeLeftCommand = new CommandView {
                Action = (s) => {
                    options.AlignX = Alignment.Start;
                    action();
                },
                Image       = Iconery.ArrangeLeft,
                Size        = DefaultSize,
                ToolTipText = "align left"
            };

            ArrangeCenterCommand = new CommandView {
                Action = (s) => {
                    options.AlignX = Alignment.Center;
                    action();
                },
                Image       = Iconery.ArrangeCenter,
                Size        = DefaultSize,
                ToolTipText = "align center"
            };

            ArrangeRightCommand = new CommandView {
                Action = (s) => {
                    options.AlignX = Alignment.End;
                    action();
                },
                Image       = Iconery.ArrangeRight,
                Size        = DefaultSize,
                ToolTipText = "align rigth"
            };

            ArrangeTopCommand = new CommandView {
                Action = (s) => {
                    options.AlignY = Alignment.Start;
                    action();
                },
                Image       = Iconery.ArrangeTop,
                Size        = DefaultSize,
                ToolTipText = "align top"
            };

            ArrangeCenterVCommand = new CommandView {
                Action = (s) => {
                    options.AlignY = Alignment.Center;
                    action();
                },
                Image       = Iconery.ArrangeMiddle,
                Size        = DefaultSize,
                ToolTipText = "align middle"
            };

            ArrangeBottomCommand = new CommandView {
                Action = (s) => {
                    options.AlignY = Alignment.End;
                    action();
                },
                Image       = Iconery.ArrangeBottom,
                Size        = DefaultSize,
                ToolTipText = "align bottom"
            };

            DimensionXCommand = new CommandView {
                Action = (s) => {
                    options.Dimension = Dimension.X;
                    action();
                },
                Image       = Iconery.DimensionX,
                Size        = DefaultSize,
                ToolTipText = "arrange left to right"
            };

            DimensionYCommand = new CommandView {
                Action = (s) => {
                    options.Dimension = Dimension.Y;
                    action();
                },
                Image       = Iconery.DimensionY,
                Size        = DefaultSize,
                ToolTipText = "arrange top to bottom"
            };

            UndoCommand = new CommandView {
                Action      = (s) => Undo(),
                Size        = DefaultSize,
                Image       = Iconery.Undo,
                ToolTipText = "undo last arrange"
            };

            var horizontalButton = new ToolbarDropDownButton(ArrangeLeftCommand);

            horizontalButton.AddItems(
                new ToolbarButton(ArrangeCenterCommand)
            {
                ToggleOnClick = horizontalButton
            },
                new ToolbarButton(ArrangeRightCommand)
            {
                ToggleOnClick = horizontalButton
            }
                );

            var verticalButton = new ToolbarDropDownButton(ArrangeTopCommand);

            verticalButton.AddItems(
                new ToolbarButton(ArrangeCenterVCommand)
            {
                ToggleOnClick = verticalButton
            },
                new ToolbarButton(ArrangeBottomCommand)
            {
                ToggleOnClick = verticalButton
            }
                );

            var layoutButton = new ToolbarDropDownButton(LogicalLayoutLeafCommand);

            layoutButton.AddItems(
                new ToolbarButton(LogicalLayoutCommand)
            {
                ToggleOnClick = layoutButton
            },
                new ToolbarButton(ColumnsCommand)
            {
                ToggleOnClick = layoutButton
            },
                new ToolbarButton(OneColumnCommand)
            {
                ToggleOnClick = layoutButton
            },
                new ToolbarButton(FullLayoutCommand)
                );

            var dimensionButton = new ToolbarDropDownButton(DimensionXCommand);

            dimensionButton.AddItems(
                new ToolbarButton(DimensionYCommand)
            {
                ToggleOnClick = dimensionButton
            }
                );

            this.AddItems(
                layoutButton,
                horizontalButton,
                verticalButton,
                dimensionButton,
                new ToolbarButton(UndoCommand),
                new ToolbarSeparator()
                );
        }
示例#8
0
        protected virtual void Compose()
        {
            BoldButton = new ToolbarButton {
                IsCheckable = true
            };
            BoldCommand = new CommandView {
                Action = s => ToggleAttribute <FontWeightTextAttribute> (
                    (a, bold) => a.Weight = (bold ? FontWeight.Bold : FontWeight.Normal), BoldButton),
                Image       = Iconery.FontBoldIcon,
                Size        = DefaultSize,
                ToolTipText = "Bold"
            };
            BoldButton.SetCommand(BoldCommand);

            ItalicButton = new ToolbarButton {
                IsCheckable = true
            };
            ItalicCommand = new CommandView {
                Action = s => ToggleAttribute <FontStyleTextAttribute> (
                    (a, italic) => a.Style = (italic ? FontStyle.Italic : FontStyle.Normal), ItalicButton),
                Image       = Iconery.FontItalicIcon,
                Size        = DefaultSize,
                ToolTipText = "Italic"
            };
            ItalicButton.SetCommand(ItalicCommand);

            StrikeThroughButton = new ToolbarButton {
                IsCheckable = true
            };
            StrikeThroughCommand = new CommandView {
                Action = s => ToggleAttribute <StrikethroughTextAttribute> (
                    (a, value) => a.Strikethrough = value, StrikeThroughButton),
                Image       = Iconery.FontStrikeThroughIcon,
                Size        = DefaultSize,
                ToolTipText = "StrikeThrough"
            };
            StrikeThroughButton.SetCommand(StrikeThroughCommand);

            UnderlineButton = new ToolbarButton {
                IsCheckable = true
            };
            UnderlineCommand = new CommandView {
                Action = s => ToggleAttribute <UnderlineTextAttribute> (
                    (a, value) => a.Underline = value, UnderlineButton),
                Image       = Iconery.FontUnderlineIcon,
                Size        = DefaultSize,
                ToolTipText = "Underline"
            };
            UnderlineButton.SetCommand(UnderlineCommand);

            FontFamilyCombo = new ComboBox {
                Width = 100
            };
            Font.AvailableFontFamilies.ForEach(f =>
                                               FontFamilyCombo.Items.Add(f));
            FontFamilyCombo.SelectionChanged += (s, e) => {
                var attr = new FontDataAttribute {
                    FontFamily = FontFamilyCombo.SelectedItem as string
                };
                TextViewer.SetAttribute(attr);
            };

            var fontFamilyComboHost = new ToolbarItemHost {
                Child = FontFamilyCombo
            };

            FontSizeCombo = new ComboBox {
                Width = 50
            };
            new int[] { 6, 8, 10, 12, 14, 16, 18, 24, 32 }
            .ForEach(s => FontSizeCombo.Items.Add(s.ToString()));

            FontSizeCombo.SelectionChanged += (s, e) => {
                var i = -1d;
                if (FontSizeCombo.SelectedItem != null && double.TryParse(FontSizeCombo.SelectedItem.ToString(), out i))
                {
                    var attr = new FontDataAttribute {
                        FontSize = i
                    };
                    TextViewer.SetAttribute(attr);
                }
            };
            var fontSizeComboHost = new ToolbarItemHost {
                Child = FontSizeCombo
            };

            this.AddItems(BoldButton, ItalicButton, UnderlineButton, StrikeThroughButton,
                          fontFamilyComboHost, fontSizeComboHost);
        }
示例#9
0
 private void Awake()
 {
     Instance = this;
     content  = this.transform.Find("Content").GetComponent <RectTransform>();
     textView = content.transform.Find("Text").GetComponent <Text>();
 }
示例#10
0
        protected virtual void Compose()
        {
            Action <IDisplay, bool> selectAction  = (display, value) => display.SelectAction.Enabled = value;
            Action <IDisplay, bool> panningAction = (display, value) => display.MouseScrollAction.Enabled = value;

            var actionGroup = new List <Action <IDisplay, bool> > ();

            actionGroup.Add(selectAction);
            actionGroup.Add(panningAction);
            Action <Action <IDisplay, bool>, bool> toogleAction = (ga, value) => {
                foreach (var a in actionGroup)
                {
                    if (ga == a)
                    {
                        DisplayAction(d => a(d, value));
                    }
                    else
                    {
                        DisplayAction(d => a(d, !value));
                    }
                }
            };

            EditCommand = new CommandView {
                Action = s => {
                    if (SplitView != null && SplitView.ContentVidget != null)
                    {
                        SplitView.ContentVidget.SetFocus();
                    }
                    // dirty hack:
                    if (SplitView != null && SplitView.ContentVidget is IMarkdownEdit)
                    {
                        var md = (IMarkdownEdit)SplitView.ContentVidget;
                        if (md != null)
                        {
                            md.InEdit = !md.InEdit;
                        }
                        return;
                    }
                    // dirty hack end
                    toogleAction(selectAction, true);
                },
                Image       = Iconery.Select,
                Size        = DefaultSize,
                ToolTipText = "Edit"
            };

            PanningCommand = new CommandView {
                Action      = s => toogleAction(panningAction, true),
                Image       = Iconery.Panning,
                Size        = DefaultSize,
                ToolTipText = "Move"
            };

            ZoomInOutCommand = new CommandView {
                Image       = Iconery.Zoom,
                Size        = DefaultSize,
                ToolTipText = "Zoom"
            };

            FitToWidthCommand = new CommandView {
                Action = s => ZoomAction(d => d.ZoomState = ZoomState.FitToWidth),
                Image  = Iconery.FitToWidth,
                Size   = DefaultSize,
                Label  = "Fit to Width"
            };

            FitToHeigthCommand = new CommandView {
                Action = s => ZoomAction(d => d.ZoomState = ZoomState.FitToHeigth),
                Image  = Iconery.FitToHeigth,
                Size   = DefaultSize,
                Label  = "Fit to Heigth",
            };

            FitToScreenCommand = new CommandView {
                Action = s => ZoomAction(d => d.ZoomState = ZoomState.FitToScreen),
                Image  = Iconery.FitToScreen,
                Size   = DefaultSize,
                Label  = "Fit to Screen"
            };

            OriginalSizeCommand = new CommandView {
                Action = s => ZoomAction(d => d.ZoomState = ZoomState.Original),
                Image  = Iconery.OriginalSize,
                Size   = DefaultSize,
                Label  = "Original size"
            };


            var selectButton = new ToolbarDropDownButton(EditCommand);

            selectButton.AddItems(
                new ToolbarButton(PanningCommand)
            {
                ToggleOnClick = selectButton
            }
                );

            var zoomButton = new ToolbarDropDownButton(ZoomInOutCommand);

            zoomButton.AddItems(
                new ToolbarButton(FitToScreenCommand),
                new ToolbarButton(FitToWidthCommand),
                new ToolbarButton(FitToHeigthCommand),
                new ToolbarButton(OriginalSizeCommand)
                );

            this.AddItems(
                selectButton,
                zoomButton,
                new ToolbarSeparator()
                );
        }
示例#11
0
        protected virtual void Compose()
        {
            var size = new Xwt.Size(36, 36);

            GraphStreamViewCommand = new CommandView {
                Action      = s => ViewMode = SplitView.ViewMode = SplitViewMode.GraphContent,
                Image       = Iconery.GraphContentView,
                Size        = size,
                ToolTipText = "show contents"
            };
            GraphGraphViewCommand = new CommandView {
                Action      = s => ViewMode = SplitView.ViewMode = SplitViewMode.GraphGraph,
                Image       = Iconery.GraphGraphView,
                Size        = size,
                ToolTipText = "show tiled graph"
            };

            ToggleViewCommand = new CommandView {
                Action      = s => SplitView.ToggleView(),
                Image       = Iconery.ToggleView,
                Size        = size,
                ToolTipText = "toogle view"
            };

            OpenNewWindowCommand = new CommandView {
                Action      = s => SplitView.ShowInNewWindow(),
                Image       = Iconery.NewViewVisualNote,
                Size        = size,
                ToolTipText = "open new window"
            };

            Action <bool> goBackOrForward = backOrForward => {
                if (SplitView.CanGoBackOrForward(backOrForward))
                {
                    SplitView.GoBackOrForward(backOrForward);
                    CheckBackForward(SplitView);
                }
            };

            GoBackCommand = new CommandView {
                Action      = s => goBackOrForward(false),
                Image       = Iconery.GoPrevious,
                Size        = size,
                ToolTipText = "navigate back"
            };

            GoForwardCommand = new CommandView {
                Action      = s => goBackOrForward(true),
                Image       = Iconery.GoNext,
                Size        = size,
                ToolTipText = "navigate forward"
            };

            GoHomeCommand = new CommandView {
                Action      = s => SplitView.GoHome(),
                Image       = Iconery.GoHome,
                Size        = size,
                ToolTipText = "go to favorites"
            };

            NewSheetCommand = new CommandView {
                Action      = s => SplitView.NewSheet(),
                Image       = Iconery.NewSheet,
                Size        = size,
                ToolTipText = "new sheet"
            };

            NewNoteCommand = new CommandView {
                Action      = s => SplitView.NewNote(),
                Image       = Iconery.NewNote,
                Size        = size,
                ToolTipText = "new note"
            };

            SaveSheetCommand = new CommandView {
                Action      = s => SplitView.SaveDocument(),
                Image       = Iconery.SaveContent,
                Size        = size,
                ToolTipText = "save content"
            };

            GraphStreamViewButton = new ToolbarButton(GraphStreamViewCommand)
            {
                IsCheckable = true
            };
            GraphGraphViewButton = new ToolbarButton(GraphGraphViewCommand)
            {
                IsCheckable = true
            };
            var toggleViewButton = new ToolbarButton(ToggleViewCommand);
            var newWindowButton  = new ToolbarButton(OpenNewWindowCommand);

            GoBackButton    = new ToolbarButton(GoBackCommand);
            GoForwardButton = new ToolbarButton(GoForwardCommand);
            var goHomeButton    = new ToolbarButton(GoHomeCommand);
            var newSheetButton  = new ToolbarButton(NewSheetCommand);
            var newNoteButton   = new ToolbarButton(NewNoteCommand);
            var saveSheetButton = new ToolbarButton(SaveSheetCommand);

            SheetCombo = new ComboBox {
                Width = 100
            };

            var sheetComboHost = new ToolbarItemHost()
            {
                Child = SheetCombo
            };

            this.AddItems(
                sheetComboHost,
                saveSheetButton,

                new ToolbarSeparator(),
                GraphStreamViewButton,
                GraphGraphViewButton,
                toggleViewButton,

                new ToolbarSeparator(),
                GoBackButton,
                GoForwardButton,
                goHomeButton,
                new ToolbarSeparator(),
                newSheetButton,
                newNoteButton,
                newWindowButton,
                new ToolbarSeparator()
                );
        }