Пример #1
0
        private void CreateCharacterBtns(char[] alph)
        {
            double bot   = 0;
            int    count = 0;

            for (int i = 0; i < alph.Length; i++, count++)
            {
                Button button = new Button();
                button.FontSize   = 20;
                button.FontWeight = FontWeight;
                button.HorizontalContentAlignment = HorizontalAlignment.Center;
                button.VerticalContentAlignment   = VerticalAlignment.Center;
                button.Height = button.Width = 38;
                button.HorizontalAlignment = HorizontalAlignment.Left;
                button.VerticalAlignment   = VerticalAlignment.Bottom;

                button.Content = alph[i].ToString();

                if ((count + 1) * button.Width > GameGrid.Width)
                {
                    count = 0;
                    bot  += button.Height;
                }

                button.Margin = new Thickness(count * button.Width, 0, 0, bot);
                button.Click += new RoutedEventHandler(CharacterBtnClick);

                Buttons.Add(button);

                GameGrid.Children.Add(button);
            }
        }
Пример #2
0
        void Build()
        {
            Title  = GettextCatalog.GetString("Template Categories");
            Width  = 640;
            Height = 480;

            var mainVBox = new VBox();

            mainVBox.Margin = 15;

            Content = mainVBox;

            // TreeView
            templateCategoriesWidget = new TemplateCategoriesWidget();
            mainVBox.PackStart(templateCategoriesWidget, true, true);

            // OK and Cancel buttons.
            cancelButton          = new DialogButton(Command.Cancel);
            cancelButton.Clicked += (sender, e) => Close();

            Buttons.Add(cancelButton);

            okButton           = new DialogButton(Command.Ok);
            okButton.Sensitive = false;
            Buttons.Add(okButton);
        }
Пример #3
0
 private void ShowWelcomePage()
 {
     Header       = Properties_Resources.Welcome;
     Description  = Properties_Resources.Intro;
     CancelButton = new NSButton()
     {
         Title = Properties_Resources.Cancel
     };
     ContinueButton = new NSButton()
     {
         Title   = Properties_Resources.Continue,
         Enabled = false
     };
     ContinueButton.Activated += delegate
     {
         Controller.SetupPageCompleted();
     };
     CancelButton.Activated += delegate
     {
         Controller.SetupPageCancelled();
     };
     Buttons.Add(ContinueButton);
     Buttons.Add(CancelButton);
     Controller.CheckSetupPage();
 }
Пример #4
0
        /// <summary> Creates toggle buttons for given <paramref name="enumerationItems"/>, with icons read from resources by their <paramref name="resourceKeys"/>. </summary>
        /// <param name="panel"> The panel to add buttons into. </param>
        /// <param name="enumerationItems"> Enumeration items to create toggle buttons for. </param>
        /// <param name="resourceKeys"> Resource keys for <paramref name="enumerationItems"/>. </param>
        /// <param name="styleKey"> The key of the style (defined in <see cref="WpfClient"/> and referenced by <see cref="EStyleKey"/>) to apply. </param>
        /// <param name="horizontal"> Whether to arrange buttons in a row or in a column. </param>
        /// <param name="createToggleAllButton"> Whether to create the toggle-all button. </param>
        public void CreateToggleButtonsWithImages(Panel panel, IEnumerable <T> enumerationItems, IDictionary <T, string> resourceKeys, string styleKey, bool horizontal = true, bool createToggleAllButton = false)
        {
            if (createToggleAllButton && enumerationItems.Any())
            {
                CreateToggleAllButton(panel, enumerationItems.First(), styleKey, horizontal);
            }

            foreach (var enumerationItem in enumerationItems)
            {
                var toggleButton = new ToggleButton
                {
                    Style   = this.GetStyle(styleKey),
                    Tag     = enumerationItem,
                    Content = new Image()
                    {
                        Source = Application.Current.MainWindow.FindResource(resourceKeys[enumerationItem]) as ImageSource,
                        Style  = this.GetStyle(EStyleKey.Image.FlagIcon),
                    },
                };

                toggleButton.Click += OnClick;
                toggleButton.AddToPanel(panel, horizontal);

                Buttons.Add(enumerationItem, toggleButton);
            }
        }
Пример #5
0
    private void InitButtons(string Name)
    {
        switch (Name)
        {
        case "Left":
            Buttons.Add(SetupButton(GetButtonNameByFunction(Name), InputManager.Instance.LeftButton.MainButton));
            Buttons.Add(SetupButton(GetButtonNameByFunction(Name, false), InputManager.Instance.LeftButton.AltButton));
            break;

        case "Right":
            Buttons.Add(SetupButton(GetButtonNameByFunction(Name), InputManager.Instance.RightButton.MainButton));
            Buttons.Add(SetupButton(GetButtonNameByFunction(Name, false), InputManager.Instance.RightButton.AltButton));
            break;

        case "Jump":
            Buttons.Add(SetupButton(GetButtonNameByFunction(Name), InputManager.Instance.UpButton.MainButton));
            Buttons.Add(SetupButton(GetButtonNameByFunction(Name, false), InputManager.Instance.UpButton.AltButton));
            break;

        case "Action":
            Buttons.Add(SetupButton(GetButtonNameByFunction(Name), InputManager.Instance.ActionButton.MainButton));
            Buttons.Add(SetupButton(GetButtonNameByFunction(Name, false), InputManager.Instance.ActionButton.AltButton));
            break;

        default:
            Debug.Log("Unknown key binding " + Name);
            break;
        }
    }
Пример #6
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public EditVariable(ParserItem _item, Request _request)
        {
            // Set title, icon, resizable
            Title     = Director.Properties.Resources.EditVariable;
            Icon      = Image.FromResource(DirectorImages.EDIT_CONTENT_ICON);
            Resizable = false;

            // Set variables
            ActiveItem    = _item;
            ActiveRequest = _request;
            Occurences    = new List <ParserOccurence>();
            FormatValues  = new List <FormatValue>();

            // Widht height
            Width  = 520;
            Height = 390;

            // Init components
            _initializeComponents();

            // Add buttons
            Buttons.Add(new DialogButton(Director.Properties.Resources.ConfirmInput, Command.Ok));
            Buttons.Add(new DialogButton(Director.Properties.Resources.Cancel, Command.Cancel));

            // Parse data
            ParseData();
        }
Пример #7
0
 public override void CreateDefaultButton()
 {
     Buttons.Add(new EditorButton(ButtonPredefines.Ellipsis)
     {
         IsDefaultButton = true
     });
 }
Пример #8
0
        private Button CreateOpenButton(int yOffset, int increment)
        {
            Button button = new Button();

            button.Location = new Point(10, yOffset);
            button.Text     = string.Format("Browse file {0}", increment + 1);
            button.Visible  = true;

            button.Click += (sender, e) =>
            {
                var dialog = openFileDialog;
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        string fileName = dialog.FileName;
                        Documents.Add(fileName);
                        Textboxes[increment].Text = fileName;
                    }
                    catch (System.IO.IOException)
                    {
                        MessageBox.Show("Uh-oh, something went wrong. Please try closing all the PDF files you want to import", "Import error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        richConsole.AppendText("Something went wrong, please try closing all the PDF files you want to import first.\n");
                    }
                }
            };

            Buttons.Add(button);

            return(button);
        }
    /// <summary>
    /// Create single button and add it to the list of buttons property
    /// </summary>
    /// <param name="item"></param>
    public void CreateSingleButton(string item)
    {
        if (Buttons == null)
        {
            Buttons = new List <Button>();
        }
        Button b = new Button
        {
            Name     = string.Concat(ButtonBaseName, item),
            Text     = item,
            Size     = ButtonSize,
            Location = new Point(25, this.Base),
            Parent   = ParentControl,
            Visible  = true
        };

        // wire up an event or have an event it gets wired too
        b.Click += (object s, EventArgs e) =>
        {
            //Button tb = (Button)s;
            //MessageBox.Show(tb.Text);
        };

        this.ParentControl.Controls.Add(b);
        Buttons.Add(b);
        Base += BaseAddition;
    }
Пример #10
0
        /// <summary>
        /// Add a button to this UI panel.
        /// </summary>
        /// <param name="b"></param>
        /// <param name="height"></param>
        public void AddButton(Button b)
        {
            int yOffset = Buttons.Count == 0 ? ButtonStartHeight : Buttons.Last().Value.Y + Buttons.Last().Key.Height + Y_BUTTON_BUFFER;
            int xOffset = (Bounds.Center.X - b.Size.X / 2) - Bounds.X;

            Buttons.Add(b, new Point(xOffset, yOffset));
        }
Пример #11
0
        public OpenFileDialogButton()
        {
            IsTextEditable     = false;
            AllowDefaultButton = false;

            Buttons.Add(new ButtonInfo()
            {
                GlyphKind = GlyphKind.Regular,
                Command   = new DelegateCommand(() =>
                {
                    OpenFileDialog openFileDialog = new OpenFileDialog();
                    openFileDialog.Filter         = FileFilter;

                    if (!String.IsNullOrEmpty(Text) && File.Exists(Text))
                    {
                        openFileDialog.FileName         = Path.GetFileName(Text);
                        openFileDialog.InitialDirectory = Path.GetDirectoryName(Text);
                    }

                    if (openFileDialog.ShowDialog() == true)
                    {
                        EditValue = openFileDialog.FileName;
                    }
                })
            });
        }
Пример #12
0
        public LogViewerHelpDialog()
        {
            var label = new Label("Log viewer help");

            label.Font = label.Font.WithSize(15).WithWeight(Xwt.Drawing.FontWeight.Bold);

            var markdown = new MarkdownView();

            using (var stream = typeof(LogViewerHelpDialog).Assembly.GetManifestResourceStream("Antmicro.Renode.Plugins.AdvancedLoggerViewer.LogViewerHelpFile.txt"))
            {
                using (var reader = new StreamReader(stream))
                {
                    markdown.Markdown = reader.ReadToEnd();
                }
            }

            var box = new VBox();

            box.PackStart(label);
            box.PackStart(markdown, true);

            Content = box;
            Buttons.Add(new DialogButton(Command.Ok));

            Width  = 1000;
            Height = 300;
        }
Пример #13
0
        public override void Load(ContentManager content)
        {
            font = content.Load <SpriteFont>(@"Fonts/SpriteFont");
            Button replay = new Button(content.Load <Texture2D>(@"TestObjects/kappa"), new Vector2(300, 250));

            Buttons.Add(replay);
        }
Пример #14
0
        /// <summary>
        /// 附加按钮多个
        /// </summary>
        /// <param name="buttons"></param>
        public virtual void MakeThisButtons(List <ModuleButton> buttons)
        {
            #region 基础按钮预处理
            if (Buttons == null)
            {
                Buttons = new List <ModuleButton>();
            }
            #endregion

            if (Buttons.Count == 0)
            {
                foreach (var button in buttons)
                {
                    button.TenantId = TenantId;
                    Buttons.Add(button);
                }
            }
            else
            {
                foreach (var button in buttons)
                {
                    //判断是不是重复
                    if (!HaveButton(button.ButtonKey))
                    {
                        button.TenantId = TenantId;
                        Buttons.Add(button);
                    }
                }
            }
        }
        void Build()
        {
            Title   = GettextCatalog.GetString("Select Projects");
            Width   = 420;
            Height  = 330;
            Padding = 20;

            var mainVBox = new VBox();

            Content = mainVBox;

            topLabel      = new Label();
            topLabel.Wrap = WrapMode.Word;
            mainVBox.PackStart(topLabel);

            projectsListView = new VBox();

            var projectsListScrollView = new ScrollView(projectsListView);

            projectsListScrollView.HorizontalScrollPolicy = ScrollPolicy.Never;
            projectsListScrollView.VerticalScrollPolicy   = ScrollPolicy.Automatic;
            projectsListScrollView.BorderVisible          = false;
            projectsListScrollView.BackgroundColor        = Ide.Gui.Styles.BackgroundColor;
            projectsListScrollView.Content = projectsListView;

            mainVBox.PackStart(projectsListScrollView, true, true);

            var cancelButton = new DialogButton(Command.Cancel);

            Buttons.Add(cancelButton);

            okButton           = new DialogButton(Command.Ok);
            okButton.Sensitive = false;
            Buttons.Add(okButton);
        }
Пример #16
0
        /// <summary>
        /// Создает новую панель принятия решения с указанными параметрами
        /// </summary>
        /// <param name="content">Управляющий контентом для этой панели</param>
        /// <param name="sprite">Спрайт, изображение панели</param>
        /// <param name="text">Текст, который отображается на панели</param>
        public ApplyPanel(Screen owner, ContentManager content, Sprite sprite, string text)
            : base(owner, content, sprite)
        {
            this.text = text;
            font      = content.Load <SpriteFont>(Fnames.PanelFont);
            bFont     = content.Load <SpriteFont>(Fnames.ButtonFont);

            Button Cancel = new Button(MultiSprite.CreateSprite(content, spriteBatch, Fnames.CancelB, new Vector2(Bounds.Left + (float)Bounds.Width / 5f * 2.8f, Bounds.Top + (float)Bounds.Height / 4f * 2.5f), new Vector2(128 * (float)Bounds.Width / 390f, 35 * (float)Bounds.Height / 240f), Vector2.One),
                                       CreateSound3D(content, Fnames.UIButtonClick),
                                       CreateSound3D(content, Fnames.UIButtonSelect),
                                       bFont);

            Cancel.Text          = "";
            Cancel.Visible       = false;
            Cancel.Click        += new EventHandler <MouseElementEventArgs>(Cancel_Click);
            Cancel.MouseMove    += new EventHandler <MouseElementEventArgs>(Button_MouseMove);
            Cancel.MouseMoveOut += new EventHandler <MouseElementEventArgs>(Button_MouseMoveOut);

            Button Apply = new Button(MultiSprite.CreateSprite(content, spriteBatch, Fnames.ApplyB, new Vector2(Bounds.Left + (float)Bounds.Width / 5f * 0.6f, Bounds.Top + (float)Bounds.Height / 4f * 2.5f), new Vector2(128 * (float)Bounds.Width / 390f, 35 * (float)Bounds.Height / 240f), Vector2.One),
                                      CreateSound3D(content, Fnames.UIButtonClick),
                                      CreateSound3D(content, Fnames.UIButtonSelect),
                                      bFont);

            Apply.Text          = "";
            Apply.Visible       = false;
            Apply.Click        += new EventHandler <MouseElementEventArgs>(Apply_Click);
            Apply.MouseMove    += new EventHandler <MouseElementEventArgs>(Button_MouseMove);
            Apply.MouseMoveOut += new EventHandler <MouseElementEventArgs>(Button_MouseMoveOut);

            Buttons.Add(Cancel);
            Buttons.Add(Apply);

            Components.AddRange(Buttons);
        }
Пример #17
0
        /// <summary>
        ///     Initializes the chat channels.
        /// </summary>
        public void InitializeChannel(ChatChannel channel, bool autoSelectChannel = true)
        {
            // Try to find an existing channel, if there is one, then update the incoming channel.
            var existingChannel = Overlay.ChannelMessageContainers.ToList().Find(x => x.Key.Name == channel.Name);

            if (existingChannel.Key != null)
            {
                existingChannel.Value.Channel = channel;
                return;
            }

            var button = new ChatChannelListButton(this, channel);

            // Calculate the y position of the channel
            button.Y = (ChatManager.JoinedChatChannels.Count - 1) * button.Height;

            // Automatically select the first channel that comes in.
            Overlay.ChannelMessageContainers.Add(channel, new ChatMessageContainer(Overlay, channel));

            if (autoSelectChannel)
            {
                button.SelectChatChannel();
            }
            else
            {
                // Reslect the current channel
                Overlay.ChannelMessageContainers[channel].Visible = false;
            }

            Buttons.Add(button);
            AddContainedDrawable(button);

            CalculateContainerHeight();
        }
Пример #18
0
        public MokeponListCanvas(List <Mokepon> pokemons)
        {
            poks = pokemons;
            if (pokemons.Count > 6)
            {
                throw new ApplicationException("Player has more than 6 Mokepons!");
            }

            if (pokemons.Count == 0)
            {
                throw new ApplicationException("Player has no Mokemons!");
            }

            Elements.Add(new Image("BlueBackground"));
            ButtonRows = 2;

            foreach (var pok in pokemons)
            {
                Buttons.Add(new MokeponOverview(pok, Vector2.Zero));
                HighlightEffect he = new HighlightEffect(Color.LightGray);
                (Buttons.Last() as MokeponOverview).Background.AddEffect("HighlightEffect", ref he);
            }

            for (int i = pokemons.Count; i < 6; ++i)
            {
                Elements.Add(new Image("White", new Rectangle(20 + (i / 2) * 420, 180 + (i % 2) * 220, 400, 200), 0.8f));
            }

            (Buttons[0] as MokeponOverview).Background.ActivateEffect("HighlightEffect");
        }
Пример #19
0
        private void SetupAddFinish()
        {
            // UI elements.
            Header      = Properties_Resources.Ready;
            Description = String.Format(Properties_Resources.YouCanFind, Properties_Resources.ApplicationName);

            TaskbarItemInfo.ProgressValue = 0.0;
            TaskbarItemInfo.ProgressState = TaskbarItemProgressState.None;

            Button finish_button = new Button()
            {
                Content = Properties_Resources.Finish
            };
            Button open_folder_button = new Button()
            {
                Content = Properties_Resources.OpenFolder
            };

            Buttons.Add(open_folder_button);
            Buttons.Add(finish_button);

            // Actions.
            finish_button.Click += delegate {
                Controller.FinishPageCompleted();
            };

            open_folder_button.Click += delegate {
                Controller.OpenFolderClicked();
            };

            SystemSounds.Exclamation.Play();
        }
        public ExecutionModeSelectorDialog()
        {
            Title = GettextCatalog.GetString("Execution Mode Selector");

            Width  = 500;
            Height = 400;

            var box = new VBox();

            Content = box;

            box.PackStart(new Label(GettextCatalog.GetString("Run Configurations:")));

            listConfigs = new RunConfigurationsList();
            box.PackStart(listConfigs, true);

            box.PackStart(new Label(GettextCatalog.GetString("Execution Modes:")));

            storeModes = new TreeStore(modeNameField, modeField, modeSetField);
            treeModes  = new TreeView(storeModes);
            treeModes.HeadersVisible = false;
            treeModes.Columns.Add(GettextCatalog.GetString("Name"), modeNameField);
            box.PackStart(treeModes, true);

            runButton = new DialogButton(new Command("run", GettextCatalog.GetString("Run")));

            Buttons.Add(Command.Cancel);
            Buttons.Add(runButton);

            listConfigs.SelectionChanged += (sender, e) => LoadModes();
            treeModes.SelectionChanged   += OnModeChanged;
        }
Пример #21
0
        public SelectSaveCanvas() : base()
        {
            Elements.Add(new Image("MainMenu/MenuBackground1", new Rectangle(0, 0, Globals.ScreenWidth, Globals.ScreenHeight)));
            Elements.Add(new Text("Select Game Save:", "Expression-pro-32px"));

            ButtonRows    = 2;
            CurrentButton = 0;

            for (int i = 0; i < 4; ++i)
            {
                Text saveText;
                if (File.Exists("Data/save" + i.ToString() + ".xml"))
                {
                    Gameplay.Player p = XmlManager.Instance.Load <Gameplay.Player>("Data/save" + i.ToString() + ".xml");
                    saveText = new Text(p.Name, "Expression-pro-32px");
                    Image playerImage = new Image("Character/" + p.BodyType, new Rectangle(32, 0, 32, 32), Vector2.Zero, 64, 64);
                    Elements.Add(playerImage);
                }
                else
                {
                    saveText = new Text("Empty Save", "Expression-pro-32px");
                }

                saveText.Color = Color.White;
                Buttons.Add(new Button(null, saveText));
            }

            Buttons[0].ButtonText.Color = Color.DimGray;
        }
Пример #22
0
        private void UpdateItemsSource(List <ApplicationBarIconButton> buttons, FlowDirection flowDirection)
        {
            if (buttons != null)
            {
                if (buttons.Count > 0)
                {
                    if (flowDirection == FlowDirection.RightToLeft)
                    {
                        buttons.Reverse();
                    }

                    Buttons.Dettach(SysAppBar);
                    Buttons.Clear();
                    foreach (ApplicationBarIconButton button in buttons)
                    {
                        Buttons.Add(button);
                    }

                    Buttons.Attach(DataContext, SysAppBar);
                }
            }
            else
            {
                Buttons.Dettach(SysAppBar);
                Buttons.Clear();
                Buttons.Attach(DataContext, SysAppBar);
            }
        }
Пример #23
0
        void Build()
        {
            Title = GettextCatalog.GetString("Rename");

            var mainVBox = new VBox();

            var mainHBox = new HBox();

            mainVBox.PackStart(mainHBox);

            var label = new Label();

            label.Text = GettextCatalog.GetString("New name:");
            mainHBox.PackStart(label);

            newNameTextEntry = new TextEntry();
            mainHBox.PackStart(newNameTextEntry);

            Content = mainVBox;

            var cancelButton = new DialogButton(Command.Cancel);

            Buttons.Add(cancelButton);

            okButton           = new DialogButton(Command.Ok);
            okButton.Sensitive = false;
            Buttons.Add(okButton);
        }
Пример #24
0
        private void GenerateDefaultIconList()
        {
            //Default Icons
            int item_index = -1;
            int columns    = 11;
            int item_count = BlockList.Count;
            int rows       = GetIdealItemRowCount(columns - 1, item_count + 1);

            for (int x = 0; x < rows; x++)
            {
                StackPanel stackPanel = new StackPanel();
                stackPanel.Background  = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#1C1C1C"));
                stackPanel.Orientation = Orientation.Horizontal;
                for (int y = 0; y < columns; y++)
                {
                    if (item_count > item_index)
                    {
                        var blockButton = CreateDefaultBlockButton(item_index);
                        Buttons.Add(blockButton);
                        stackPanel.Children.Add(blockButton);
                        item_index++;
                    }
                }
                DropdownItemPanel.Children.Add(stackPanel);
            }
        }
Пример #25
0
    private void PopulateToolbar()
    {
        ButtonClick += ToolbarButtonClick;

        ToolBarButton separator = new ToolBarButton();

        separator.Style = ToolBarButtonStyle.Separator;

        Action <string> AddButton = text =>
        {
            ToolBarButton button = new ToolBarButton();
            button.Text = text;
            Buttons.Add(button);
        };

        AddButton("Moon");
        AddButton("Sun");
        AddButton("Earth");
        Buttons.Add(separator);
        AddButton("Pause");
        AddButton("Slow");
        AddButton("Fast");
        Buttons.Add(separator);
        AddButton("Reset");
    }
Пример #26
0
        private void GenerateCustomIconList()
        {
            //Default Icons
            string[] files      = Directory.GetFiles(LauncherModel.Default.FilepathManager.GetCacheFolderPath(), "*.png");
            int      item_count = files.Length;

            if (item_count == 0)
            {
                return;
            }

            int item_index = 0;
            int columns    = 11;
            int rows       = GetIdealItemRowCount(columns - 1, item_count);


            for (int x = 0; x < rows; x++)
            {
                StackPanel stackPanel = new StackPanel();
                stackPanel.Background  = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#1C1C1C"));
                stackPanel.Orientation = Orientation.Horizontal;
                for (int y = 0; y < columns; y++)
                {
                    if (item_count > item_index)
                    {
                        var blockButton = CreateCustomBlockButton(files[item_index]);
                        Buttons.Add(blockButton);
                        stackPanel.Children.Add(blockButton);
                        item_index++;
                    }
                }
                DropdownItemPanel.Children.Add(stackPanel);
            }
        }
Пример #27
0
 public MainFragment()
 {
     Title   = "My Title";
     Message = "My Message";
     Buttons.Add(DialogsButton.Positive, "Valider");
     Buttons.Add(DialogsButton.Negative, "Annuler");
 }
Пример #28
0
        /// <summary>
        /// Change GUI elements when a new hero is selected
        /// </summary>
        void HeroSelected()
        {
            // Buttons already present
            if (Hero != null)
            {
                return;
            }


            Title = "Spells Available :";

            ScreenButton button;

            button           = new ScreenButton("Clear", new Rectangle(16, 244, 96, 28));
            button.Selected += new EventHandler(Clear_Selected);
            Buttons.Add(button);

            for (int i = 0; i < 6; i++)
            {
                Levels[i].IsVisible = true;
            }

            Levels[0].TextColor = GameColors.Red;
            SpellLevel          = 1;
        }
Пример #29
0
 void ShowFinishedPage()
 {
     Header           = Properties_Resources.Ready;
     Description      = Properties_Resources.YouCanFind;
     OpenFolderButton = new NSButton()
     {
         Title = String.Format("Open {0}", Path.GetFileName(Controller.PreviousPath))
     };
     FinishButton = new NSButton()
     {
         Title = Properties_Resources.Finish
     };
     OpenFolderButton.Activated += delegate
     {
         InvokeOnMainThread(delegate
         {
             Controller.OpenFolderClicked();
         });
     };
     FinishButton.Activated += delegate
     {
         InvokeOnMainThread(delegate
         {
             Controller.FinishPageCompleted();
         });
     };
     Buttons.Add(FinishButton);
     Buttons.Add(OpenFolderButton);
     NSApplication.SharedApplication.RequestUserAttention(NSRequestUserAttentionType.CriticalRequest);
 }
Пример #30
0
        public CommandBar(View parentView, int toolbarResource, HandleCommandDelegate handleDelegate)
        {
            // Save the command handling delegate
            commandDelegate = handleDelegate;

            // Create the toolbar
            Toolbar = parentView.FindViewById <Toolbar>(toolbarResource);

            if (Toolbar != null)
            {
                // Iterate through the children of this toolbar looking for ImageButton
                for (int index = 0; index < Toolbar.ChildCount; ++index)
                {
                    if (Toolbar.GetChildAt(index) is AppCompatImageButton imageButton)
                    {
                        // Get the name of the resource form the id and use it to form the name of the image resource
                        string[] packageSplit = Application.Context.Resources.GetResourceName(imageButton.Id).Split(':');
                        string   imageName    = string.Format("{0}:drawable/{1}", packageSplit[0], packageSplit[1].Split('/')[1]);

                        imageButton.SetImageResource(Application.Context.Resources.GetIdentifier(imageName, null, null));

                        // Store the button id and button in an hash table to enable them to be bound
                        Buttons.Add(imageButton.Id, imageButton);

                        imageButton.Click += ButtonClicked;
                    }
                }

                // Hide the toolbar initially
                Toolbar.Visibility = ViewStates.Gone;
            }
        }