public MFullScreenDialog(EvasObject parent) : base(parent)
        {
            Style = Styles.Popup.FullScreen;

            _titleLayout = new Layout(this);
            _titleLayout.SetTheme("layout", Styles.Material, Styles.Popup.FullScreenTitle);
            _titleLayout.EdjeObject.AddSignalAction(Signal.ActionClick, "*", (s, e) =>
            {
                Dismiss();
            });

            _actionButton = new MButton(this)
            {
                Style = Styles.Popup.PopupButton2,
            };
            _titleLayout.SetPartContent(Parts.Popup.ActionButton, _actionButton);

            _actionButton.Clicked += (s, e) =>
            {
                Dismiss();
                ActionClicked?.Invoke(this, EventArgs.Empty);
            };

            SetPartContent(Parts.Layout.Title, _titleLayout);

            MColors.AddColorSchemeComponent(this);
        }
Example #2
0
 public void Tutorial()
 {
     SetModal("Would you like to start the tutorial?", delegate()
     {
         ActionClicked?.Invoke(DisoFlowCoordinator.Action.Tutorial);
         parserParams.EmitEvent("hide-yn");
     });
     parserParams.EmitEvent("show-yn");
 }
 private void ActionItemControl_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     if (clicking)
     {
         ActionClicked?.Invoke(Action);
         // Clicked.
         clicking = false;
         UpdateBackground();
     }
 }
Example #4
0
        public MBanner(EvasObject parent) : base(parent)
        {
            AlignmentX = -1;
            AlignmentY = 0;
            WeightX    = 1;
            WeightY    = 0;

            _actionButton = new MPopupButton(this);

            _actionButton.Clicked += (s, e) =>
            {
                ActionClicked?.Invoke(this, EventArgs.Empty);
            };

            SetStyle(Styles.Banner.SingleLine);
            SetPartContent(Parts.Popup.ActionButton, _actionButton);
        }
Example #5
0
        public ArmyOrdersWindow(IGuiServices guiServices,
                                ITexts texts,
                                bool isTerrainActionButtonVisible,
                                bool isRecruitButtonVisible) : base(guiServices)
        {
            var dict = new Dictionary <string, Action <HandledEventArgs> >
            {
                {
                    texts.Get("move"), args =>
                    {
                        MoveClicked?.Invoke(args);
                        Closing?.Invoke(args);
                    }
                },
                {
                    texts.Get("fastMove"), args =>
                    {
                        FastMoveClicked?.Invoke(args);
                        Closing?.Invoke(args);
                    }
                },
                {
                    texts.Get("attack"), args =>
                    {
                        AttackClicked?.Invoke(args);
                        Closing?.Invoke(args);
                    }
                }
            };

            if (isRecruitButtonVisible)
            {
                dict.Add(texts.Get("recruit"), args =>
                {
                    RecruitClicked?.Invoke(args);
                    Closing?.Invoke(args);
                });
            }
            else
            {
                dict.Add(texts.Get("hunt"), args =>
                {
                    HuntClicked?.Invoke(args);
                    Closing?.Invoke(args);
                });
            }

            dict.Add(texts.Get("camp"), args =>
            {
                CampClicked?.Invoke(args);
                Closing?.Invoke(args);
            });

            dict.Add(texts.Get("equipment"), args =>
            {
                EquipmentClicked?.Invoke(args);
                Closing?.Invoke(args);
            });

            if (isTerrainActionButtonVisible)
            {
                dict.Add(texts.Get("action"), args =>
                {
                    ActionClicked?.Invoke(args);
                    Closing?.Invoke(args);
                });
            }

            dict.Add(texts.Get("exit"), args =>
            {
                ExitClicked?.Invoke(args);
                Closing?.Invoke(args);
            });

            ButtonNames = dict;
        }
        private void ManageFormat()
        {
            _hyperlinkToIndex.Clear();

            MyTextBlock.Inlines.Clear();
            if (Format != null)
            {
                var previousIndex = 0;
                var runCollection = new List <Inline>();
                foreach (Match match in _formatRegex.Matches(Format))
                {
                    if (previousIndex < match.Index)
                    {
                        MyTextBlock.Inlines.Add(new Run()
                        {
                            Text = Format.Substring(previousIndex, match.Index - previousIndex)
                        });
                    }

                    var index = int.Parse(match.Groups["index"].Value);



                    var hyperlink = new Hyperlink()
                    {
                        UnderlineStyle = _underlineStyle
                    };
                    hyperlink.Click += (sender, e) =>
                    {
                        if (_hyperlinkToIndex.TryGetValue(hyperlink, out int val))
                        {
                            if (val >= 0 && val < Values.Count)
                            {
                                var action = this.Values[val]?.Action;
                                if (action != null)
                                {
                                    ActionClicked?.Invoke(this, action);
                                }
                            }
                        }
                    };
                    _hyperlinkToIndex[hyperlink] = index;

                    var run = new Run();

                    //bind to Text
                    BindingOperations.SetBinding(run, RunExtension.TextProperty, new Binding()
                    {
                        Path   = new PropertyPath("Values[" + index + "].Text"),
                        Source = this
                    });


                    //bind foreground
                    BindingOperations.SetBinding(run, RunExtension.ForegroundProperty, new Binding()
                    {
                        Path   = new PropertyPath("ActionForeground"),
                        Source = this
                    });

                    //bind fontWeight
                    BindingOperations.SetBinding(run, RunExtension.FontWeightProperty, new Binding()
                    {
                        Path   = new PropertyPath("ActionFontWeight"),
                        Source = this
                    });
                    hyperlink.Inlines.Add(run);


                    //set text
                    MyTextBlock.Inlines.Add(hyperlink);

                    previousIndex = match.Index + match.Length;
                }

                if (previousIndex < Format.Length)
                {
                    MyTextBlock.Inlines.Add(new Run()
                    {
                        Text = Format.Substring(previousIndex)
                    });
                }
            }
        }
Example #7
0
 internal void ActionClickedInternal()
 {
     ActionClicked?.Invoke(this, EventArgs.Empty);
 }