Пример #1
0
            void OnActionSheetRequested(Page sender, ActionSheetArguments arguments)
            {
                bool userDidSelect = false;

                if (arguments.FlowDirection == FlowDirection.MatchParent)
                {
                    // TODO: Check EffectiveFlowDirection
                }

                var actionSheetContent = new ActionSheetContent(arguments);

                var actionSheet = new Flyout
                {
                    Placement = UI.Xaml.Controls.Primitives.FlyoutPlacementMode.Full,
                    Content   = actionSheetContent
                };

                actionSheetContent.OptionSelected += (s, e) =>
                {
                    userDidSelect = true;
                    actionSheet.Hide();
                };

                actionSheet.Closed += (s, e) =>
                {
                    if (!userDidSelect)
                    {
                        arguments.SetResult(null);
                    }
                };

                try
                {
                    var pageParent = sender.ToPlatform(MauiContext).Parent as FrameworkElement;

                    if (pageParent != null)
                    {
                        actionSheet.ShowAt(pageParent);
                    }
                    else
                    {
                        arguments.SetResult(null);
                    }
                }
                catch (ArgumentException)                 // If the page is not in the visual tree
                {
                    if (UI.Xaml.Window.Current != null && UI.Xaml.Window.Current.Content is FrameworkElement mainPage)
                    {
                        actionSheet.ShowAt(mainPage);
                    }
                    else
                    {
                        arguments.SetResult(null);
                    }
                }
            }
Пример #2
0
        private void NumBox_GotFocus(object sender, RoutedEventArgs e)
        {
            FrameworkElement senderElement = sender as FrameworkElement;
            var txtbox = (TextBox)senderElement;

            if (txtbox != null)
            {
                SetFlytoutContent(true);
                _keyboard.ReferenceTextBox = txtbox;
                _flyout.ShowAt(senderElement);
            }
        }
Пример #3
0
        static void OnPageActionSheet(Page sender, ActionSheetArguments options)
        {
            bool userDidSelect = false;

            if (options.FlowDirection == FlowDirection.MatchParent)
            {
                if ((sender as IVisualElementController).EffectiveFlowDirection.IsRightToLeft())
                {
                    options.FlowDirection = FlowDirection.RightToLeft;
                }
                else if ((sender as IVisualElementController).EffectiveFlowDirection.IsLeftToRight())
                {
                    options.FlowDirection = FlowDirection.LeftToRight;
                }
            }

            var flyoutContent = new FormsFlyout(options);

            var actionSheet = new Flyout
            {
                FlyoutPresenterStyle = (Microsoft.UI.Xaml.Style)Microsoft.UI.Xaml.Application.Current.Resources["FormsFlyoutPresenterStyle"],
                Placement            = Microsoft.UI.Xaml.Controls.Primitives.FlyoutPlacementMode.Full,
                Content = flyoutContent
            };

            flyoutContent.OptionSelected += (s, e) =>
            {
                userDidSelect = true;
                actionSheet.Hide();
            };

            actionSheet.Closed += (s, e) =>
            {
                if (!userDidSelect)
                {
                    options.SetResult(null);
                }
            };

            try
            {
                actionSheet.ShowAt(((Page)sender).GetOrCreateRenderer().ContainerElement);
            }
            catch (ArgumentException)             // if the page is not in the visual tree
            {
                if (Forms.MainWindow.Content is FrameworkElement mainPage)
                {
                    actionSheet.ShowAt(mainPage);
                }
            }
        }
Пример #4
0
        public void Light_Dismiss_Closes_Flyout()
        {
            using (CreateServicesWithFocus())
            {
                var window = PreparedWindow();
                window.Width  = 100;
                window.Height = 100;

                var button = new Button
                {
                    Height = 10,
                    Width  = 10,
                    HorizontalAlignment = Layout.HorizontalAlignment.Left,
                    VerticalAlignment   = Layout.VerticalAlignment.Top
                };
                window.Content = button;

                window.Show();

                var f = new Flyout();
                f.Content = new Border {
                    Width = 10, Height = 10
                };
                f.ShowAt(window);

                var e       = CreatePointerPressedEventArgs(window, new Point(90, 90));
                var overlay = LightDismissOverlayLayer.GetLightDismissOverlayLayer(window);
                overlay.RaiseEvent(e);

                Assert.False(f.IsOpen);
            }
        }
Пример #5
0
        private void Item_PointerPressedHelper(CalendarViewDayItem sender, PointerRoutedEventArgs e)
        {
            FrameworkElement element = sender as FrameworkElement;

            flyout = (Flyout)this.Resources["flyout"];

            string[] dates = sender.Date.ToString().Split('/', ' ');
            if (dates[1].Length == 1)
            {
                dates[1] = "0" + dates[1];
            }
            if (dates[0].Length == 1)
            {
                dates[0] = "0" + dates[0];
            }
            string date = dates[2] + "-" + dates[0] + "-" + dates[1];

            year  = int.Parse(dates[2]);
            month = int.Parse(dates[0]);
            day   = int.Parse(dates[1]);

            if (dateMap.ContainsKey(date))
            {
                flyoutText.Text          = (string)dateMap[date][0];
                GoToDayButton.Visibility = Visibility.Visible;
            }
            else
            {
                flyoutText.Text          = "No Quests Today";
                GoToDayButton.Visibility = Visibility.Collapsed;
            }
            flyout.ShowAt(element);
        }
        private async void Accept_Click(object sender, RoutedEventArgs e)
        {
            Windows.Storage.StorageFolder storageFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
            await storageFolder.CreateFileAsync("username.txt", Windows.Storage.CreationCollisionOption.OpenIfExists);

            await checkUser();

            // hier moet je uit dat textveld waar die acceptbutton in staat even die waarden eruit halen en die variabele in de methode hieronder zetten i.p.v 8000 en 127.0.0.1
            try {
                string[] strings = loginBox.Text.Trim().Split(':');
                await EH.ConnectToBridge("lol", strings[1], strings[0]);

                EH.SAR.ip   = strings[0];
                EH.SAR.port = strings[1];
                await EH.getAlldata();

                //collectionlamp = EH.lamps;
                foreach (Lamp l in EH.lamps)
                {
                    collectionlamp.Add(l);
                }
                Flyout f = Resources["Login"] as Flyout;
                f.Hide();
                LoginButton.IsEnabled = false;
            }
            catch (Exception)
            {
                Flyout    flyout = new Flyout();
                TextBlock b      = new TextBlock();
                b.Text         = "Please make sure you entered the adress correctly";
                flyout.Content = b;
                flyout.ShowAt(Elipse);
            }
        }
        private void SaveButton_Click(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            if (!(DataContext is ExecutableManager context))
            {
                return;
            }

            // Reset error
            _blockClose = false;

            if (_executable == null)
            {
                _blockClose = true;

                // show fly out
                Flyout flyout = FlyoutHelper.CreateFlyout(includeButton: false);
                flyout.SetFlyoutLabelText(TryFindResource("ExecutableSelectInvalidErrorText") as string);
                flyout.ShowAt(TargetTextBox);

                return;
            }

            try
            {
                _executable.Name       = NameTextBox.Text;
                _executable.TargetPath = TargetTextBox.Text;

                string locale = LocaleComboBox.SelectedItem as string;

                if ((LocaleComboBox.SelectedItem as string) == LeagueLocale.Custom.ToString())
                {
                    _executable.Locale       = LeagueLocale.Custom;
                    _executable.CustomLocale = CustomLocaleTextBox.Text;
                }
                else
                {
                    _executable.Locale = ExeTools.GetLocaleEnum((LocaleComboBox.SelectedItem as string).Split('(', ')')[1]);
                }

                if (_isEditMode)
                {
                    Hide();
                }
                else
                {
                    context.AddExecutable(_executable);
                }

                Hide();
            }
            catch (Exception)
            {
                _blockClose = true;

                // show fly out
                Flyout flyout = FlyoutHelper.CreateFlyout(includeButton: false);
                flyout.SetFlyoutLabelText(TryFindResource("ExecutableSaveNullText") as string);
                flyout.ShowAt(TargetTextBox);
            }
        }
Пример #8
0
        private void ShowFlyout()
        {
            HideFlyout();

            var flyoutTemplate = FlyoutTemplate;

            if (flyoutTemplate == null)
            {
                return;
            }

            var paletteEntry = ColorPaletteEntry;

            Flyout flyout = new Flyout();

            var flyoutPresenterStyle = FlyoutPresenterStyle;

            if (flyoutPresenterStyle != null)
            {
                flyout.FlyoutPresenterStyle = flyoutPresenterStyle;
            }

            ContentControl flyoutContent = new ContentControl();

            flyoutContent.ContentTemplate     = flyoutTemplate;
            flyoutContent.Content             = paletteEntry;
            flyoutContent.HorizontalAlignment = HorizontalAlignment.Stretch;
            flyoutContent.VerticalAlignment   = VerticalAlignment.Stretch;
            flyoutContent.Margin  = new Thickness(0);
            flyoutContent.Padding = new Thickness(0);

            flyout.Content = flyoutContent;

            flyout.ShowAt(this);
        }
            private void ShowPopup(FrameworkElement el)
            {
                ListView listView = new ListView()
                {
                    Header             = Input.Title,
                    DisplayMemberPath  = "Content",
                    ItemsSource        = Input.Children,
                    SelectedItem       = Input.Children.FirstOrDefault(i => i.Id == Value),
                    IsItemClickEnabled = true
                };

                Flyout flyout = new Flyout();

                flyout.Content = new StackPanel()
                {
                    Width    = 300,
                    Children =
                    {
                        listView
                    }
                };

                listView.ItemClick += (s, e) =>
                {
                    SelectItem(e.ClickedItem as Selection);
                    flyout.Hide();
                };

                flyout.ShowAt(el);
            }
Пример #10
0
        private void addMoreBtn_Click(object sender, RoutedEventArgs e)
        {
            var flyoutOption = new FlyoutShowOptions();

            flyoutOption.ShowMode = FlyoutShowMode.Transient;
            Flyout.ShowAt(addMoreBtn, flyoutOption);
        }
        /// <summary>
        /// Opens the specified attachment.
        /// </summary>
        private async void OpenButton_Click(object sender, RoutedEventArgs e)
        {
            var    info    = (AttachmentInfoItem)((FrameworkElement)sender).DataContext;
            string message = null;

            try
            {
                using (var data = await info.GetDataAsync())
                {
                    if (data != Stream.Null)
                    {
                        var source = new BitmapImage();
                        await source.SetSourceAsync(data.AsRandomAccessStream());

                        var flyout = new Flyout();
                        flyout.Content = new Image()
                        {
                            Source = source
                        };
                        flyout.ShowAt(AttachmentsButton);
                    }
                }
            }
            catch (Exception ex)
            {
                message = ex.Message;
            }
        }
Пример #12
0
        public static Flyout ShowFlyOutWithLSchedulesAtButtonInLinePage(Button button, Line line, RoutedEventHandler scheduleClickedEven)
        {
            Flyout flyout = CreateFlyOutAtButton(ref button, line, ref scheduleClickedEven, true);

            flyout.ShowAt(button);
            return flyout; 
        }
        /// <summary>
        /// Invoked the flyout to style a header
        /// </summary>
        /// <param name="button">The button pressed</param>
        public void StyleHeader(ToolbarButton button)
        {
            var list = new ListBox {
                Margin = new Thickness(0), Padding = new Thickness(0)
            };

            headerFlyout = new Flyout {
                Content = list
            };

            string headerVal = "#";

            for (int i = 1; i <= 5; i++)
            {
                string val  = string.Concat(Enumerable.Repeat(headerVal, i));
                var    item = new ListBoxItem
                {
                    Content = new MarkdownTextBlock
                    {
                        Text = val + StringExtensions.GetLocalized("TextToolbarStrings_HeaderLabel", "Microsoft.Toolkit.Uwp.UI.Controls/Resources"),
                        IsTextSelectionEnabled = false
                    },
                    Tag     = val,
                    Padding = new Thickness(5, 2, 5, 2),
                    Margin  = new Thickness(0)
                };
                item.Tapped += HeaderSelected;
                list.Items.Add(item);
            }

            headerFlyout.ShowAt(button);
        }
Пример #14
0
        public void When_ChildIsBigger_PlacementBottom()
        {
            var SUT = new Grid()
            {
                Name = "test"
            };

            var flyout = new Flyout()
            {
                LightDismissOverlayMode = LightDismissOverlayMode.On,
                Placement = Windows.UI.Xaml.Controls.Primitives.FlyoutPlacementMode.Bottom
            };

            var button = new Button()
            {
                Width  = 5,
                Flyout = flyout
            };



            SUT.AddChild(button);

            SUT.Measure(new Size(20, 20));
            SUT.Arrange(new Rect(0, 0, 20, 20));

            //button.Click;
            flyout.ShowAt(button);

            Assert.AreEqual(button.LayoutSlot.X, flyout._popup.LayoutSlot.X);
        }
Пример #15
0
        public void OpenHightlightShadowsEffectsUI()
        {
            Flyout flyout = new Flyout();

            StackPanel stackPanel = new StackPanel();

            stackPanel.Orientation = Orientation.Vertical;
            stackPanel.Width       = 150;

            AddTextSliderBlock(stackPanel, "Clarity", simplePhotoEditor.highlightClarity * 100, -100, 100, SliderHLClarity_ValueChanged);
            AddTextSliderBlock(stackPanel, "Highlights", simplePhotoEditor.highlightHighlights * 100, -100, 100, SliderHLHighlights_ValueChanged);
            AddTextSliderBlock(stackPanel, "Shadows", simplePhotoEditor.highlightShadows * 100, -100, 100, SliderHLShadows_ValueChanged);
            AddTextSliderBlock(stackPanel, "MaskBlur", simplePhotoEditor.highlightMaskBlur * 100, 0, 1000, SliderHLMaskBlur_ValueChanged);


            Border border = new Border();

            border.BorderThickness = new Thickness(flyoutBorderThickness);
            border.BorderBrush     = new SolidColorBrush(Colors.Black);
            border.Child           = stackPanel;

            FlyoutShowOptions flyoutShowOptions = new FlyoutShowOptions();

            flyoutShowOptions.Placement = FlyoutPlacementMode.RightEdgeAlignedBottom;
            flyout.Content = border;

            flyout.ShowAt(placementTarget, flyoutShowOptions);
        }
Пример #16
0
        public void OpenSepiaEffectsUI()
        {
            Flyout flyout = new Flyout();

            StackPanel stackPanel = new StackPanel();

            stackPanel.Orientation = Orientation.Vertical;
            stackPanel.Width       = 150;

            AddTextSliderBlock(stackPanel, "Intensity", simplePhotoEditor.sepiaIntensity * 100, 0, 100, SliderSepia_ValueChanged);
            AddTextSliderBlock(stackPanel, "Vignette Amount", simplePhotoEditor.vignetteAmount * 100, 0, 100, SliderVignetteAmount_ValueChanged);
            AddTextSliderBlock(stackPanel, "Vignette Curve", simplePhotoEditor.vignetteCurve * 100, 0, 100, SliderVignetteCurve_ValueChanged);
            AddTextColorBlock(stackPanel, "Vignette Color", VignetteColorButton_Click);



            Border border = new Border();

            border.BorderThickness = new Thickness(flyoutBorderThickness);
            border.BorderBrush     = new SolidColorBrush(Colors.Black);
            border.Child           = stackPanel;

            FlyoutShowOptions flyoutShowOptions = new FlyoutShowOptions();

            flyoutShowOptions.Placement = FlyoutPlacementMode.RightEdgeAlignedBottom;
            flyout.Content = border;
            flyout.ShowAt(placementTarget, flyoutShowOptions);
        }
Пример #17
0
        void OnWrapOptionAppBarButtonClick(object sender, RoutedEventArgs args)
        {
            // Create dialog
            WrapOptionsDialog wrapOptionsDialog = new WrapOptionsDialog
            {
                TextWrapping = txtbox.TextWrapping
            };

            // Bind dialog to TextBox
            Binding binding = new Binding
            {
                Source = wrapOptionsDialog,
                Path   = new PropertyPath("TextWrapping"),
                Mode   = BindingMode.TwoWay
            };

            txtbox.SetBinding(TextBox.TextWrappingProperty, binding);

            // ダイアログを Flyoutへ変更
            Flyout flyout = new Flyout()
            {
                Content   = wrapOptionsDialog,
                Placement = FlyoutPlacementMode.Top
            };

            flyout.ShowAt(sender as FrameworkElement);
        }
Пример #18
0
        private async Task DecryptPakAsync()
        {
            var dialog = new MessageDialog("This will permanently decrypt the pak file! Are you sure you want to do this?");

            dialog.Commands.Add(new UICommand("Yes", null, "yes"));
            dialog.Commands.Add(new UICommand("Cancel", null, "no"));

            var choice = await dialog.ShowAsync();

            if ((string)choice.Id == "yes")
            {
                await CurrentPak.DecryptAsync(EncryptionKey);

                var flyout = new Flyout()
                {
                    Content = new TextBlock {
                        Text = $"Pak decrypted!"
                    },
                    Placement = FlyoutPlacementMode.Bottom
                };
                flyout.ShowAt((FrameworkElement)Window.Current.Content);

                // Reload browser.
                Entries = await CurrentPak.GetEntriesAsync();
            }
        }
Пример #19
0
        private async void InstallApp(object sender, RoutedEventArgs e)
        {
            ApplicationData selected = appList.SelectedItem as ApplicationData;

            if (selected != null)
            {
                var dlg = new ContentDialog
                {
                    Title             = $"Install {selected.Name}?",
                    Content           = $"Version {selected.Version}",
                    PrimaryButtonText = "Install",
                    CloseButtonText   = "Cancel"
                };
                var result = await dlg.ShowAsync();

                if (result == ContentDialogResult.Primary)
                {
                    DoInstall(selected);
                }
            }
            else
            {
                var flyout = new Flyout
                {
                    Content = new TextBlock {
                        Text = "Select an app first!"
                    }
                };

                flyout.ShowAt(sender as Button);
            }
        }
Пример #20
0
        private static void SwapFlyouts(Flyout oldFlyout, Flyout newFlyout)
        {
            if (oldFlyout != null)
            {
                oldFlyout.Closed -= OnFlyoutClosed;
                oldFlyout.Hide();
                ((FrameworkElement)oldFlyout.Content).DataContext = null;
            }

            if (titleBar == null)
            {
                titleBar = CoreApplication.GetCurrentView().TitleBar;
                UpdateInset();
                titleBar.LayoutMetricsChanged += (o, e) => UpdateInset();
            }

            CurrentFlyout = newFlyout;
            if (newFlyout != null)
            {
                newFlyout.Closed += OnFlyoutClosed;
                CurrentFlyout.ShowAt(TargetElement, new FlyoutShowOptions {
                    Position = new Point(TargetElement.ActualWidth / 2, FlyoutInset + 40),
                    ShowMode = FlyoutShowMode.Transient
                });
            }
        }
		public async Task<Tuple<bool, bool>> GetUserConfirmationBeforeExportingBinderAsync(CancellationToken cancToken)
		{
			var result = new Tuple<bool, bool>(false, false);
			Flyout dialog = null;
			ConfirmationBeforeExportingBinder dialogContent = null;

			await RunInUiThreadAsync(delegate
			{
				dialog = new Flyout();
				dialogContent = new ConfirmationBeforeExportingBinder();

				dialog.Closed += OnDialog_Closed;

				dialog.Content = dialogContent;
				dialogContent.UserAnswered += OnYesNoDialogContent_UserAnswered;

				_isHasUserAnswered = false;
				dialog.ShowAt(Window.Current.Content as FrameworkElement);
			}).ConfigureAwait(false);

			while (!_isHasUserAnswered && !cancToken.IsCancellationRequested)
			{
				await Task.Delay(DELAY, cancToken).ConfigureAwait(false);
			}

			await RunInUiThreadAsync(delegate
			{
				dialog.Closed -= OnDialog_Closed;
				dialogContent.UserAnswered -= OnYesNoDialogContent_UserAnswered;
				dialog.Hide();
				result = new Tuple<bool, bool>(dialogContent.YesNo, dialogContent.IsHasUserInteracted);
			}).ConfigureAwait(false);

			return result;
		}
Пример #22
0
        public void ShowDotoFlyout(FrameworkElement frameworkElement, FlyoutPlacementMode flyoutPlacement,
                                   string contentTemplate = "", UserControl flyoutControl = null)
        {
            Flyout flyout = new Flyout();

            if (flyoutControl != null)
            {
                flyout.Content = flyoutControl;
            }
            else
            {
                flyout.Content = new ContentPresenter
                {
                    Content         = viewModel,
                    ContentTemplate = (DataTemplate)App.Current.Resources[contentTemplate]
                };
            }

            flyout.Placement = flyoutPlacement;
            if (frameworkElement is Button)
            {
                ((Button)frameworkElement).Flyout = flyout;
            }
            flyout.ShowAt(frameworkElement);
        }
Пример #23
0
        public void Validate(object sender)
        {
            TextBlock txt = new TextBlock();

            if (CatName.Text == "")
            {
                txt.Text       = "Veuillez renseigner un nom.";
                txt.Foreground = (Application.Current as App).Resources["CloVisOrange"] as SolidColorBrush;
            }
            else if (Index.Find(CatName.Text) != null)
            {
                txt.Text       = "Ce nom est déjà utilisé";
                txt.Foreground = (Application.Current as App).Resources["CloVisOrange"] as SolidColorBrush;
            }
            else if (CatList.SelectedIndex == -1)
            {
                txt.Text       = "Selectionnez une catégorie de destination.";
                txt.Foreground = (Application.Current as App).Resources["CloVisOrange"] as SolidColorBrush;
            }
            else if (CatList.SelectedItem is ElementList el)
            {
                el.Add(new ElementList <Element>(CatName.Text));

                CatName.Text = "";

                txt.Text = "Catégorie ajoutée à " + el.Name + ".";
            }

            var fo = new Flyout()
            {
                Content = txt
            };

            fo.ShowAt(CatName);
        }
Пример #24
0
        static void OnPageActionSheet(object sender, ActionSheetArguments options)
        {
            bool userDidSelect = false;
            var  flyoutContent = new FormsFlyout(options);

            var actionSheet = new Flyout
            {
                FlyoutPresenterStyle = (Windows.UI.Xaml.Style)Windows.UI.Xaml.Application.Current.Resources["FormsFlyoutPresenterStyle"],
                Placement            = Windows.UI.Xaml.Controls.Primitives.FlyoutPlacementMode.Full,
                Content = flyoutContent
            };

            flyoutContent.OptionSelected += (s, e) =>
            {
                userDidSelect = true;
                actionSheet.Hide();
            };

            actionSheet.Closed += (s, e) =>
            {
                if (!userDidSelect)
                {
                    options.SetResult(null);
                }
            };

            actionSheet.ShowAt(((Page)sender).GetOrCreateRenderer().ContainerElement);
        }
        private void RotationButton_Click(object sender, RoutedEventArgs e)
        {
            // If the implicit animation API is not present, simply no-op.
            if (!(ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 7)))
            {
                return;
            }

            RotationRectangle.CenterPoint = new System.Numerics.Vector3((float)RotationRectangle.ActualWidth / 2, (float)RotationRectangle.ActualHeight / 2, 0f);

            try
            {
                float customValue = (float)Convert.ToDouble(RotationTextBox.Text);
                if (customValue >= 0.0 && customValue <= 360.0)
                {
                    RotationRectangle.Rotation = customValue;
                }
                else
                {
                    RotationRectangle.Rotation = 0;
                }
                RotationValue.Value = RotationRectangle.Rotation;
            }
            catch
            {
                Flyout fo = numericValidationFlyout;
                fo.ShowAt((FrameworkElement)sender);
            }
        }
Пример #26
0
        /// <summary>
        /// Invoked the flyout to style a header
        /// </summary>
        /// <param name="button">The button pressed</param>
        public void StyleHeader(ToolbarButton button)
        {
            var list = new ListBox {
                Margin = new Thickness(0), Padding = new Thickness(0)
            };

            headerFlyout = new Flyout {
                Content = list
            };

            string headerVal = "#";

            for (int i = 1; i <= 5; i++)
            {
                string val  = string.Concat(Enumerable.Repeat(headerVal, i)) + " ";
                var    item = new ListBoxItem
                {
                    Content = new MarkdownTextBlock
                    {
                        Text = val + Model.Labels.HeaderLabel,
                        IsTextSelectionEnabled = false
                    },
                    Tag     = val,
                    Padding = new Thickness(5, 2, 5, 2),
                    Margin  = new Thickness(0)
                };
                item.Tapped += HeaderSelected;
                list.Items.Add(item);
            }

            headerFlyout.ShowAt(button);
        }
Пример #27
0
        private void EditBar_ColorEdited(FrameworkElement sender, FunctionDataEventArgs args)
        {
            Flyout colorFlyout = GetColorFlyout();

            ColorControl.Function = args.Function;
            colorFlyout.ShowAt(sender);
        }
Пример #28
0
        public static void ShowMessage(string message, double duration)
        {
            var label = new TextBlock {
                Text                = message,
                Foreground          = new SolidColorBrush(Windows.UI.Colors.Black),
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
            };
            var style = new Style {
                TargetType = typeof(FlyoutPresenter)
            };

            style.Setters.Add(new Setter(Control.BackgroundProperty, new SolidColorBrush(Windows.UI.Colors.White)));
            style.Setters.Add(new Setter(FrameworkElement.MaxHeightProperty, 1));
            var flyout = new Flyout {
                Content   = label,
                Placement = FlyoutPlacementMode.Bottom,

                FlyoutPresenterStyle = style,
            };

            flyout.ShowAt(Window.Current.Content as FrameworkElement);

            var timer = new DispatcherTimer {
                Interval = TimeSpan.FromSeconds(duration)
            };

            timer.Tick += (sender, e) => {
                timer.Stop();
                flyout.Hide();
            };
            timer.Start();
        }
Пример #29
0
        private void JumpToAppBarButton_Click(object sender, RoutedEventArgs e)
        {
            Flyout mf = (Flyout)this.Resources["JumpToFlyout"];

            mf.Placement = FlyoutPlacementMode.Bottom;
            mf.ShowAt(this.BottomAppBar);
        }
        public async Task Start()

        {
            flyout         = new Flyout();
            flyout.Content = keyboardGrid;

            flyout.ShowAt((FrameworkElement)Parent);
        }
Пример #31
0
        private void ControlElementClicked(object sender, RoutedEventArgs e)
        {
            FrameworkElement senderElement = sender as FrameworkElement;
            Flyout           flyout        = FlyoutBase.GetAttachedFlyout(senderElement) as Flyout;

            flyout.Placement = FlyoutPlacementMode.Top;
            flyout.ShowAt(senderElement);
        }
Пример #32
0
 public void ShowInviteSentConfirmationFlyout()
 {
     Flyout flyout = new Flyout(); 
     flyout.Content = new ContentPresenter
     {
         ContentTemplate = (DataTemplate)App.Current.Resources["InviteConfirmationTemplate"]
     };
     flyout.Placement = FlyoutPlacementMode.Bottom;
     flyout.ShowAt(PlacementSource);
 }
Пример #33
0
        private void CriaFlyOut (object sender, RoutedEventArgs e)
        {
            var flyout = new Flyout();

            var grid = new Grid();
            grid.Children.Add(new TextBlock() { 
                                                Text = "Criado Programaticamente", 
                                                Foreground = new SolidColorBrush (Colors.White), 
                                                FontSize = 20 
                                              });

            flyout.Content = grid;
            flyout.ShowAt(sender as FrameworkElement);
        }
Пример #34
0
        private void loginBtn_Click(object sender, RoutedEventArgs e)
        {
            var user = userTxt.Text.ToString();
            var password = passwordBox.Password.ToString();

            if (user == "*****@*****.**" && password == "admin123")
            {
                this.Frame.Navigate(typeof(AdminView), e);
            }
            else if (user == "*****@*****.**" && password == "seller1123")
            {
                this.Frame.Navigate(typeof(SellerView), e);
            }
            else if (user == "*****@*****.**" && password == "seller2123")
            {
                this.Frame.Navigate(typeof(SellerView), e);
            }
            else
            {
                var flyout = new Flyout();
                var grid = new Grid();
                grid.Children.Add(new TextBlock {
                    Text = "The e-mail and/or password entered \n is invalid. Please try again.", FontSize = 18});

                grid.Width = 300;
                grid.Height = 60;

                flyout.Content = grid;

                flyout.ShowAt(sender as FrameworkElement);

                userTxt.BorderBrush = new SolidColorBrush(Colors.Red);
                passwordBox.BorderBrush = new SolidColorBrush(Colors.Red);

                userTxtBlock.Foreground = new SolidColorBrush(Colors.Red);
                passwordTxtBlock.Foreground = new SolidColorBrush(Colors.Red);
            }
        }
 private void TryShowFlyout(Flyout flyout, FrameworkElement location)
 {
     try
     {
         flyout.ShowAt(location);
     }
     catch (ArgumentException ex)
     {
         PlatformAdapter.SendToCustomLogger(ex, LoggingLevel.Error);
     }
 }
 private void TryShowFlyout(Flyout flyout, FrameworkElement location)
 {
     try
     {
         flyout.ShowAt(location);
     }
     catch (ArgumentException ex)
     {
         Debug.WriteLine("Error displaying flyout");
         LoggingService.Log(ex, LoggingLevel.Critical);
     }
 }
 public void ShowDotoFlyout(FrameworkElement frameworkElement, FlyoutPlacementMode flyoutPlacement, 
     string contentTemplate = "", UserControl flyoutControl = null)
 {
     Flyout flyout = new Flyout();
     if (flyoutControl != null)
     {
         flyout.Content = flyoutControl;
     }
     else
     {
         flyout.Content = new ContentPresenter
         {
             Content = viewModel,
             ContentTemplate = (DataTemplate)App.Current.Resources[contentTemplate]
         };
     }
     
     flyout.Placement = flyoutPlacement;
     if (frameworkElement is Button)
     {
         ((Button)frameworkElement).Flyout = flyout;
     }
     flyout.ShowAt(frameworkElement);
 }
Пример #38
0
 private void ButtonVolume_Click(object sender, RoutedEventArgs e)
 {
     var flyout = new Flyout();
     flyout.Content = new VolumeControl();
     flyout.Placement = FlyoutPlacementMode.Top;
     flyout.ShowAt(sender as FrameworkElement);
 }
Пример #39
0
        private void SendCommand_Tapped(object sender, TappedRoutedEventArgs e)
        {
            Flyout flyOut = new Flyout();
            flyOut.Placement = FlyoutPlacementMode.Top;

            flyOut.FlyoutPresenterStyle = new Style(typeof(FlyoutPresenter));
            flyOut.FlyoutPresenterStyle.Setters.Add(new Setter(FlyoutPresenter.RequestedThemeProperty, ElementTheme.Dark));
            flyOut.FlyoutPresenterStyle.Setters.Add(new Setter(FlyoutPresenter.PaddingProperty, 10));
            
            StackPanel panel = new StackPanel();
            panel.Width = 300;
            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, commandParams.Text != "" ? JObject.Parse(commandParams.Text) : null);
                    Debug.WriteLine("CMD SEND START");
                    await ClientService.Current.SendCommandAsync(deviceId, command, CommandResultCallback);
                    Debug.WriteLine("CMD SEND END");
                    flyOut.Hide();
                }
                catch (Exception ex)
                {
                    new MessageDialog(ex.Message, "Send command").ShowAsync();
                }
                panel.ControlsEnable(true);
                LoadingItems--;
            });

            flyOut.Content = panel;
            flyOut.ShowAt((FrameworkElement)sender);
        }
Пример #40
0
        void ShowFilterFlyout(object sender, DateTime? start, DateTime? end, Action<DateTime?, DateTime?> filterAction)
        {
            Flyout flyOut = new Flyout();
            flyOut.Placement = FlyoutPlacementMode.Top;

            flyOut.FlyoutPresenterStyle = new Style(typeof(FlyoutPresenter));
            flyOut.FlyoutPresenterStyle.Setters.Add(new Setter(FlyoutPresenter.RequestedThemeProperty, ElementTheme.Dark));
            flyOut.FlyoutPresenterStyle.Setters.Add(new Setter(FlyoutPresenter.PaddingProperty, 10));

            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 subscribe to new data from server" });
            Button filterDoButton = new Button() { Content = "Filter", Margin = new Thickness(0, 10, 0, 0) };
            filterPanel.Children.Add(filterDoButton);

            filterStart.Text = start != null ? start.ToString() : "";
            filterEnd.Text = end != null ? end.ToString() : "";
            filterDoButton.Command = new DelegateCommand(() =>
            {
                start = null;
                end = null;
                DateTime newStart, newEnd;
                if (filterStart.Text != "")
                {
                    if (DateTime.TryParse(filterStart.Text, out newStart))
                    {
                        start = newStart;
                    }
                    else
                    {
                        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.ShowAt((FrameworkElement)sender);
             
        }
        private async void Accept_Click(object sender, RoutedEventArgs e)
        {
            Windows.Storage.StorageFolder storageFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
		await storageFolder.CreateFileAsync("username.txt", Windows.Storage.CreationCollisionOption.OpenIfExists);
            await checkUser();
            // hier moet je uit dat textveld waar die acceptbutton in staat even die waarden eruit halen en die variabele in de methode hieronder zetten i.p.v 8000 en 127.0.0.1
            try {
                string[] strings = loginBox.Text.Trim().Split(':');
                await EH.ConnectToBridge("lol", strings[1], strings[0]);
                EH.SAR.ip = strings[0];
                EH.SAR.port = strings[1];
                await EH.getAlldata();
                //collectionlamp = EH.lamps;
                foreach(Lamp l in EH.lamps){
                    collectionlamp.Add(l);
                }
                Flyout f = Resources["Login"] as Flyout;
                f.Hide();
                LoginButton.IsEnabled = false;
            }
            catch (Exception)
            {
                Flyout flyout = new Flyout();
                TextBlock b = new TextBlock();
                b.Text = "Please make sure you entered the adress correctly";
                flyout.Content = b;
                flyout.ShowAt(Elipse);
            }

        }
		public async Task ShowTextAsync(string text, CancellationToken cancToken)
		{
			Flyout dialog = null;
			TextViewer tv = null;

			await RunInUiThreadAsync(delegate
			{
				dialog = new Flyout();
				tv = new TextViewer(text);

				dialog.Closed += OnDialog_Closed;
				dialog.Content = tv;
				tv.UserAnswered += OnTextViewer_UserAnswered; ;

				_isHasUserAnswered = false;
				dialog.ShowAt(Window.Current.Content as FrameworkElement);
			}).ConfigureAwait(false);

			while (!_isHasUserAnswered && !cancToken.IsCancellationRequested)
			{
				await Task.Delay(DELAY, cancToken).ConfigureAwait(false);
			}

			await RunInUiThreadAsync(delegate
			{
				dialog.Closed -= OnDialog_Closed;
				tv.UserAnswered -= OnTextViewer_UserAnswered;
				dialog.Hide();
			}).ConfigureAwait(false);
		}
		/// <summary>
		/// Opens the specified attachment.
		/// </summary>
		private async void OpenButton_Click(object sender, RoutedEventArgs e)
		{
			var info = (AttachmentInfoItem)((FrameworkElement)sender).DataContext;
			string message = null;
			try
			{
				using (var data = await info.GetDataAsync())
				{
					if (data != Stream.Null)
					{
						var source = new BitmapImage();
						await source.SetSourceAsync(data.AsRandomAccessStream());
						var flyout = new Flyout();
						flyout.Content = new Image() { Source = source };
						flyout.ShowAt(AttachmentsButton);
					}
				}
			}
			catch (Exception ex)
			{
				message = ex.Message;
			}
		}
		public async Task<Tuple<BriefcaseVM.ImportBinderOperations, string>> GetUserChoiceBeforeImportingBinderAsync(string targetBinderName, CancellationToken cancToken)
		{
			var result = new Tuple<BriefcaseVM.ImportBinderOperations, string>(BriefcaseVM.ImportBinderOperations.Cancel, string.Empty);
			Flyout dialog = null;
			ChoiceBeforeImportingBinder dialogContent = null;

			await RunInUiThreadAsync(delegate
			{
				dialog = new Flyout();
				dialogContent = new ChoiceBeforeImportingBinder(targetBinderName);

				dialog.Closed += OnDialog_Closed;

				dialog.Content = dialogContent;
				dialogContent.UserAnswered += OnThreeBtnDialogContent_UserAnswered;

				_isHasUserAnswered = false;
				dialog.ShowAt(Window.Current.Content as FrameworkElement);
			}).ConfigureAwait(false);

			while (!_isHasUserAnswered && !cancToken.IsCancellationRequested)
			{
				await Task.Delay(DELAY, cancToken).ConfigureAwait(false);
			}

			await RunInUiThreadAsync(delegate
			{
				dialog.Closed -= OnDialog_Closed;
				dialogContent.UserAnswered -= OnThreeBtnDialogContent_UserAnswered;
				dialog.Hide();
				result = new Tuple<BriefcaseVM.ImportBinderOperations, string>(dialogContent.Operation, dialogContent.DBName);
			}).ConfigureAwait(false);

			return result;
		}