Example #1
0
        private void ShowFlyoutMenu(object sender, RoutedEventArgs e)
        {
            Callisto.Controls.Flyout f = new Callisto.Controls.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();
        }
Example #2
0
        /// <summary>
        /// 사용 X
        /// </summary>
        public static void FlyAlert()
        {
            Flyout f = new Flyout();

            Border b = new Border();
            b.Width = 300;
            b.Height = 125;

            TextBlock tb = new TextBlock();
            tb.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center;
            tb.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center;
            tb.TextWrapping = TextWrapping.Wrap;
            tb.FontSize = 24.667;
            tb.Text = "This is a basic ContentControl so put anything you want in here.";

            b.Child = tb;

            f.Content = b;

            f.Placement = (PlacementMode)Enum.Parse(typeof(PlacementMode), "Top");
            //f.PlacementTarget = sender as UIElement;

            f.IsOpen = true;

            ObjectTracker.Track(f);
        }
        /// <summary>
        /// Shows a popup dialog for the specified model relative to the <paramref name="placementTarget"/>.
        /// </summary>
        /// <param name="rootModel">The root model.</param>
        /// <param name="placementTarget">The placement target.</param>
        /// <param name="viewSettings">The optional dialog settings.</param> 
        public void ShowFlyout(object rootModel, UIElement placementTarget, IDictionary<string, object> viewSettings = null) {
            var view = ViewLocator.LocateForModel(rootModel, null, null);
            ViewModelBinder.Bind(rootModel, view, null);

            var flyout = new Flyout
                {
                    Content = view,
                    PlacementTarget = placementTarget,
                };

            ApplySettings(flyout, viewSettings);
            flyout.IsOpen = true;

            var deactivator = rootModel as IDeactivate;
            if (deactivator != null) {
                EventHandler<object> closed = null;
                closed = (s, e) => {
                    deactivator.Deactivate(true);
                    flyout.Closed -= closed;
                };

                flyout.Closed += closed;
            }

            var activator = rootModel as IActivate;
            if (activator != null) {
                activator.Activate();
            }
        }
Example #4
0
        public void FilesButtonClicked(object sender, RoutedEventArgs args)
        {
            Callisto.Controls.Flyout f = new Callisto.Controls.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;
        }
Example #5
0
        public async static void ShowFlyout(Callisto.Controls.Flyout flyout, DocumentDetailPage page)
        {
            flyout.Closed += (s, e) => page.OnFlyoutClose();
            await page.OnFlyoutOpen();

            flyout.IsOpen = true;
        }
        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;
        }
Example #7
0
        private void ViewAttachments_OnClick(object sender, RoutedEventArgs e)
        {
            var f = new Callisto.Controls.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);
        }
        private void map_Tapped(object sender, TappedRoutedEventArgs e)
        {
            var pos = e.GetPosition(SpeedTrapMap);
            Location location;
            //Take the tapped location and get a GPS coordinate pair from it using the Bing Maps API
            SpeedTrapMap.TryPixelToLocation(pos, out location);

            //Flyout control from Callisto. Very handy.
            Flyout f = new Flyout();

            // Flyout is a ContentControl so set your content within it.
            f.Content = new NewSpeedTrap(location.Longitude, location.Latitude);

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

            layoutRoot.Children.Add(f.HostPopup);

            f.Closed += (async (b, c) =>
            {
                layoutRoot.Children.Remove(f.HostPopup);
                //Refresh the speed trap locations
                await fetchSpeedTraps();
            });

            f.IsOpen = true;
        }
Example #9
0
        private void ShowFlyoutMenu2(object sender, RoutedEventArgs e)
        {
            Callisto.Controls.Flyout f = new Callisto.Controls.Flyout();

            Border b = new Border();

            b.Width  = 300;
            b.Height = 125;

            TextBlock tb = new TextBlock();

            tb.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center;
            tb.VerticalAlignment   = Windows.UI.Xaml.VerticalAlignment.Center;
            tb.TextWrapping        = TextWrapping.Wrap;
            tb.FontSize            = 24.667;
            tb.Text = "This is a basic ContentControl so put anything you want in here.";

            b.Child = tb;

            f.Content = b;

            f.Placement       = (PlacementMode)Enum.Parse(typeof(PlacementMode), positioning.SelectionBoxItem.ToString());
            f.PlacementTarget = sender as UIElement;

            f.IsOpen = true;

            ObjectTracker.Track(f);
        }
Example #10
0
        public static void SimpleFlyout(object sender, string simpleMSG)
        {
            Flyout flyout = new Flyout();

            Border border = new Border();
            border.Width = 300;
            border.Height = 125;

            TextBlock tb = new TextBlock();
            tb.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center;
            tb.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center;
            tb.TextWrapping = TextWrapping.Wrap;
            tb.FontSize = 24.667;
            tb.Text = simpleMSG;
            tb.Foreground = new SolidColorBrush(Windows.UI.Colors.Black);
            border.Child = tb;

            flyout.Content = border;

            flyout.Placement = (PlacementMode)Enum.Parse(typeof(PlacementMode), "Top");
            flyout.PlacementTarget = sender as UIElement;

            flyout.IsOpen = true;

            ObjectTracker.Track(flyout);
        }
		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();
		}
Example #12
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;
 }
Example #13
0
        private void ShowFlyoutToggleMenu(object sender, RoutedEventArgs e)
        {
            Callisto.Controls.Flyout f = new Callisto.Controls.Flyout();
            f.PlacementTarget = sender as UIElement;
            f.Placement       = PlacementMode.Top;
            f.Closed         += (x, y) =>
            {
                LogEvent("Event: Closed");
            };

            Menu menu = new Menu();


            ToggleMenuItem tmi1 = new ToggleMenuItem();

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

            ToggleMenuItem tmi2 = new ToggleMenuItem();

            tmi2.Text      = "Disable Logging";
            tmi2.IsChecked = !chk;
            tmi2.Tapped   += (a, b) =>
            {
                chk = !chk;
            };

            menu.Items.Add(tmi1);
            menu.Items.Add(tmi2);
            f.HostMargin = new Thickness(0); // on menu flyouts set HostMargin to 0
            f.Content    = menu;
            f.IsOpen     = true;

            ObjectTracker.Track(f);

            UpdateLayout();
        }
Example #14
0
        private void ShowFlyoutMenu3(object sender, RoutedEventArgs e)
        {
            Callisto.Controls.Flyout f = new Callisto.Controls.Flyout();

            f.Margin          = new Thickness(20, 12, 20, 12);
            f.Content         = new SampleInput();
            f.Placement       = PlacementMode.Top;
            f.PlacementTarget = sender as UIElement;

            var parentGrid = ((FrameworkElement)this.Parent).FindName("FrameLayoutRoot") as Grid;

            parentGrid.Children.Add(f.HostPopup);

            f.Closed += (b, c) =>
            {
                parentGrid.Children.Remove(f.HostPopup);
            };

            f.IsOpen = true;

            ObjectTracker.Track(f);
        }
Example #15
0
        private void TestFlyoutButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            Flyout f = new Flyout();

            f.Margin = new Thickness(20, 12, 20, 12);

            // SampleInput is a user control with a TextBox in it
            f.Content = new NewServiceControl();

            f.Placement = PlacementMode.Top;
            f.PlacementTarget = sender as UIElement;

            var parentGrid = Top;

            parentGrid.Children.Add(f.HostPopup);

            f.Closed += (b, c) =>
            {
                parentGrid.Children.Remove(f.HostPopup);
            };

            f.IsOpen = true;
        }
        public void ShowRenameDialog(object sender)
        {
            var view = GetView() as PlaylistBottomBarView;
            if (view == null)
            {
                return;
            }

            var layoutRoot = view.GetLayoutRoot();
            _renamePlaylistFlyout = GenerateFlyout(sender);
            HookupFlyout(layoutRoot, _renamePlaylistFlyout);
            layoutRoot.Children.Add(_renamePlaylistFlyout.HostPopup);
        }
Example #17
0
        private void SendCommand_Tapped(object sender, TappedRoutedEventArgs e)
        {
            Flyout flyOut = new Flyout();
            flyOut.Width = 300;
            flyOut.PlacementTarget = sender as UIElement;
            flyOut.Placement = PlacementMode.Top;
            flyOut.Background = new SolidColorBrush(Colors.Black);

            StackPanel panel = new StackPanel();
            panel.Margin = new Thickness(10);
            panel.Orientation = Orientation.Vertical;
            panel.Children.Add(new TextBlock() { Text = "Command name", FontSize = 14.8 });
            TextBox commandName = new TextBox();
            panel.Children.Add(commandName);
            panel.Children.Add(new TextBlock() { Text = "Params", FontSize = 14.8, Margin = new Thickness(0, 10, 0, 0) });
            TextBox commandParams = new TextBox();
            panel.Children.Add(commandParams);
            panel.Children.Add(new TextBlock() { Text = "JSON or empty string" });
            Button sendButton = new Button() { Content = "Send", Margin = new Thickness(0, 10, 0, 0) };
            panel.Children.Add(sendButton);

            if (CommandSelected != null)
            {
                commandName.Text = CommandSelected.Name;
                commandParams.Text = (string)new ObjectToJsonStringConverter().Convert(CommandSelected.Parameters, null, null, null);
            }

            sendButton.Command = new DelegateCommand(async () =>
            {
                if (commandName.Text.Trim() == "")
                {
                    new MessageDialog("Empty command name", "Send command").ShowAsync();
                    return;
                }
                panel.ControlsEnable(false);
                LoadingItems++;
                try
                {
                    var command = new Command(commandName.Text, JObject.Parse(commandParams.Text));
                    StopPollCommandResult();
                    Debug.WriteLine("CMD SEND START");
                    var commandSent = await ClientService.Current.SendCommandAsync(deviceId, command);
                    Debug.WriteLine("CMD SEND END");
                    StartPollCommandResult((int)commandSent.Id);
                    flyOut.IsOpen = false;
                }
                catch (Exception ex)
                {
                    new MessageDialog(ex.Message, "Send command").ShowAsync();
                }
                panel.ControlsEnable(true);
                LoadingItems--;
            });

            flyOut.Content = panel;
            flyOut.IsOpen = true;
        }
 private static void HookupFlyout(Grid layoutRoot, Flyout flyout)
 {
     EventHandler<object> eventHandler = null;
     eventHandler = (s, e) =>
         {
             layoutRoot.Children.Remove(flyout);
             flyout.Closed -= eventHandler;
         };
     flyout.Closed += eventHandler;
 }
        private Flyout GenerateFlyout(object sender)
        {
            var renamePlaylistDialog = new RenamePlaylistDialog
                                           {
                                               OnOkClick = async newName => await RenamePlaylist(newName),
                                               PlaylistName = SelectedItem.Title
                                           };
            var flyout = new Flyout
                             {
                                 Placement = PlacementMode.Top,
                                 PlacementTarget = (UIElement)sender,
                                 Content = renamePlaylistDialog,
                                 IsOpen = true
                             };

            return flyout;
        }
        private async void SendFileToStorage(object sender, RoutedEventArgs e)
        {
            Flyout fly = new Flyout();
            fly.PlacementTarget = sender as UIElement;
            fly.Placement = PlacementMode.Top;
            fly.Closed += (x, y) =>
            {

            };
            ObservableCollection<selectingfiles> oc = new ObservableCollection<selectingfiles>();
            ListView a = new ListView();
            a.ItemTemplate = (DataTemplate)Application.Current.Resources["DeviceTemplate"];

            a.Width = 220;
            a.Height = 50;
            a.BorderBrush = new SolidColorBrush(Colors.BlueViolet);
            a.Background = new SolidColorBrush(Colors.Lavender);
            a.Foreground = new SolidColorBrush(Colors.Black);

            DeviceInformationCollection _device;
            _device = null;
            _device = await DeviceInformation.FindAllAsync(StorageDevice.GetDeviceSelector());
            oc.Clear();
            foreach (DeviceInformation dv in _device)
            {
                var dd = StorageDevice.FromId(dv.Id);
                selectingfiles g = new selectingfiles
                {

                    DeviceInfo = dv,
                    DeviceName = dd.DisplayName,
                };
                oc.Add(g);
            }
            if (oc.Count > 0)
            {
                a.Height = oc.Count * 50;
                a.ItemsSource = oc;
                fly.Content = a;
                fly.IsOpen = true;
                UpdateLayout();
            }
            else
            {
                fly.IsOpen = false;
                UpdateLayout();
                try
                {
                    await new MessageDialog("Removable Devices Not Found !!!").ShowAsync();
                }
                catch (Exception)
                {


                }

            }

            //var removableStorages = await KnownFolders.RemovableDevices.GetFoldersAsync();

            //if (removableStorages.Count > 0)
            //{
            //    // Display each storage device
            //    foreach (StorageFolder storage in removableStorages)
            //    {
            //        a.Items.Add(storage.DisplayName);
            //    }
            //}



            a.SelectionChanged += async (object se, SelectionChangedEventArgs f) =>
            {

                object ff = a.SelectedItem;
                selectingfiles ss = ff as selectingfiles;
                object ls = ls1.SelectedItem;
                playlist pl = ls as playlist;


                fly.IsOpen = false;
                var storage = StorageDevice.FromId(ss.DeviceInfo.Id);

                if (ls1.SelectedItem != null)
                {

                    try
                    {
                        progressring.IsActive = true;

                        //await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
                        //  {
                        //      await
                        //          pl.MediaFile.CopyAsync(storage, pl.MediaFile.Name,
                        //                                 NameCollisionOption.GenerateUniqueName);
                        //  });
                        //progressring.IsActive = false;


                        var s = pl.MediaFile.CopyAsync(storage, pl.MediaFile.Name,
                                                  NameCollisionOption.GenerateUniqueName).GetAwaiter();
                        //var dresult = s.GetAwaiter();

                        s.OnCompleted(async() =>
                        {
                           await new MessageDialog("File Sended Successfully").ShowAsync();
                            progressring.IsActive = false;
                        });

                    }
                    catch
                    {
                        ErrorCorrecting("027");
                    }

                }
                else
                {
                    new MessageDialog("First Select The Media in List!!!Then Send To Removable Device");
                }
            };


        }
 /// <summary>
 /// Creates a Flyout and parents it in the Visual Tree (to support on screen keyboard etc).
 /// </summary>
 private Flyout CreateFlyout()
 {
     Flyout flyout = new Flyout();
     flyout.BorderThickness = new Thickness(0);
     flyout.Background = new SolidColorBrush(Colors.Transparent);
     layoutRoot.Children.Add(flyout.HostPopup);
     return flyout;
 }
        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 ShowFlyoutMenu3(object sender, RoutedEventArgs e)
		{
			Flyout f = new Flyout();

			f.Margin = new Thickness(20, 12, 20, 12);
			f.Content = new SampleInput();
			f.Placement = PlacementMode.Top;
			f.PlacementTarget = sender as UIElement;

            var parentGrid = ((FrameworkElement)this.Parent).FindName("FrameLayoutRoot") as Grid;

            parentGrid.Children.Add(f.HostPopup);

            f.Closed += (b, c) =>
            {
                parentGrid.Children.Remove(f.HostPopup);
            };

			f.IsOpen = true;

			ObjectTracker.Track(f);
		}
Example #24
0
        private void ShowFlyoutToggleMenu(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();


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

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

            menu.Items.Add(tmi1);
            menu.Items.Add(tmi2);
            f.HostMargin = new Thickness(0); // on menu flyouts set HostMargin to 0
            f.Content = menu;
            f.IsOpen = true;

            ObjectTracker.Track(f);

            UpdateLayout();
        }
Example #25
0
        // TODO should it be removed?
        //private void BackButton_Click(object sender, RoutedEventArgs e)
        //{
        //    ClearDrawPad();
        //    ClearInkStrokes();
        //}

        private void LineWidthButton_Click(object sender, RoutedEventArgs args)
        {
            using (Flyout f = new Flyout())
            {
                f.Placement = PlacementMode.Top;
                f.PlacementTarget = sender as UIElement; // this is an UI element (usually the sender)

                LineWidthSelector selector = new LineWidthSelector();
                selector.Width = 400;
                selector.Height = 100;

                f.Content = selector;
                selector.ValueChanged += (_sender, _e) =>
                {
                    LineThickness = _e.NewValue;
                    // NotePad.LineWidth = LineThickness;
                };

                f.IsOpen = true;
            }
        }
        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;
        }
        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();
        }
Example #28
0
        private void GetAssumptionsFlyout()
        {
            if (_assumptionsFlyout == 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.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
                scroll.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
                //scroll.MaxWidth = 400;
                //b.BorderBrush = new SolidColorBrush(Colors.White);
                //b.Width = 300;
                //b.Height = 600;
                border.BorderThickness = new Thickness(5);
                border.Margin = new Thickness(-5);
                Grid assumptionLayoutGrid = new Grid();
                assumptionLayoutGrid.Margin = new Thickness(0);
                int i = 0;
                ColumnDefinition col = new ColumnDefinition();
                assumptionLayoutGrid.ColumnDefinitions.Add(col);
                foreach (var assumption in Result.Assumptions)
                {
                    RowDefinition headerRow = new RowDefinition();
                    RowDefinition body = new RowDefinition();

                    assumptionLayoutGrid.RowDefinitions.Add(headerRow);
                    assumptionLayoutGrid.RowDefinitions.Add(body);


                    TextBlock assumptionHeaderText = new TextBlock();
                    assumptionHeaderText.Text = assumption.DescriptionBefore;
                    assumptionHeaderText.FontSize = 26;
                    assumptionHeaderText.Margin = new Thickness(4, 4, 24, 4);
                    Border assumptionHeader = new Border();
                    assumptionHeader.Child = assumptionHeaderText;
                    assumptionHeader.Background = new SolidColorBrush(Colors.LightGray);

                    assumptionLayoutGrid.Children.Add(assumptionHeader);
                    Grid.SetColumn(assumptionHeader, 0);
                    Grid.SetRow(assumptionHeader, i);

                    StackPanel choicesPanel = new StackPanel();
                    choicesPanel.Orientation = Orientation.Vertical;
                    choicesPanel.Margin = new Thickness(8, 4, 24, 4);
                    assumptionLayoutGrid.Children.Add(choicesPanel);
                    Grid.SetRow(choicesPanel, i + 1);
                    Grid.SetColumn(choicesPanel, 0);

                    foreach (var choice in assumption.Values)
                    {
                        RadioButton c = new RadioButton();
                        c.Content = choice;
                        c.GroupName = assumption.GetQueryString();
                        choicesPanel.Children.Add(c);
                        c.IsChecked = (assumption.SelectedWord == choice);
                        c.Checked += c_Checked;
                        c.DataContext = assumption;
                    }
                    i += 2;

                }


                border.Child = scroll;
                scroll.Content = assumptionLayoutGrid;

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

                //b.Child = container;
                //filters.Content = b;
                flyout.PlacementTarget = QueryText;
                flyout.Placement = Windows.UI.Xaml.Controls.Primitives.PlacementMode.Bottom;
                flyout.IsOpen = true;
                //f.Background = new SolidColorBrush(Colors.Black);
                _assumptionsFlyout = flyout;
            }
            else
            {
                _assumptionsFlyout.IsOpen = true;
            }
        }
Example #29
0
 private async void c_Checked(object sender, RoutedEventArgs e)
 {
     var s = sender as RadioButton;
     var assumption = s.DataContext as Assumption;
     _assumptionsFlyout.IsOpen = false;
     _assumptionsFlyout.Dispose();
     _assumptionsFlyout = null;
     Result.Working = true;
     assumption.SelectedWord = s.Content as string;
     var r = new SearchResult(Result);
     await r.ApplyAssumption(assumption);
     _history.Push(r);
     Result = r;
     Result.Working = false;
 }
        private void VolumeManager(object sender, RoutedEventArgs e)
        {

            var f = new Flyout();

            Border s = new Border
            {

                Height = 40,
                Width = 150,


            };

            Slide = new Slider
                    {
                        Minimum = 1,
                        Maximum = 100,
                        Value = mediaElement.Volume * 100,


                        Orientation = Orientation.Horizontal,

                    };

            s.Child = Slide;
            Slide.ValueChanged += Slide_ValueChanged;


            f.Content = s;

            f.Placement = PlacementMode.Bottom;
            f.PlacementTarget = sender as UIElement;

            f.IsOpen = true;


        }
        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;
        }
Example #32
0
		private void ShowFlyoutMenu2(object sender, RoutedEventArgs e)
		{
			Flyout f = new Flyout();

			Border b = new Border();
			b.Width = 300;
			b.Height = 125;

			TextBlock tb = new TextBlock();
			tb.FontSize = 24.667;
			tb.Text = "Hello";

			b.Child = tb;

			f.Content = b;

			f.Placement = (PlacementMode)Enum.Parse(typeof(PlacementMode), positioning.SelectionBoxItem.ToString());
			f.PlacementTarget = sender as UIElement;

			f.IsOpen = true;

			ObjectTracker.Track(f);
		}
        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);
        }
Example #34
0
		private void ShowFlyoutMenu3(object sender, RoutedEventArgs e)
		{
			Flyout f = new Flyout();

			f.Margin = new Thickness(20, 12, 20, 20);
			f.VerticalOffset = -12;
			f.HorizontalOffset = -124;
			f.Content = new SampleInput();
			f.Placement = PlacementMode.Top;
			f.PlacementTarget = sender as UIElement;

			LayoutRoot.Children.Add(f.HostPopup);

			f.Closed += (b, c) =>
			{
				LayoutRoot.Children.Remove(f.HostPopup);
			};

			f.IsOpen = true;

			ObjectTracker.Track(f);
		}
		private void ShowFlyoutMenu2(object sender, RoutedEventArgs e)
		{
			Flyout f = new Flyout();

			Border b = new Border();
			b.Width = 300;
			b.Height = 125;

			TextBlock tb = new TextBlock();
            tb.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center;
            tb.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center;
            tb.TextWrapping = TextWrapping.Wrap;
			tb.FontSize = 24.667;
			tb.Text = "This is a basic ContentControl so put anything you want in here.";

			b.Child = tb;

			f.Content = b;

			f.Placement = (PlacementMode)Enum.Parse(typeof(PlacementMode), positioning.SelectionBoxItem.ToString());
			f.PlacementTarget = sender as UIElement;
            
			f.IsOpen = true;

			ObjectTracker.Track(f);
		}
Example #36
0
 private void defaultbutton_Click_1(object sender, RoutedEventArgs e)
 {
     Callisto.Controls.Flyout f = this.Parent as Callisto.Controls.Flyout;
     f.IsOpen = false;
 }
Example #37
0
        void ShowFilterFlyout(object sender, DateTime start, DateTime? end, Action<DateTime, DateTime?> filterAction)
        {
            Flyout flyOut = new Flyout();
            flyOut.Width = 300;
            flyOut.PlacementTarget = sender as UIElement;
            flyOut.Placement = PlacementMode.Top;
            flyOut.Background = new SolidColorBrush(Colors.Black);

            StackPanel filterPanel = new StackPanel();
            filterPanel.Margin = new Thickness(10);
            filterPanel.Orientation = Orientation.Vertical;
            filterPanel.Children.Add(new TextBlock() { Text = "Start time", FontSize = 14.8 });
            TextBox filterStart = new TextBox();
            filterPanel.Children.Add(filterStart);
            filterPanel.Children.Add(new TextBlock() { Text = "End time", FontSize = 14.8, Margin = new Thickness(0, 10, 0, 0) });
            TextBox filterEnd = new TextBox();
            filterPanel.Children.Add(filterEnd);
            filterPanel.Children.Add(new TextBlock() { Text = "Leave field empty to start polling new data from server" });
            Button filterDoButton = new Button() { Content = "Filter", Margin = new Thickness(0, 10, 0, 0) };
            filterPanel.Children.Add(filterDoButton);

            filterStart.Text = start.ToString();
            filterEnd.Text = end != null ? end.ToString() : "";
            filterDoButton.Command = new DelegateCommand(() =>
            {
                end = null;
                DateTime newEnd;
                if (!DateTime.TryParse(filterStart.Text, out start))
                {
                    new MessageDialog("Wrong start date", "Filter").ShowAsync();
                    return;
                }
                if (filterEnd.Text != "")
                {
                    if (DateTime.TryParse(filterEnd.Text, out newEnd))
                    {
                        end = newEnd;
                    }
                    else
                    {
                        new MessageDialog("Wrong end date", "Filter").ShowAsync();
                        return;
                    }
                }
                filterAction(start, end);
            });

            flyOut.Content = filterPanel;
            flyOut.IsOpen = true;
        }
        private async void Loadmediafromdevice(object sender, RoutedEventArgs e)
        {
            Flyout fly = new Flyout();
            fly.PlacementTarget = sender as UIElement;
            fly.Placement = PlacementMode.Top;
            fly.Closed += (x, y) =>
            {

            };
            ObservableCollection<selectingfiles> oc = new ObservableCollection<selectingfiles>();
            ListView a = new ListView();
            a.ItemTemplate = (DataTemplate)Application.Current.Resources["DeviceTemplate"];

            a.Width = 220;
            a.Height = 50;
            a.BorderBrush = new SolidColorBrush(Colors.BlueViolet);
            a.Background = new SolidColorBrush(Colors.Lavender);
            a.Foreground = new SolidColorBrush(Colors.Black);

            DeviceInformationCollection _device;
            _device = null;
            _device = await DeviceInformation.FindAllAsync(StorageDevice.GetDeviceSelector());
            oc.Clear();
            foreach (DeviceInformation dv in _device)
            {
                var dd = StorageDevice.FromId(dv.Id);
                selectingfiles g = new selectingfiles
                {

                    DeviceInfo = dv,
                    DeviceName = dd.DisplayName,
                };
                oc.Add(g);
            }
            if (oc.Count > 0)
            {
                a.Height = oc.Count * 50;
                a.ItemsSource = oc;
                fly.Content = a;
                fly.IsOpen = true;
                UpdateLayout();
            }
            else
            {
                fly.IsOpen = false;
                UpdateLayout();
                try
                {
                    await new MessageDialog("Removeable Devices Not Found !!!").ShowAsync();
                }
                catch (Exception)
                {


                }

            }

            //var removableStorages = await KnownFolders.RemovableDevices.GetFoldersAsync();

            //if (removableStorages.Count > 0)
            //{
            //    // Display each storage device
            //    foreach (StorageFolder storage in removableStorages)
            //    {
            //        a.Items.Add(storage.DisplayName);
            //    }
            //}





            a.SelectionChanged += async (object se, SelectionChangedEventArgs f) =>
            {

                object ff = a.SelectedItem;
                selectingfiles ss = ff as selectingfiles;

                fly.IsOpen = false;
                var storage = StorageDevice.FromId(ss.DeviceInfo.Id);
                //var storageName = deviceInfoElement.Name;

                // Construct the query for image files
                var QueryOptions = new QueryOptions
                    (
                    CommonFileQuery.OrderByName, new List<string> { ".3g2", ".3gp2", ".3gp", ".3gpp", ".m4a", ".m4v", ".mp4v", ".mp4", ".mov", ".m2ts", ".asf", ".wm", ".vob", ".wmv", ".wma", ".aac", ".adt", ".mp3", ".wav", ".avi", ".ac3", ".ec3" }
                    );
                var FileQuery = storage.CreateFileQueryWithOptions(QueryOptions);

                // Run the query for image files

                var Files = await FileQuery.GetFilesAsync();
                file = Files;
                try
                {
                    await pickingfiles();
                }
                catch
                {

                    ErrorCorrecting("025");
                }
                ////if (Files.Count > 0)
                ////{
                ////    var imageFile = Files[0];

                ////}

            };

        }