private void AppBarButton_Click(object sender, RoutedEventArgs e)
        {
            AppBarToggleButton b = sender as AppBarToggleButton;

            if (b != null)
            {
                string name = b.Name;

                switch (name)
                {
                case "Button1":
                    Control1Output.Text = "IsChecked = " + b.IsChecked.ToString();
                    break;

                case "Button2":
                    Control2Output.Text = "IsChecked = " + b.IsChecked.ToString();
                    break;

                case "Button3":
                    Control3Output.Text = "IsChecked = " + b.IsChecked.ToString();
                    break;

                case "Button4":
                    Control4Output.Text = "IsChecked = " + b.IsChecked.ToString();
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        private void AppBarToggleButton_Checked(object sender, RoutedEventArgs e)
        {
            AppBarToggleButton favButton = sender as AppBarToggleButton;

            //if ((bool)favButton.IsChecked)
            //{
            //    var path = ApplicationData.Current.LocalFolder.Path + "/myDb1.DB";
            //    var con = new SQLiteAsyncConnection(path);
            //    //await con.InsertAllAsync(results);

            //    await con.QueryAsync<Result>(string.Format("insert into Result (name,name) values('{0}','{1}')", results[0].name, tblock.Text));
            //}
            //else
            //{

            //}
            if ((bool)favButton.IsChecked)
            {
                var path = ApplicationData.Current.LocalFolder.Path + "/myDb1.DB";
                var con  = new SQLiteAsyncConnection(path);
                con.QueryAsync <Favourite>(string.Format("insert into Favourite (placeName,userName) values('{0}','{1}')", results[0].name, tblock.Text));
            }
            else if (!(bool)favButton.IsChecked)
            {
                var path = ApplicationData.Current.LocalFolder.Path + "/myDb1.DB";
                var con  = new SQLiteAsyncConnection(path);
                con.QueryAsync <Favourite>(string.Format("delete from Favourite where placeName = '{0}' and username='******'", results[0].name, tblock.Text));
            }
        }
Ejemplo n.º 3
0
 private void ToggleButtons(AppBarToggleButton s)
 {
     foreach (AppBarToggleButton Btn in MasterCommands.Where(x => x != s))
     {
         Btn.IsChecked = false;
     }
     s.IsChecked = true;
 }
Ejemplo n.º 4
0
        private void AppBarToggleButtonBold_Click(object sender, RoutedEventArgs e)
        {
            AppBarToggleButton toggleButton = sender as AppBarToggleButton;
            bool isChecked = toggleButton.IsChecked.HasValue ?
                             (bool)toggleButton?.IsChecked.Value : false;

            textBlockCaption.FontWeight = isChecked ? FontWeights.Bold : FontWeights.Normal;
        }
Ejemplo n.º 5
0
        private void ReleaseToggleButtons(AppBarToggleButton skip)
        {
            var items = PrimaryCommands.Where(r => r != skip && r.GetType() == typeof(AppBarToggleButton)).Cast <AppBarToggleButton>();

            foreach (var item in items)
            {
                item.IsChecked = false;
            }
        }
Ejemplo n.º 6
0
        private async void Toggle_Tapped(object sender, TappedRoutedEventArgs e)
        {
            JObject            command   = new JObject();
            AppBarToggleButton togglebtn = sender as AppBarToggleButton;

            if (togglebtn != null)
            {
                string name = togglebtn.Name;
                KeyValuePair <string, string> kvp;
                switch (name)
                {
                case "Headlights":
                    if (togglebtn.IsChecked.Value)
                    {
                        kvp = new KeyValuePair <string, string>("data", "true");
                    }
                    else
                    {
                        kvp = new KeyValuePair <string, string>("data", "false");
                    }

                    await this.SendCommandToCar("SetLights", kvp);

                    break;

                case "Camera":
                    if (togglebtn.IsChecked.Value)
                    {
                        kvp = new KeyValuePair <string, string>("data", "true");
                    }
                    else
                    {
                        kvp = new KeyValuePair <string, string>("data", "false");
                    }

                    await this.SendCommandToCar("SetCamera", kvp);

                    break;
                }
            }
            else
            {
                AppBarButton btn  = sender as AppBarButton;
                string       name = btn.Name;
                switch (name)
                {
                case "Horn":
                    await this.SendCommandToCar("SendBuzzer", new KeyValuePair <string, string>());

                    break;

                case "DeleteRoute":

                    break;
                }
            }
        }
 internal Control_GameMode(View_Main main, AppBarToggleButton play, AppBarToggleButton pause, AppBarButton forward, TextBlock status, Control_Output _output)
 {
     m_main    = main;
     m_play    = play;
     m_pause   = pause;
     m_forward = forward;
     m_status  = status;
     m_output  = _output;
 }
Ejemplo n.º 8
0
 public CardPage()
 {
     this.InitializeComponent();
     editToggle  = editeMode;
     image       = DeckImage;
     HeaderP     = HeaderPanel;
     HeaderB     = HeaderBar;
     fronttoggle = fronttoggleswitch;
     togle       = togleb;
 }
        private void NoteList_Loaded(object sender, RoutedEventArgs e)
        {
            var ff = new FontFamily("Segoe MDL2 Assets");

            DeleteNotes = new AppBarButton()
            {
                Label = "Delete Notes",
                Icon  = new FontIcon()
                {
                    Glyph = "", FontFamily = ff
                },
            };
            DeleteNotes.Click    += DeleteNotes_Click;
            DeleteNotes.IsEnabled = false;
            ParentCommandBar.PrimaryCommands.Add(DeleteNotes);

            EditNote = new AppBarButton()
            {
                Label = "Edit Note",
                Icon  = new FontIcon()
                {
                    Glyph = "", FontFamily = ff
                },
            };
            EditNote.Click    += EditNote_Click;
            EditNote.IsEnabled = false;
            ParentCommandBar.PrimaryCommands.Add(EditNote);

            SyncPosition = new AppBarButton()
            {
                Label = "Goto note",
                Icon  = new FontIcon()
                {
                    Glyph = "", FontFamily = ff
                },
            };
            SyncPosition.Click    += SyncPosition_Click;
            SyncPosition.IsEnabled = false;
            ParentCommandBar.PrimaryCommands.Add(SyncPosition);

            Seperator = new AppBarSeparator();
            ParentCommandBar.PrimaryCommands.Add(Seperator);

            NotesFromAllBooks = new AppBarToggleButton()
            {
                Label = "Notes from all books",
                Icon  = new FontIcon()
                {
                    Glyph = "", FontFamily = ff
                },
                IsChecked = false,
            };
            NotesFromAllBooks.Click += ShowAllBooksNotes_Click;
            ParentCommandBar.PrimaryCommands.Add(NotesFromAllBooks);
        }
Ejemplo n.º 10
0
 private void UncheckTopToolbarButtons(AppBarToggleButton button)
 {
     foreach (var item in TopToolbarMenu.PrimaryCommands)
     {
         var btn = item as AppBarToggleButton;
         if (btn != null && btn != button)
         {
             btn.IsChecked = false;
         }
     }
 }
Ejemplo n.º 11
0
        protected ICommandBarElement CreateAppBarToggleButton(string label, RoutedEventHandler eventHandler)
        {
            var command = new AppBarToggleButton {
                Label = label
            };

            ToolTipService.SetToolTip(command, label);
            command.Checked   += eventHandler;
            command.Unchecked += eventHandler;
            return(command);
        }
Ejemplo n.º 12
0
        // AppBarToggleButton をRadioButton として扱う
        void SetAlignAppBarRadioButton(object sender)
        {
            AppBarToggleButton radioButton = sender as AppBarToggleButton;

            foreach (AppBarToggleButton b in alignmentPanel.Children)
            {
                if (!radioButton.Equals(b))
                {
                    b.IsChecked = false;
                }
            }
        }
Ejemplo n.º 13
0
        private async void OpenFileButton_Click(object sender, RoutedEventArgs e)
        {
            var fileOpener = new FileOpenPicker();

            fileOpener.FileTypeFilter.Add(".k16");
            fileOpener.FileTypeFilter.Add(".k08");
            fileOpener.FileTypeFilter.Add(".k01");
            fileOpener.FileTypeFilter.Add(".f12");
            fileOpener.FileTypeFilter.Add(".f10");

            StorageFile file = await fileOpener.PickSingleFileAsync();

            if (file != null)
            {
                _game.IsWorking = false;
                _game.FileHelper.FileLoad(file);
            }
            if (_game.FileHelper.Frez == FileHelper.FrezType.K)
            {
                MillingTypeButton.IsChecked = false;
            }
            else if (_game.FileHelper.Frez == FileHelper.FrezType.F)
            {
                MillingTypeButton.IsChecked = true;
            }

            LastMillingDiameterButton.IsChecked = false;
            if (_game.FileHelper.Diameter == 16)
            {
                Mill16Button.IsChecked    = true;
                LastMillingDiameterButton = Mill16Button;
            }
            if (_game.FileHelper.Diameter == 8)
            {
                Mill8Button.IsChecked     = true;
                LastMillingDiameterButton = Mill8Button;
            }
            if (_game.FileHelper.Diameter == 1)
            {
                Mill1Button.IsChecked     = true;
                LastMillingDiameterButton = Mill1Button;
            }
            if (_game.FileHelper.Diameter == 12)
            {
                Mill12Button.IsChecked    = true;
                LastMillingDiameterButton = Mill12Button;
            }
            if (_game.FileHelper.Diameter == 10)
            {
                Mill10Button.IsChecked    = true;
                LastMillingDiameterButton = Mill10Button;
            }
        }
Ejemplo n.º 14
0
        public GamePage()
        {
            this.InitializeComponent();

            // Create the game.
            var launchArguments = string.Empty;

            _game = MonoGame.Framework.XamlGame <MillingMachine> .Create(launchArguments, Window.Current.CoreWindow, swapChainPanel);

            this.DataContext          = _game;
            LastMillingDiameterButton = Mill16Button;
            IsInitiated = true;
        }
 internal Control_Output(View_Main _main, StackPanel _stack, ScrollViewer _scroll, AppBarToggleButton _collapse, AppBarToggleButton _filterMessages, AppBarToggleButton _filterWarnings, AppBarToggleButton _filterErrors, AppBarToggleButton _pauseError, AppBarToggleButton _clearPlay)
 {
     m_main           = _main;
     m_status         = m_main.m_Status_Content;
     m_stack          = _stack;
     m_scroll         = _scroll;
     m_collapse       = _collapse;
     m_filterMessages = _filterMessages;
     m_filterWarnings = _filterWarnings;
     m_filterErrors   = _filterErrors;
     m_pauseError     = _pauseError;
     m_ClearPlay      = _clearPlay;
 }
Ejemplo n.º 16
0
        private void chooseClicked(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            AppBarToggleButton bt = sender as AppBarToggleButton;

            if (bt.IsChecked.Value)
            {
                model.Selecting = ListViewSelectionMode.Multiple;
            }
            else
            {
                model.Selecting = ListViewSelectionMode.Single;
            }
        }
        protected override void OnApplyTemplate()
        {
            // This is where you would get your custom button and create an event handler for its click method.
            Button             myFullButton     = GetTemplateChild("myFullWindowButton") as Button;
            Button             myDownloadButton = GetTemplateChild("myDownloadButton") as Button;
            Button             myLiveButton     = GetTemplateChild("myLiveButton") as Button;
            AppBarToggleButton myDanmakuButton  = GetTemplateChild("myDanmakuButton") as AppBarToggleButton;

            myFullButton.Click     += MyFullButton_Click;
            myDownloadButton.Click += MyDownloadButton_Click;
            myLiveButton.Click     += MyLiveButton_Click;
            myDanmakuButton.Click  += MyDanmakuButton_Click;
            base.OnApplyTemplate();
        }
Ejemplo n.º 18
0
        private void ShowMonster(object sender, RoutedEventArgs e)
        {
            AppBarToggleButton button = sender as AppBarToggleButton;

            if (button.IsChecked == true)
            {
                monsterMapList.Show();
            }
            else
            {
                monsterMapList.Remove();
            }
            setSize(Window.Current.Bounds.Width);
        }
Ejemplo n.º 19
0
        private void VideoToggleButton_Checked(object sender, RoutedEventArgs e)
        {
            AppBarToggleButton b = sender as AppBarToggleButton;

            if (b.IsChecked == true)
            {
                MS2Tester.Instance.startVideoStream(LocalVideo, RemoteVideo);
                Run.IsEnabled = false;
            }
            else
            {
                MS2Tester.Instance.stopVideoStream();
                Run.IsEnabled = true;
            }
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Toggles the symbol icon button.
        /// </summary>
        /// <param name="on">
        /// A value indicating whether to toggle on.
        /// </param>
        /// <returns>
        /// The <see cref="AppBarToggleButtonPage"/>.
        /// </returns>
        public AppBarToggleButtonPage ToggleSymbolIconButton(bool on)
        {
            AppBarToggleButton toggle = this.WindowsApp.FindElement(this.symbolIconQuery);

            if (on)
            {
                toggle.ToggleOn();
            }
            else
            {
                toggle.ToggleOff();
            }

            return(this);
        }
Ejemplo n.º 21
0
        private void Search(object sender, RoutedEventArgs e)
        {
            AppBarToggleButton btn = (AppBarToggleButton)sender;

            search.Visibility = (btn.IsChecked.Value) ? Visibility.Visible : Visibility.Collapsed;
            list.Margin       = new Thickness(0, (btn.IsChecked.Value) ? 55 : 0, 0, 0);
            if (!btn.IsChecked.Value)
            {
                list.DataContext = Core.items;
            }
            else
            {
                list.DataContext = resultItems;
            }
        }
Ejemplo n.º 22
0
        void AppBarButtonPage_Loaded(object sender, RoutedEventArgs e)
        {
            // Add compact button to the command bar. It provides functionality specific
            // to this page, and is removed when leaving the page.

            CommandBar appBar = NavigationRootPage.Current.TopCommandBar;

            separator = new AppBarSeparator();
            appBar.PrimaryCommands.Insert(0, separator);

            compactButton        = new AppBarToggleButton();
            compactButton.Icon   = new SymbolIcon(Symbol.FontSize);
            compactButton.Label  = "IsCompact";
            compactButton.Click += CompactButton_Click;
            appBar.PrimaryCommands.Insert(0, compactButton);
        }
Ejemplo n.º 23
0
        private void ShowAlly(object sender, RoutedEventArgs e)
        {
            AppBarToggleButton button = sender as AppBarToggleButton;

            if (button.IsChecked == true)
            {
                userMapList.Show();
                App.core.mapCore.ShowAllyLocation();
            }
            else
            {
                userMapList.Remove();
                App.core.mapCore.ColapseAllyLocation();
            }
            setSize(Window.Current.Bounds.Width);
        }
Ejemplo n.º 24
0
        private void OnConnectionEstablished()
        {
            AppBarButton connectBtn = App.AppCommandBar.PrimaryCommands.ToList().FirstOrDefault(i => i is AppBarButton && ((AppBarButton)i).Name == "ConnectDevice") as AppBarButton;

            connectBtn.Visibility = Visibility.Collapsed;

            AppBarButton refreshBtn = App.AppCommandBar.PrimaryCommands.ToList().FirstOrDefault(i => i is AppBarButton && ((AppBarButton)i).Name == "RefreshDeviceList") as AppBarButton;

            refreshBtn.Visibility = Visibility.Collapsed;

            AppBarButton disconnectBtn = App.AppCommandBar.PrimaryCommands.ToList().FirstOrDefault(i => i is AppBarButton && ((AppBarButton)i).Name == "DisconnectDevice") as AppBarButton;

            disconnectBtn.Visibility = Visibility.Visible;

            AppBarSeparator seperator1 = App.AppCommandBar.PrimaryCommands.ToList().FirstOrDefault(i => i is AppBarSeparator && ((AppBarSeparator)i).Name == "sperator1") as AppBarSeparator;

            seperator1.Visibility = Visibility.Collapsed;

            AppBarSeparator seperator2 = App.AppCommandBar.PrimaryCommands.ToList().FirstOrDefault(i => i is AppBarSeparator && ((AppBarSeparator)i).Name == "sperator2") as AppBarSeparator;

            seperator2.Visibility = Visibility.Visible;

            AppBarToggleButton headlights = App.AppCommandBar.PrimaryCommands.ToList().FirstOrDefault(i => i is AppBarToggleButton && ((AppBarToggleButton)i).Name == "Headlights") as AppBarToggleButton;

            headlights.Visibility = Visibility.Visible;

            if (App.AppData.ConnectedAucovei.IsNewGeneration)
            {
                AppBarToggleButton camera =
                    App.AppCommandBar.PrimaryCommands.ToList().FirstOrDefault(i =>
                                                                              i is AppBarToggleButton && ((AppBarToggleButton)i).Name == "Camera") as AppBarToggleButton;
                camera.Visibility = Visibility.Visible;
            }

            //AppBarButton deleteroute = App.AppCommandBar.PrimaryCommands.ToList().FirstOrDefault(i => i is AppBarButton && ((AppBarButton)i).Name == "DeleteRoute") as AppBarButton;
            //deleteroute.Visibility = Visibility.Visible;

            AppBarButton hornBtn = App.AppCommandBar.PrimaryCommands.ToList().FirstOrDefault(i => i is AppBarButton && ((AppBarButton)i).Name == "Horn") as AppBarButton;

            hornBtn.Visibility = Visibility.Visible;

            this.rootPage.NotifyUser("Connected to " + App.AppData.ConnectedAucovei.DisplayName + "!", NotifyType.StatusMessage);

            this.rootPage.UpdateNavigation(1);
            this.Frame.Navigate(typeof(AddWaypoints));
        }
Ejemplo n.º 25
0
        private void NoteList_Unloaded(object sender, RoutedEventArgs e)
        {
            ParentCommandBar.PrimaryCommands.Remove(DeleteNotes);
            DeleteNotes = null;

            ParentCommandBar.PrimaryCommands.Remove(EditNote);
            EditNote = null;

            ParentCommandBar.PrimaryCommands.Remove(SyncPosition);
            SyncPosition = null;

            ParentCommandBar.PrimaryCommands.Remove(Seperator);
            Seperator = null;

            ParentCommandBar.PrimaryCommands.Remove(NotesFromAllBooks);
            NotesFromAllBooks = null;
        }
Ejemplo n.º 26
0
        private void DisconnectBtn_Click(object sender, RoutedEventArgs e)
        {
            this.ResetAppLevelParameters();
            this.rootPage.UpdateNavigation(0);

            AppBarButton refreshBtn = App.AppCommandBar.PrimaryCommands.ToList().FirstOrDefault(i => i is AppBarButton && ((AppBarButton)i).Name == "RefreshDeviceList") as AppBarButton;

            refreshBtn.Visibility = Visibility.Visible;

            AppBarButton disconnectBtn = App.AppCommandBar.PrimaryCommands.ToList().FirstOrDefault(i => i is AppBarButton && ((AppBarButton)i).Name == "DisconnectDevice") as AppBarButton;

            disconnectBtn.Visibility = Visibility.Collapsed;

            AppBarSeparator seperator = App.AppCommandBar.PrimaryCommands.ToList().FirstOrDefault(i => i is AppBarSeparator && ((AppBarSeparator)i).Name == "sperator1") as AppBarSeparator;

            seperator.Visibility = Visibility.Collapsed;

            AppBarButton connectBtn = App.AppCommandBar.PrimaryCommands.ToList().FirstOrDefault(i => i is AppBarButton && ((AppBarButton)i).Name == "ConnectDevice") as AppBarButton;

            connectBtn.Visibility = Visibility.Visible;

            AppBarSeparator seperator1 = App.AppCommandBar.PrimaryCommands.ToList().FirstOrDefault(i => i is AppBarSeparator && ((AppBarSeparator)i).Name == "sperator1") as AppBarSeparator;

            seperator1.Visibility = Visibility.Collapsed;

            AppBarSeparator seperator2 = App.AppCommandBar.PrimaryCommands.ToList().FirstOrDefault(i => i is AppBarSeparator && ((AppBarSeparator)i).Name == "sperator2") as AppBarSeparator;

            seperator2.Visibility = Visibility.Collapsed;

            AppBarToggleButton headlights = App.AppCommandBar.PrimaryCommands.ToList().FirstOrDefault(i => i is AppBarToggleButton && ((AppBarToggleButton)i).Name == "Headlights") as AppBarToggleButton;

            headlights.Visibility = Visibility.Collapsed;

            AppBarToggleButton camera = App.AppCommandBar.PrimaryCommands.ToList().FirstOrDefault(i => i is AppBarToggleButton && ((AppBarToggleButton)i).Name == "Camera") as AppBarToggleButton;

            camera.Visibility = Visibility.Collapsed;

            AppBarButton deleteroute = App.AppCommandBar.PrimaryCommands.ToList().FirstOrDefault(i => i is AppBarButton && ((AppBarButton)i).Name == "DeleteRoute") as AppBarButton;

            deleteroute.Visibility = Visibility.Collapsed;

            AppBarButton hornBtn = App.AppCommandBar.PrimaryCommands.ToList().FirstOrDefault(i => i is AppBarButton && ((AppBarButton)i).Name == "Horn") as AppBarButton;

            hornBtn.Visibility = Visibility.Collapsed;
        }
Ejemplo n.º 27
0
        public void ValidateAppBarButtonRevealStyles()
        {
            AppBarButton buttonLabelsOnRight = null;
            AppBarButton buttonOverflow      = null;

            AppBarToggleButton toggleButtonLabelsOnRight = null;
            AppBarToggleButton toggleButtonOverflow      = null;

            RunOnUIThread.Execute(() =>
            {
                var cmdBar = (CommandBar)XamlReader.Load(@"
                        <CommandBar xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
                            DefaultLabelPosition='Right'
                            IsOpen='True'>
                            <AppBarButton Label='button' Icon='Accept'/>
                            <AppBarToggleButton Label='button' Icon='Accept'/>
                            <CommandBar.SecondaryCommands>
                                <AppBarButton Label='Supercalifragilisticexpialidocious' Style='{StaticResource AppBarButtonRevealOverflowStyle}'/>
                                <AppBarToggleButton Label='Supercalifragilisticexpialidocious' Style='{StaticResource AppBarToggleButtonRevealOverflowStyle}'/>
                            </CommandBar.SecondaryCommands>
                        </CommandBar>");

                buttonLabelsOnRight = (AppBarButton)cmdBar.PrimaryCommands[0];
                buttonOverflow      = (AppBarButton)cmdBar.SecondaryCommands[0];

                toggleButtonLabelsOnRight = (AppBarToggleButton)cmdBar.PrimaryCommands[1];
                toggleButtonOverflow      = (AppBarToggleButton)cmdBar.SecondaryCommands[1];

                MUXControlsTestApp.App.TestContentRoot = cmdBar;
            });
            IdleSynchronizer.Wait();

            RunOnUIThread.Execute(() =>
            {
                const double expectedLabelsOnRightWidth = 84;
                const double expectedOverflowWidth      = 264;

                Verify.AreEqual(expectedLabelsOnRightWidth, buttonLabelsOnRight.ActualWidth);
                Verify.AreEqual(expectedOverflowWidth, buttonOverflow.ActualWidth);

                Verify.AreEqual(expectedLabelsOnRightWidth, toggleButtonLabelsOnRight.ActualWidth);
                Verify.AreEqual(expectedOverflowWidth, toggleButtonOverflow.ActualWidth);
            });
        }
Ejemplo n.º 28
0
        void AppBarButtonPage_Loaded(object sender, RoutedEventArgs e)
        {
            // Add compact button to the command bar. It provides functionality specific
            // to this page, and is removed when leaving the page.
            ItemPage itemPage = NavigationRootPage.RootFrame.Content as ItemPage;

            if (itemPage != null)
            {
                CommandBar appBar = itemPage.BottomAppBar as CommandBar;

                appBar.PrimaryCommands.Insert(0, new AppBarSeparator());

                compactButton        = new AppBarToggleButton();
                compactButton.Icon   = new SymbolIcon(Symbol.FontSize);
                compactButton.Label  = "IsCompact";
                compactButton.Click += CompactButton_Click;
                appBar.PrimaryCommands.Insert(0, compactButton);
            }
        }
        void AppBarButtonPage_Loaded(object sender, RoutedEventArgs e)
        {
            // Add compact button to the command bar. It provides functionality specific
            // to this page, and is removed when leaving the page.
            ItemPage itemPage = NavigationRootPage.RootFrame.Content as ItemPage;

            if (itemPage != null)
            {
                CommandBar appBar = itemPage.BottomCommandBar;

                appBar.PrimaryCommands.Insert(0, new AppBarSeparator());

                compactButton = new AppBarToggleButton();
                compactButton.Icon = new SymbolIcon(Symbol.FontSize);
                compactButton.Label = "IsCompact";
                compactButton.Click += CompactButton_Click;
                appBar.PrimaryCommands.Insert(0, compactButton);
            }
        }
Ejemplo n.º 30
0
        private void OptSave_Click(object sender, RoutedEventArgs e)
        {
            AppBarToggleButton[] opts = new AppBarToggleButton[] { optSaveSizeL, optSaveSizeM, optSaveSizeN, optSaveSizeS, optSaveSizeWindow };

            var btn       = sender as AppBarToggleButton;
            var SIZE_NAME = btn.Name.Substring(btn.Name.Length - 1).ToUpper();

            foreach (AppBarToggleButton opt in opts)
            {
                if (string.Equals(opt.Name, btn.Name, StringComparison.CurrentCultureIgnoreCase))
                {
                    opt.IsChecked = true;
                }
                else
                {
                    opt.IsChecked = false;
                }
            }
            switch (SIZE_NAME)
            {
            case "L":
                CURRENT_SIZE = 1024;
                break;

            case "M":
                CURRENT_SIZE = 512;
                break;

            case "N":
                CURRENT_SIZE = 256;
                break;

            case "S":
                CURRENT_SIZE = 128;
                break;

            default:
                CURRENT_SIZE = 0;
                break;
            }
        }
Ejemplo n.º 31
0
        private void MillingDiameterButton_Click(object sender, RoutedEventArgs e)
        {
            var b = (AppBarToggleButton)sender;

            LastMillingDiameterButton.IsChecked = false;
            b.IsChecked = true;
            switch (b.Name)
            {
            case "Mill16Button":
                _game.FileHelper.Diameter = 16;
                LastMillingDiameterButton = Mill16Button;
                break;

            case "Mill8Button":
                _game.FileHelper.Diameter = 8;
                LastMillingDiameterButton = Mill8Button;
                break;

            case "Mill1Button":
                _game.FileHelper.Diameter = 1;
                LastMillingDiameterButton = Mill1Button;
                break;

            case "Mill12Button":
                _game.FileHelper.Diameter = 12;
                LastMillingDiameterButton = Mill12Button;
                break;

            case "Mill10Button":
                _game.FileHelper.Diameter = 10;
                LastMillingDiameterButton = Mill10Button;
                break;

            default:
                break;
            }
        }
Ejemplo n.º 32
0
 protected static ICommandBarElement CreateAppBarToggleButton(string label, RoutedEventHandler eventHandler)
 {
     var command = new AppBarToggleButton { Label = label };
     ToolTipService.SetToolTip(command, label);
     command.Checked += eventHandler;
     command.Unchecked += eventHandler;
     return command;
 }
Ejemplo n.º 33
0
 private void ReleaseToggleButtons(AppBarToggleButton skip)
 {
     var items = PrimaryCommands.Where(r => r != skip && r.GetType() == typeof(AppBarToggleButton)).Cast<AppBarToggleButton>();
     foreach (var item in items)
     {
         item.IsChecked = false;
     }
 }
Ejemplo n.º 34
0
        private void CreateCommandBars()
        {
            var locator = App.Current.Resources["ViewModelLocator"] as ViewModelLocator;
            var vm = locator.AirportsPivotViewModel;

            this.favoritesCommandBar = new CommandBar();

            var selectFavoriteButton = new AppBarToggleButton()
                {
                    Icon = new SymbolIcon(Symbol.List),
                    Label = "select",
                    Name = "BtnSelectFavorites"
                };
            selectFavoriteButton.Checked += this.BtnSelectFavorites_Checked;
            selectFavoriteButton.Unchecked += this.BtnSelectFavorites_Unchecked;

            var refreshFavoriteButton = new AppBarButton()
            {
                Icon = new SymbolIcon(Symbol.Refresh),
                Label = "refresh",
                Command = vm.RefreshFavorites
            };

            var addFavoriteButton = new AppBarButton()
            {
                Icon = new SymbolIcon(Symbol.Add),
                Label = "add"
            };
            addFavoriteButton.Click += this.BtnAddFavorite_Click;

            this.deleteFavoritesButton = new AppBarButton()
            {
                Icon = new SymbolIcon(Symbol.Delete),
                Label = "delete",
                Visibility = Visibility.Collapsed
            };
            this.deleteFavoritesButton.Click += this.BtnDeleteFavorite_Click;

            var settingsButton = new AppBarButton()
            {
                Label = "settings"
            };
            settingsButton.Click += this.BtnSettings_Click;

            this.favoritesCommandBar.PrimaryCommands.Add(selectFavoriteButton);
            this.favoritesCommandBar.PrimaryCommands.Add(refreshFavoriteButton);
            this.favoritesCommandBar.PrimaryCommands.Add(addFavoriteButton);
            this.favoritesCommandBar.PrimaryCommands.Add(this.deleteFavoritesButton);

            this.favoritesCommandBar.SecondaryCommands.Add(settingsButton);

            this.flightPlansCommandBar = new CommandBar();

            var selectFlightPlanButton = new AppBarToggleButton()
            {
                Icon = new SymbolIcon(Symbol.List),
                Label = "select",
                Name = "BtnSelectFlightPlan"
            };
            selectFlightPlanButton.Checked += this.BtnSelectFlightPlans_Checked;
            selectFlightPlanButton.Unchecked += this.BtnSelectFlightPlans_Unchecked;

            var refreshFlightPlanButton = new AppBarButton()
             {
                 Icon = new SymbolIcon(Symbol.Refresh),
                 Label = "refresh"
             };

            var addFlightPlanButton = new AppBarButton()
            {
                Icon = new SymbolIcon(Symbol.Add),
                Label = "add"
            };
            addFlightPlanButton.Click += this.BtnAddFlightPlan_Click;

            this.deleteFlightPlansButton = new AppBarButton()
            {
                Icon = new SymbolIcon(Symbol.Delete),
                Label = "delete",
                Visibility = Visibility.Collapsed
            };
            this.deleteFlightPlansButton.Click += this.BtnDeleteFlightPlan_Click;


            this.flightPlansCommandBar.PrimaryCommands.Add(selectFlightPlanButton);
            this.flightPlansCommandBar.PrimaryCommands.Add(refreshFlightPlanButton);
            this.flightPlansCommandBar.PrimaryCommands.Add(addFlightPlanButton);
            this.flightPlansCommandBar.PrimaryCommands.Add(this.deleteFlightPlansButton);

            //this.flightPlansCommandBar.SecondaryCommands.Add(settingsButton);
        }
Ejemplo n.º 35
0
        /// <summary>
        /// Ajoute un bouton à la barre
        /// </summary>
        /// <param name="objectType">type d'objet à créer</param>
        /// <param name="emplacement">Type d'emplacment du bouton sur la CommandBar, PrimaryCommands ou SecondaryCommands</param>
        /// <param name="icon">Icon du bouton</param>
        /// <param name="label">Label du bouton</param>
        /// <param name="command">ICommand du bouton</param>
        /// <param name="commandParameter">CommandParameter de la ICommand du bouton</param>
        private static CommandBarElement AddObjectToCommandBar(CommandBarButtonType objectType, CommandBarEmplacement emplacement, IconElement icon, string label, ICommand command, object commandParameter, FlyoutBase flyout)
        {
            ICommandBarElement element = null;

            switch (objectType)
            {
                case CommandBarButtonType.Button:
                    element = new AppBarButton
                    {
                        Icon = icon,
                        Label = label,
                        Command = command,
                        CommandParameter = commandParameter
                    };
                    break;
                case CommandBarButtonType.ToggleButton:
                    element = new AppBarToggleButton()
                    {
                        Icon = icon,
                        Label = label,
                        Command = command,
                        CommandParameter = commandParameter
                    };
                    break;
                case CommandBarButtonType.FlyoutButton:
                    element = new AppBarButton()
                    {
                        Icon = icon,
                        Label = label,
                        Flyout = flyout
                    };
                    break;
                case CommandBarButtonType.Separator:
                    element = new AppBarSeparator();
                    break;
            }

            if (element != null)
            {
                if (emplacement == CommandBarEmplacement.Primary)
                {
                    _commandBar.PrimaryCommands.Add(element);
                }
                else
                {
                    _commandBar.SecondaryCommands.Add(element);
                }

                if (_commandBar.Visibility == Visibility.Collapsed)
                {
                    _commandBar.Visibility = Visibility.Visible;
                }
            }
            return new CommandBarElement() { Element = element, Emplacement = emplacement };
        }
Ejemplo n.º 36
-7
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // Find the stack panels that host our AppBarButtons within the AppBar
            leftPanel = rootPage.FindName("LeftPanel") as StackPanel;
            rightPanel = rootPage.FindName("RightPanel") as StackPanel;

            CopyButtons(leftPanel, leftItems);
            CopyButtons(rightPanel, rightItems);

            // Remove existing AppBarButtons
            leftPanel.Children.Clear();
            rightPanel.Children.Clear();

            // Create the AppBarToggle button for the 'Shuffle' command
            AppBarToggleButton shuffle = new AppBarToggleButton();
            shuffle.Label = "Shuffle";
            shuffle.Icon = new SymbolIcon(Symbol.Shuffle);

            rightPanel.Children.Add(shuffle);

            // Create the AppBarButton for the 'Sun' command
            AppBarButton sun = new AppBarButton();
            sun.Label = "Sun";

            // This button will use the FontIcon class for its icon which allows us to choose
            // any glyph from any FontFamily
            FontIcon sunIcon = new FontIcon();
            sunIcon.FontFamily = new Windows.UI.Xaml.Media.FontFamily("Wingdings");
            sunIcon.FontSize = 30.0;
            sunIcon.Glyph = "\u0052";
            sun.Icon = sunIcon;

            rightPanel.Children.Add(sun);

            // Create the AppBarButton for the 'Triangle' command
            AppBarButton triangle = new AppBarButton();
            triangle.Label = "Triangle";

            // This button will use the PathIcon class for its icon which allows us to 
            // use vector data to represent the icon
            PathIcon trianglePathIcon = new PathIcon();
            PathGeometry g = new PathGeometry();
            g.FillRule = FillRule.Nonzero;

            // Just create a simple triange shape
            PathFigure f = new PathFigure();
            f.IsFilled = true;
            f.IsClosed = true;
            f.StartPoint = new Windows.Foundation.Point(20.0, 5.0);
            LineSegment s1 = new LineSegment();
            s1.Point = new Windows.Foundation.Point(30.0, 30.0);
            LineSegment s2 = new LineSegment();
            s2.Point = new Windows.Foundation.Point(10.0, 30.0);
            LineSegment s3 = new LineSegment();
            s3.Point = new Windows.Foundation.Point(20.0, 5.0);
            f.Segments.Add(s1);
            f.Segments.Add(s2);
            f.Segments.Add(s3);
            g.Figures.Add(f);

            trianglePathIcon.Data = g;

            triangle.Icon = trianglePathIcon;

            rightPanel.Children.Add(triangle);

            // Create the AppBarButton for the 'Smiley' command
            AppBarButton smiley = new AppBarButton();
            smiley.Label = "Smiley";
            smiley.Icon = new BitmapIcon { UriSource = new Uri("ms-appx:/Assets/smiley.png") };

            rightPanel.Children.Add(smiley);


        }