예제 #1
0
        public void FilesButtonClicked(object sender, RoutedEventArgs args)
        {
            Flyout f = new Flyout();
            f.PlacementTarget = sender as UIElement;
            f.Placement = PlacementMode.Bottom;

            Menu menu = new Menu();

            MenuItem mi = new MenuItem();
            mi.Text = "Documents";

            MenuItem mi2 = new MenuItem();
            mi2.Text = "Pictures";

            MenuItem mi3 = new MenuItem();
            mi3.Text = "Music";

            MenuItem mi4 = new MenuItem();
            mi4.Text = "Network Directory";

            menu.Items.Add(mi);
            menu.Items.Add(mi2);
            menu.Items.Add(mi3);
            menu.Items.Add(mi4);

            //f.HostMargin = new Thickness(0); // on menu flyouts set HostMargin to 0
            f.HostMargin = new Thickness(-210, 0, 0, 0);
            f.Content = menu;
            f.IsOpen = true;
        }
예제 #2
0
		private void ShowFlyoutMenu(object sender, RoutedEventArgs e)
		{
			Flyout f = new Flyout();
			f.PlacementTarget = sender as UIElement;
			f.Placement = PlacementMode.Top;
			f.Closed += (x, y) =>
			{
				LogEvent("Event: Closed");
			};

			Menu menu = new Menu();

			MenuItem mi = new MenuItem();
			mi.Tag = "Easy";
			mi.Tapped += ItemClicked;
			mi.Text = "Easy Game";
            mi.MenuTextMargin = new Thickness(28, 10, 28, 12);

			MenuItem mi2 = new MenuItem();
			mi2.Text = "Medium Game";
			mi2.Tag = "Medium";
			mi2.Tapped += ItemClicked;
            mi2.MenuTextMargin = new Thickness(28, 10, 28, 12);

			MenuItem mi3 = new MenuItem();
			mi3.Text = "Hard Game";
			mi3.Command = new CommandTest();
			mi3.CommandParameter = "test param from command";
            mi3.MenuTextMargin = new Thickness(28, 10, 28, 12);

            ToggleMenuItem tmi = new ToggleMenuItem();
            tmi.Text = "Enable Logging";
            tmi.IsChecked = chk;
            tmi.Tapped += (a, b) =>
                {
                    chk = !chk;
                };

			menu.Items.Add(mi);
			menu.Items.Add(mi2);
			menu.Items.Add(new MenuItemSeparator());
			menu.Items.Add(new MenuItem() { Text = "Foobar something really long", Tag = "Long menu option", MenuTextMargin = new Thickness(28,10,28,12) });
            menu.Items.Add(tmi);
			menu.Items.Add(new MenuItemSeparator());
			menu.Items.Add(mi3);
            f.HostMargin = new Thickness(0); // on menu flyouts set HostMargin to 0
			f.Content = menu;
			f.IsOpen = true;

			ObjectTracker.Track(f);

			UpdateLayout();
		}
예제 #3
0
 private void Button_Click_1(object sender, Windows.UI.Xaml.RoutedEventArgs e)
 {
     var f = new Flyout
         {
             Placement = PlacementMode.Top,
             PlacementTarget = user
         };
     var m = new Menu();
     var mi1 = new MenuItem { Text = "sign out" };
     mi1.Tapped += mi1_Tapped;
     m.Items.Add(mi1);
     f.Content = m;
     f.IsOpen = true;
 }
예제 #4
0
        private void FilterBy_OnTapped(object sender, TappedRoutedEventArgs e)
        {
            var menu = new Menu();
            var states = FilterByState.GetStates();

            foreach (var state in states)
            {
                var mnuItem = new MenuItem
                                  {
                                      Text = state.StateDisplayString,
                                      Tag = state
                                  };
                
                mnuItem.Tapped += filterByClicked;
                menu.Items.Add(mnuItem);
            }

            DisplayFlyout(menu, filterByControl);
        }
        private void OnBragButtonClicked(object sender, RoutedEventArgs e)
        {
            // Create a menu containing two items
            var menu = new Menu();
            var item1 = new MenuItem { Text = "Photo" };
            item1.Tapped += OnCapturePhoto;
            menu.Items.Add(item1);
            var item2 = new MenuItem { Text = "Video" };
            item2.Tapped += OnCaptureVideo;
            menu.Items.Add(item2);

            // Show the menu in a flyout anchored to the Brag button
            var flyout = new Flyout();
            flyout.Placement = PlacementMode.Top;
            flyout.HorizontalAlignment = HorizontalAlignment.Left;
            flyout.HorizontalContentAlignment = HorizontalAlignment.Left;
            flyout.PlacementTarget = BragButton;
            flyout.Content = menu;
            flyout.IsOpen = true;
        }
        private void ViewAttachments_OnClick(object sender, RoutedEventArgs e)
        {
            var f = new Flyout()
                           {
                               Placement = PlacementMode.Top,
                               PlacementTarget = (UIElement)sender
                           };

            Menu m = new Menu();

            foreach (var attachment in ViewModel.Attachments)
            {
                var mi = new MenuItem()
                             {
                                 Text = attachment.ProposedFilename,
                                 Tag = attachment
                             };

                mi.Tapped += Attachment_OnTapped;

                m.Items.Add(mi);
            }

            f.Content = m;
            WebViewFlyoutFixes.ShowFlyout(f, this);
        }
예제 #7
0
        private void menuButtonClick(object sender, RoutedEventArgs e)
        {
            Callisto.Controls.Flyout f = new Callisto.Controls.Flyout();

            f.Placement = PlacementMode.Top;
            f.PlacementTarget = menuButton; // this is an UI element (usually the sender)

            Menu m = new Menu();

            for (int i = 0; i < _otherModules.Count; i++)
            {
                MenuItem mi = new MenuItem();
                mi.Text = (_otherModules[i]).moduleCode + " " + (_otherModules[i]).moduleName;
                mi.Tag = _otherModules[i].moduleId;
                mi.Tapped += otherModule_Tapped;
                m.Items.Add(mi);
            }
            f.Content = m;
            f.IsOpen = true;
        }
        private void optionflyout(object sender, RoutedEventArgs e)
        {
            try
            {

                Flyout fly = new Flyout();
                fly.PlacementTarget = sender as UIElement;
                fly.Placement = PlacementMode.Top;
                fly.Closed += (x, y) =>
                {

                };

                MenuItem menuitem1 = new MenuItem();
                MenuItem menuitem2 = new MenuItem();
                MenuItem menuitem3 = new MenuItem();
                MenuItem menuitem4 = new MenuItem();
                MenuItem menuitem5 = new MenuItem();

                Menu menu = new Menu();

                menuitem5.Tag = "Change Subtitle";
                menuitem5.Text = "Change Subtitle";
                menuitem5.Tapped += async (j, k) =>
                    {
                        if (mediaElement.AvailableCaptions.Count > 0)
                        {


                            Flyout fl = new Flyout();
                            fl.PlacementTarget = sender as UIElement;
                            fl.Placement = PlacementMode.Top;
                            fl.Closed += (x, y) =>
                            {

                            };

                            ListView la = new ListView();
                            la.Width = 220;
                            la.Height = 170;
                            la.BorderBrush = new SolidColorBrush(Colors.BlueViolet);
                            la.Background = new SolidColorBrush(Colors.Lavender);
                            la.Foreground = new SolidColorBrush(Colors.Black);
                            foreach (var f in mediaElement.AvailableCaptions)
                            {
                                la.Items.Add(f.ToString());
                            }
                            la.SelectionChanged += (g, b) =>
                                {
                                    int co = 0;
                                    foreach (var fff in mediaElement.AvailableCaptions)
                                    {

                                        if (la.SelectedItem != null && fff.ToString() == la.SelectedItem.ToString())
                                        {
                                            //   await new MessageDialog("No Subtitle Found In Media !!!Load Manually"+co.ToString()).ShowAsync();
                                            mediaElement.SelectedCaption = fff;
                                        }
                                        co = co + 1;
                                    }
                                };
                            fl.Content = la;
                            fl.IsOpen = true;
                            UpdateLayout();

                        }
                        else
                        {
                            await new MessageDialog("No Subtitle Found In Media !!!Load Manually").ShowAsync();
                        }


                    };
                menuitem5.MenuTextMargin = new Thickness(28, 10, 28, 12);
                menuitem1.Tag = "Change Audio";
                menuitem1.Text = "Change Audio";
                menuitem1.Tapped += (a, b) =>
                    {
                        mediaElement.InvokeAudioSelection();
                    };
                menuitem1.MenuTextMargin = new Thickness(28, 10, 28, 12);


                menuitem2.Tag = "Visualization 1";
                menuitem2.Text = "Visualization 1";
                menuitem2.Tapped += (c, d) =>
                    {
                        visual.Visibility = Visibility.Collapsed;
                        visual = visual1;
                        visual.Visibility = Visibility.Visible;
                        storyboard = Storyboard3;
                        storyboard.Begin();
                        storyboard.SpeedRatio = 1;
                        storyboard.Completed += storyboard_Completed;
                    };
                menuitem2.MenuTextMargin = new Thickness(28, 10, 28, 12);

                menuitem3.Tag = "Visualization 2";
                menuitem3.Text = "Visualization 2";
                menuitem3.Tapped += (c, d) =>
                {
                    visual.Visibility = Visibility.Collapsed;
                    visual = Visual2;
                    visual.Visibility = Visibility.Visible;
                    storyboard = Storyboard2;
                    storyboard.Begin();
                    storyboard.SpeedRatio = 0.2;
                    storyboard.Completed += storyboard_Completed;
                };
                menuitem3.MenuTextMargin = new Thickness(28, 10, 28, 12);

                menuitem4.Tag = "Total Media in List";
                menuitem4.Text = "Total Media";
                menuitem4.Tapped += async (j, f) =>
                    {
                        //mediaElement.RemoveAllEffects();
                        //  mediaElement.Balance =0;
                        // await new MessageDialog(mediaElement.Balance.ToString()).ShowAsync();
                        await new MessageDialog("Total Number Of Media's In Now Playing List is " + Collections.Count().ToString()).ShowAsync();
                        //var configuration = new PropertySet();
                        //configuration.Add(string.Format("eff{0}ect", "ARG0"),"Warp");
                        //mediaElement.AddVideoEffect("InvertTransform.InvertEffect", true, null);
                        ////mediaElement.RemoveAllEffects();
                        ////mediaElement.AddVideoEffect(Windows.Media.VideoEffects.VideoStabilization, true, null);


                    };
                menuitem4.MenuTextMargin = new Thickness(28, 10, 28, 12);


                menu.Items.Add(menuitem1);
                menu.Items.Add(menuitem5);
                menu.Items.Add(menuitem2);
                menu.Items.Add(menuitem3);
                menu.Items.Add(menuitem4);
                fly.HostMargin = new Thickness(0);
                fly.Content = menu;
                fly.IsOpen = true;

                UpdateLayout();
            }
            catch
            {
                ErrorCorrecting("021");
            }


            // UpdateLayout();
        }
        private void Open_Button_Click(object sender, RoutedEventArgs e)
        {
            Flyout f = new Flyout();

            f.Placement = PlacementMode.Top;
            f.PlacementTarget = sender as UIElement; // this is an UI element (usually the sender)

            Menu m = new Menu();

            MenuItem mi1 = new MenuItem();
            mi1.Text = "Link";

            mi1.Tapped += async (s, a) =>
            {
                await Windows.System.Launcher.LaunchUriAsync(new Uri((flipView.SelectedItem as SampleDataItem).Url));
            };

            MenuItem mi2 = new MenuItem();
            mi2.Text = "Comments";

            mi2.Tapped += async (s, a) =>
            {
                await Windows.System.Launcher.LaunchUriAsync(new Uri("http://www.reddit.com" + (flipView.SelectedItem as SampleDataItem).Permalink));
            };

            m.Items.Add(mi1);
            m.Items.Add(new MenuItemSeparator());
            m.Items.Add(mi2);

            f.Content = m;

            f.IsOpen = true;
        }
예제 #10
0
        private Menu createInfoMenu(Info info)
        {
            var menu = new Menu();

            foreach (var link in info.Links)
            {
                var mi = new MenuItem();
                mi.Tag = link.Uri;
                mi.Tapped += infoMI_tapped;
                mi.Text = link.Text;
                mi.MenuTextMargin = new Thickness(28, 10, 28, 12);
                menu.Items.Add(mi);
            }

            return menu;

        }
예제 #11
0
        private async void ShowInfo(object sender, RoutedEventArgs e)
        {
            if (_infoFlyout == null)
            {
                Flyout flyout = new Flyout();
                // creating some content
                // this could be just an instance of a UserControl of course
                Border border = new Border();
                ScrollViewer scroll = new ScrollViewer();
                scroll.MaxHeight = 600;
                scroll.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;

                border.BorderThickness = new Thickness(5);
                border.Margin = new Thickness(-5);
                StackPanel infoPanel = new StackPanel();
                infoPanel.Orientation = Orientation.Vertical;

                Menu infoMenu = new Menu();
                foreach (var info in SelectedPod.Infos)
                {
                    if (info.HasImage)
                    {
                        ImageMenuItem imi = new ImageMenuItem();
                        imi.ImgSource = info.Image.URL;
                        imi.ImgWidth  = info.Image.Width;
                        imi.ImgHeight = info.Image.Height;
                        imi.Tag = info;
                        imi.Tapped += showInfoMenu;
                        imi.UpdateLayout();
                        infoMenu.Items.Add(imi);
                    }
                    else
                    {
                        if (infoMenu.Items.Count > 0)
                        {
                            infoMenu.Items.Add(new MenuItemSeparator());
                        }

                        MenuItem more = new MenuItem();
                        more.Text = info.Links[0].Text;
                        more.Tag = info.Links[0].Uri;
                        more.Tapped += infoMI_tapped;
                        infoMenu.Items.Add(more);
                    }
                }

                border.Child = scroll;
                scroll.Content = infoMenu;

                // set the Flyout content
                flyout.Content = border;
                //flyout.

                //b.Child = container;
                //filters.Content = b;
                flyout.PlacementTarget = ShowInfoBtn;
                flyout.Placement = Windows.UI.Xaml.Controls.Primitives.PlacementMode.Top;
                flyout.IsOpen = true;
                //f.Background = new SolidColorBrush(Colors.Black);
                _infoFlyout = flyout;
            }
            else
            {
                _infoFlyout.IsOpen = true;
            }
        }
예제 #12
0
        private void ShowImageMenu(object sender, UIElement placementTarget)
        {
            for (int i = 0; i < SelectedPod.Images.Count(); i++)
            {
                ListViewItem lvi = resultsListView.ItemContainerGenerator.ContainerFromItem(SelectedPod.Images.ElementAt(i)) as ListViewItem;
                if (sender == FindByName("img", lvi))
                {
                    resultsListView.SelectionMode = ListViewSelectionMode.Single;
                    resultsListView.SelectedIndex = i;
                    break;
                }
            }

            var f = new Flyout();
            f.PlacementTarget = placementTarget;
            f.Placement = PlacementMode.Right;


            f.HostMargin = new Thickness(0); // on menu flyouts set HostMargin to 0
            Menu m = CopyMenu;
            m.Items.Add(new MenuItemSeparator());

            var mi4 = new MenuItem();
            mi4.Text = OPEN_URL;
            mi4.Tag = "URL";
            mi4.Tapped += OpenURL;
            mi4.MenuTextMargin = new Thickness(28, 10, 28, 12);

            m.Items.Add(mi4);

            f.Content = m;
            f.IsOpen = true;
        }
        private void StackPanel_Tapped_1(object sender, TappedRoutedEventArgs e)
        { // handle change metrics
            Debug.WriteLine("headerMenuClicked");
            // Create a menu containing two items
            var menu = new Menu();
            for (int i = 0; i <= AppMetricsNamesFormatted.Length-1; i++)
            {
                var newItem = new MenuItem { Text = AppMetricsNamesFormatted[i], Tag = i /* processingAccount.ApiKey */ };
                newItem.Tapped += changeMetricsClicked;
                menu.Items.Add(newItem);
            }

            // Show the menu in a flyout anchored to the header title
            var flyout = new Flyout();
            flyout.Placement = PlacementMode.Bottom;
            flyout.HorizontalAlignment = HorizontalAlignment.Right;
            flyout.HorizontalContentAlignment = HorizontalAlignment.Left;
            flyout.PlacementTarget = pageDropDown;
            flyout.Content = menu;
            flyout.IsOpen = true;
        }
예제 #14
0
        private void SortBy_OnTapped(object sender, TappedRoutedEventArgs e)
        {
            var menu = new Menu();
            var sortings = SortByOption.GetSortings();

            foreach (var sortby in sortings)
            {
                var mnuItem = new MenuItem
                {
                    Text = sortby.SortDisplayString,
                    Tag = sortby
                };

                mnuItem.Tapped += sortByClicked;
                menu.Items.Add(mnuItem);
            }

            DisplayFlyout(menu, sortByControl);
        }