Exemple #1
0
        private void ShowMenu(bool isTransient, FrameworkElement fe)
        {
            FlyoutShowOptions myOption = new FlyoutShowOptions();

            myOption.ShowMode = isTransient ? FlyoutShowMode.Transient : FlyoutShowMode.Standard;
            CommandBarFlyout1.ShowAt(fe, myOption);
        }
Exemple #2
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);
        }
Exemple #3
0
    private void TreeViewItem_ContextRequested(UIElement sender, ContextRequestedEventArgs args)
    {
        var option = new FlyoutShowOptions();

        if (args.TryGetPosition(sender, out Point p))
        {
            option.Position = p;
        }

        if (((sender as FrameworkElement)?.DataContext as winui.TreeViewNode)?.Content is ViewModels.FileItemViewModel vm)
        {
            var menu = new MenuFlyout();
            foreach (var item in Models.MenuCommand.GetMenuFlyoutItems(vm.MenuCommands))
            {
                menu.Items.Add(item);
            }
            {
                var item = new MenuFlyoutItem()
                {
                    Text = Application.ResourceLoader.Loader.GetString("Command/Property")
                };
                item.DataContext = vm;
                item.Click      += MenuFlyoutItem_Click_Property;
                menu.Items.Add(item);
            }
            menu.ShowAt(sender, option);
        }
        args.Handled = true;
    }
Exemple #4
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);
        }
Exemple #5
0
        private void addMoreBtn_Click(object sender, RoutedEventArgs e)
        {
            var flyoutOption = new FlyoutShowOptions();

            flyoutOption.ShowMode = FlyoutShowMode.Transient;
            Flyout.ShowAt(addMoreBtn, flyoutOption);
        }
Exemple #6
0
        // Menu Flyout actions
        private void ShowMenuFlyout()
        {
            if (m_button != null)
            {
                var width  = m_button.ActualWidth;
                var height = m_button.ActualHeight;

                if (SharedHelpers.IsFlyoutShowOptionsAvailable())
                {
                    // Sets an exclusion rect over the button that generates the flyout so that even if the menu opens upwards
                    // (which is the default in touch mode) it doesn't cover the menu bar button.
                    FlyoutShowOptions options = new FlyoutShowOptions();
                    options.Position      = new Point(0, height);
                    options.Placement     = FlyoutPlacementMode.Bottom;
                    options.ExclusionRect = new Rect(0, 0, width, height);
                    m_flyout.ShowAt(m_button, options);
                }
                else
                {
                    m_flyout.ShowAt(m_button, new Point(0, height));
                }

                if (m_flyout?.m_presenter != null)
                {
                    m_flyout.m_presenter.KeyDown += OnPresenterKeyDown;

                    _activeDisposables.Add(() => {
                        m_flyout.m_presenter.KeyDown -= OnPresenterKeyDown;
                    });
                }
            }
        }
        public void ShowContextMenu(CustomKanbanModel selectedModel)
        {
            // Workaround to show context menu next to selected card model
            foreach (var col in kanbanBoard.ActualColumns)
            {
                if (col.Categories.Contains(selectedModel.Category.ToString()))
                {
                    // Find card inside column
                    foreach (var card in col.Cards)
                    {
                        int cardIndex = 0;
                        var cardModel = card.Content as CustomKanbanModel;
                        if (cardModel.ID == selectedModel.ID)
                        {
                            // Get current index of card
                            cardIndex = col.Cards.IndexOf(card);
                        }

                        // Set flyout to selected card index
                        for (int i = 0; i <= col.Cards.Count; i++)
                        {
                            if (i == cardIndex)
                            {
                                FlyoutShowOptions myOption = new FlyoutShowOptions();
                                myOption.ShowMode = FlyoutShowMode.Transient;
                                taskFlyout.ShowAt(col.Cards[i], myOption);
                            }
                        }
                    }
                }
            }
        }
Exemple #8
0
        private void ShowMenu(bool isTransient)
        {
            FlyoutShowOptions myOption = new FlyoutShowOptions();

            myOption.ShowMode = isTransient ? FlyoutShowMode.Transient : FlyoutShowMode.Standard;
            CommandBarFlyout1.ShowAt(Image1, myOption);
        }
        public void ShowMenu(bool isTransient, FrameworkElement fe)
        {
            FlyoutShowOptions myOption = new FlyoutShowOptions();

            myOption.ShowMode  = isTransient ? FlyoutShowMode.Transient : FlyoutShowMode.Standard;
            myOption.Placement = FlyoutPlacementMode.Bottom;
            CommandBarFlyout1.ShowAt(fe, myOption);
        }
        private void Movie_Click(object sender, RoutedEventArgs e)
        {
            FlyoutShowOptions options = new FlyoutShowOptions();

            options.ShowMode  = FlyoutShowMode.Standard;
            options.Placement = FlyoutPlacementMode.Top;

            MovieCommands.ShowAt(sender as FrameworkElement, options);
        }
Exemple #11
0
        private void ShowMenu(bool isTransient, object sender)
        {
            var myOption = new FlyoutShowOptions();

            myOption.ShowMode = isTransient ? FlyoutShowMode.Transient : FlyoutShowMode.Standard;
            if (sender != null)
            {
                CommandBarFlyout1.ShowAt(sender as Image, myOption);
            }
        }
        private void ShowMenu(bool isTransient, FrameworkElement fe)
        {
            Word_SelectedHistoryItem.Text = ViewModel.SelectedWordHistoryModel.Word;
            //TranslationMode_SelectedHistoryItem.Text = ViewModel.SelectedWordHistoryModel.TranslationMode;
            ViewModel.UpdateDetailedInfo(ViewModel.SelectedWordHistoryModel);

            FlyoutShowOptions myOption = new FlyoutShowOptions();

            myOption.ShowMode = isTransient ? FlyoutShowMode.Transient : FlyoutShowMode.Standard;
            CommandBarFlyout1.ShowAt(fe, myOption);
        }
Exemple #13
0
        public void Open3DLightingEffectsUI()
        {
            Flyout flyout = new Flyout();

            StackPanel stackPanel = new StackPanel();

            stackPanel.Orientation = Orientation.Vertical;
            stackPanel.Width       = 130;

            AddTextSliderBlock(stackPanel, "Diffuse Height", simplePhotoEditor.distantDiffuseEffectHeightMapScale * 100.0, 100, 1000, SliderHeightMapScale_ValueChanged);
            AddTextSliderBlock(stackPanel, "Specular Height", simplePhotoEditor.distantSpecularHeightMapScale * 100.0, 100, 1000, SliderSpecHeightMapScale_ValueChanged);
            AddTextSliderBlock(stackPanel, "Specular Exp", simplePhotoEditor.distantSpecularEffectSpecularExponent * 100.0, 10, 600, SliderSpecularExp_ValueChanged);


            StackPanel stackPanelRight = new StackPanel();

            stackPanelRight.Orientation = Orientation.Vertical;
            stackPanelRight.Width       = 130;

            AddTextSliderBlock(stackPanelRight, "Azimuth", simplePhotoEditor.distantAzimuth / (2 * Math.PI) * 360.0, 0, 360, SliderDistantAzimuth_ValueChanged);
            AddTextSliderBlock(stackPanelRight, "Elevation", simplePhotoEditor.distantElevation / (2 * Math.PI) * 360.0, 0, 360, SliderDistantElevation_ValueChanged);
            AddTextSliderBlock(stackPanelRight, "Saturation", simplePhotoEditor.distantDiffuseSaturation * 100.0, 0, 100, SliderDiffuseSaturation_ValueChanged);

            StackPanel stackPanelRightMost = new StackPanel();

            stackPanelRightMost.Orientation = Orientation.Vertical;
            stackPanelRightMost.Width       = 130;
            AddTextSliderBlock(stackPanelRightMost, "Specular Kernel", simplePhotoEditor.distantSpecularKernelWidth * 100.0, 100, 1000, SliderDistantSpecularAmount_ValueChanged);
            AddTextSliderBlock(stackPanelRightMost, "Diffuse Kernel", simplePhotoEditor.distantDiffuseKernelWidth * 100.0, 100, 1000, SliderDistantDiffuseAmount_ValueChanged);
            AddTextSliderBlock(stackPanelRightMost, "Gaussian Blur", simplePhotoEditor.gaussianBlurAmount * 100.0, 0, 1200, SliderGaussBlur_ValueChanged);
            //AddTextColorBlock(stackPanelRightMost, "Diffuse Color", DistLightColorButton_Click);


            StackPanel stackPanelCombined = new StackPanel();

            stackPanelCombined.Orientation = Orientation.Horizontal;
            stackPanelCombined.Children.Add(stackPanel);
            stackPanelCombined.Children.Add(stackPanelRight);
            stackPanelCombined.Children.Add(stackPanelRightMost);

            Border border = new Border();

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

            FlyoutShowOptions flyoutShowOptions = new FlyoutShowOptions();

            flyoutShowOptions.Placement = FlyoutPlacementMode.RightEdgeAlignedBottom;
            flyout.Content = border;
            flyout.ShowAt(placementTarget, flyoutShowOptions);
        }
Exemple #14
0
        private void RightTappedMediaCabinet(object sender, RightTappedRoutedEventArgs e)
        {
            var flyout = this.MediaCabinetCommandsFlyout;

            this._mediaSelectGuid = ((Grid)sender).Tag.ToString();
            var options = new FlyoutShowOptions()
            {
                Position = e.GetPosition((FrameworkElement)sender),
                ShowMode = FlyoutShowMode.Transient
            };

            flyout?.ShowAt((FrameworkElement)sender, options);
        }
Exemple #15
0
        private void ShowContextMenuFlyout(string positionJson)
        {
            var    jobj    = JObject.Parse(positionJson);
            double x       = Convert.ToDouble(jobj["x"].ToString());
            double y       = Convert.ToDouble(jobj["y"].ToString());
            var    options = new FlyoutShowOptions();

            options.Position = new Windows.Foundation.Point(x, y);
            if (_contextMenuFlyout != null)
            {
                _contextMenuFlyout.ShowAt(MainWebView, options);
            }
        }
Exemple #16
0
        /// <summary>
        /// 选中文本翻译
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void TextMenu_Translate_Click(object sender, RoutedEventArgs e)
        {
            if (!NetworkHelper.Instance.ConnectionInformation.IsInternetAvailable)
            {
                new PopupToast(AppTools.GetReswLanguage("Tip_FailedWithoutInternet"), AppTools.GetThemeSolidColorBrush(ColorType.ErrorColor)).ShowPopup();
                return;
            }
            string language = (sender as MenuFlyoutItem).Name.Replace("SelectMenu_Translate_", "");
            string appId    = AppTools.GetRoamingSetting(AppSettings.Translate_BaiduAppId, "");
            string appKey   = AppTools.GetRoamingSetting(AppSettings.Translate_BaiduKey, "");

            if (string.IsNullOrEmpty(appId))
            {
                new PopupToast(AppTools.GetReswLanguage("Tip_NeedLinkTranslateService"), AppTools.GetThemeSolidColorBrush(ColorType.ErrorColor)).ShowPopup();
                return;
            }
            else
            {
                LoadingRing.IsActive = true;
                string output = await TranslateTools.Translate(_selectText, appId, appKey, "auto", language.ToLower());

                if (!string.IsNullOrEmpty(output))
                {
                    var pos = new Point();
                    if (_latestPoint == null)
                    {
                        pos = Window.Current.CoreWindow.PointerPosition;
                    }
                    else
                    {
                        pos = _latestPoint.Position;
                    }
                    double x = pos.X - Window.Current.Bounds.X;
                    double y = pos.Y - Window.Current.Bounds.Y;
                    if (_latestPoint == null)
                    {
                        x -= 30;
                        y -= 50;
                    }
                    var option = new FlyoutShowOptions();
                    option.Position       = new Point(x, y);
                    TranslateContent.Text = output;
                    TranslateFlyout.ShowAt(MainPage.Current.RootGrid, option);
                }
                else
                {
                    new PopupToast(AppTools.GetReswLanguage("Tip_TranslateFailed"), AppTools.GetThemeSolidColorBrush(ColorType.ErrorColor)).ShowPopup();
                }
                LoadingRing.IsActive = false;
            }
        }
Exemple #17
0
 private void ShowMenu(bool isTransient)
 {
     if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 7))
     {
         FlyoutShowOptions myOption = new FlyoutShowOptions();
         myOption.ShowMode  = isTransient ? FlyoutShowMode.Transient : FlyoutShowMode.Standard;
         myOption.Placement = FlyoutPlacementMode.RightEdgeAlignedTop;
         CommandBarFlyout1.ShowAt(Image1, myOption);
     }
     else
     {
         CommandBarFlyout1.ShowAt(Image1);
     }
 }
Exemple #18
0
        public void OpenEdgeDetectionEffectsUI()
        {
            Flyout flyout = new Flyout();

            StackPanel stackPanel = new StackPanel();

            stackPanel.Orientation = Orientation.Vertical;
            stackPanel.Width       = 130;

            AddTextToggleBlock(stackPanel, "Grayscale", simplePhotoEditor.edgeDetectionGrayscale, ToggleSwitchEdgeDGrayscale_Toggled);
            AddTextSliderBlock(stackPanel, "Exposure", simplePhotoEditor.edgeDetectionExposure * 100, -200, 200, SliderEdgeExposure_ValueChanged);
            AddTextSliderBlock(stackPanel, "Contrast", simplePhotoEditor.edgeDetectionContrast * 100, -100, 100, SliderEdgeContrast_ValueChanged);

            StackPanel stackPanelRight = new StackPanel();

            stackPanelRight.Orientation = Orientation.Vertical;
            stackPanelRight.Width       = 130;
            //AddTextToggleBlock(stackPanelRight, "Edge Detect", simplePhotoEditor.edgeDetectionOn, ToggleSwitchEdgeDOn_Toggled);
            AddTextSliderBlock(stackPanelRight, "Edge Amount", simplePhotoEditor.edgeDetectionAmount * 100, 0, 100, SliderEdgeAmount_ValueChanged);
            AddTextSliderBlock(stackPanelRight, "Edge Blur", simplePhotoEditor.edgeDetectionBlurAmount * 100, 0, 1000, SliderEdgeBlur_ValueChanged);
            AddTextToggleBlock(stackPanelRight, "Invert", simplePhotoEditor.edgeDetectionMaskInvert, ToggleSwitchEdgeMaskInvert_Toggled);

            StackPanel stackPanelRightMost = new StackPanel();

            stackPanelRightMost.Orientation = Orientation.Vertical;
            stackPanelRightMost.Width       = 130;
            AddTextToggleBlock(stackPanelRightMost, "Overlay Image", simplePhotoEditor.edgeDetectionOverlayImage, ToggleSwitchEdgeDOverlay_Toggled);
            AddTextSliderBlock(stackPanelRightMost, "Overlay Opacity", simplePhotoEditor.edgeDetectionOverlayOpacity * 100, 0, 100, SliderEdgeOOpacity_ValueChanged);
            AddTextBlendBlock(stackPanelRightMost, "Overlay Blend", simplePhotoEditor.edgeDetectionBlendEffectMode, BlendComboBox_SelectionChanged);

            StackPanel stackPanelCombined = new StackPanel();

            stackPanelCombined.Orientation = Orientation.Horizontal;
            stackPanelCombined.Children.Add(stackPanel);
            stackPanelCombined.Children.Add(stackPanelRight);
            stackPanelCombined.Children.Add(stackPanelRightMost);

            Border border = new Border();

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

            FlyoutShowOptions flyoutShowOptions = new FlyoutShowOptions();

            flyoutShowOptions.Placement = FlyoutPlacementMode.RightEdgeAlignedBottom;
            flyout.Content = border;
            flyout.ShowAt(placementTarget, flyoutShowOptions);
            //flyout.ShowAt(TextConsole, flyoutShowOptions);
        }
    private void flipView_ContextRequested(UIElement sender, ContextRequestedEventArgs args)
    {
        var option = new FlyoutShowOptions();

        if (args.TryGetPosition(this, out Point p))
        {
            option.Position = p;
        }
        if (sender is FrameworkElement fe && fe.Resources["ContextFlyout"] is MenuFlyout menuFlyout)
        {
            menuFlyout.ShowAt(this, option);
        }
        args.Handled = true;
    }
Exemple #20
0
        private void OnButtonClicked(object sender, RoutedEventArgs e)
        {
            var btn    = sender as Button;
            var flyout = Flyout.GetAttachedFlyout(Header);

            if (ApiInformation.IsTypePresent("Windows.UI.Xaml.Controls.Primitives.FlyoutShowOptions"))
            {
                var options = new FlyoutShowOptions();
                options.Placement = FlyoutPlacementMode.BottomEdgeAlignedRight;
                flyout.ShowAt(btn, options);
            }
            else
            {
                flyout.ShowAt(Header);
            }
        }
Exemple #21
0
        private void ShowEtiquetaAddForm(Button sender, TipoEtiqueta tipoEtiqueta)
        {
            EtiquetaForm.Parameters parameters = new EtiquetaForm.Parameters(this.parameters.Container, tipoEtiqueta: tipoEtiqueta);
            FlyoutBase        flyout           = FlyoutBase.GetAttachedFlyout(SP_TransForm);
            FlyoutShowOptions options          = new FlyoutShowOptions()
            {
                ShowMode  = FlyoutShowMode.Standard,
                Placement = FlyoutPlacementMode.TopEdgeAlignedLeft
            };

            flyout.ShowAt(sender, options);
            Frame_EtiquetaForm.Navigate(
                typeof(EtiquetaForm),
                parameters);
            ((EtiquetaForm)Frame_EtiquetaForm.Content).CloseRequested += TransForm_CloseRequested;
        }
Exemple #22
0
        internal void OpenFlyout()
        {
            var flyout = Flyout;

            if (flyout != null)
            {
                if (SharedHelpers.IsFlyoutShowOptionsAvailable())
                {
                    FlyoutShowOptions options = new FlyoutShowOptions();
                    options.Placement = FlyoutPlacementMode.BottomEdgeAlignedLeft;
                    flyout.ShowAt(this, options);
                }
                else
                {
                    flyout.ShowAt(this);
                }
            }
        }
Exemple #23
0
        private async void GenThumbnails_Click(object sender, RoutedEventArgs e)
        {
            Flyout flyout = new Flyout();

            StackPanel stackPanel = new StackPanel();

            stackPanel.Orientation = Orientation.Vertical;
            //stackPanel.Orientation = Orientation.Horizontal;
            //stackPanel.Height = 140;
            //stackPanel.Width = 140;

            CanvasBitmap canvasBitmap          = simplePhotoEditor.GenerateThumbnail();
            CanvasBitmap canvasBitmapSepia     = simplePhotoEditor.applySepiaEffects(canvasBitmap);
            CanvasBitmap canvasBitmapHue       = simplePhotoEditor.applyHueRotationEffects(canvasBitmap);
            CanvasBitmap canvasBitmapHighlight = simplePhotoEditor.applyHighlightEffects(canvasBitmap);
            CanvasBitmap canvasBitmapEdge      = simplePhotoEditor.applyEdgeDetectionEffects(canvasBitmap);
            CanvasBitmap canvasBitmap3D        = simplePhotoEditor.apply3DLightingEffects(canvasBitmap);

            await AddThumbnail_FreeResource(stackPanel, canvasBitmap, "Original");
            await AddThumbnail_FreeResource(stackPanel, canvasBitmapEdge, "Edge Detection");
            await AddThumbnail_FreeResource(stackPanel, canvasBitmapSepia, "Sepia");
            await AddThumbnail_FreeResource(stackPanel, canvasBitmapHighlight, "Highlight & Shadows");
            await AddThumbnail_FreeResource(stackPanel, canvasBitmapHue, "Hue Rotation");
            await AddThumbnail_FreeResource(stackPanel, canvasBitmap3D, "3D Lighting");


            Border border = new Border();

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

            ScrollViewer scrollViewer = new ScrollViewer();

            scrollViewer.Content = border;


            FlyoutShowOptions flyoutShowOptions = new FlyoutShowOptions();

            flyoutShowOptions.Placement = FlyoutPlacementMode.Left;
            flyout.Content = scrollViewer;
            //flyout.ShowAt(TextConsole, flyoutShowOptions);
            flyout.ShowAt(placementTarget, flyoutShowOptions);
        }
Exemple #24
0
        public async Task Check_Placement_All_WithPosition(
            FlyoutPlacementMode placementMode,
            HorizontalPosition horizontalPosition,
            VerticalPosition verticalPosition)
        {
            var(flyout, content) = CreateFlyout();
            var position = new Windows.Foundation.Point(50, 50);
            var options  = new FlyoutShowOptions
            {
                Placement = placementMode,
                Position  = position,
            };

            const double MarginValue = 97;
            const int    TargetWidth = 88;
            var          target      = new Border
            {
                Margin = new Thickness(MarginValue),
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Top,
                Width      = TargetWidth,
                Height     = 23,
                Background = new SolidColorBrush(Colors.Red)
            };

            TestServices.WindowHelper.WindowContent = target;

            await TestServices.WindowHelper.WaitForLoaded(target);

            await TestServices.WindowHelper.WaitFor(() => target.ActualWidth == TargetWidth);             // For some reason target is initially stretched on iOS

            try
            {
                flyout.ShowAt(target, options);

                await TestServices.WindowHelper.WaitForLoaded(content);

                VerifyRelativeContentPosition(position, horizontalPosition, verticalPosition, content, MarginValue, target);
            }
            finally
            {
                flyout.Hide();
            }
        }
Exemple #25
0
        public void OpenHueRotationEffectsUI()
        {
            Flyout flyout = new Flyout();

            StackPanel stackPanel = new StackPanel();

            stackPanel.Orientation = Orientation.Vertical;
            stackPanel.Width       = 130;

            AddTextSliderBlock(stackPanel, "Temperature", simplePhotoEditor.hueTemperature * 100.0, -100, 100, SliderHueTemperature_ValueChanged);
            AddTextSliderBlock(stackPanel, "Tint", simplePhotoEditor.hueTint * 100.0, -100, 100, SliderHueTint_ValueChanged);
            AddTextSliderBlock(stackPanel, "Angle", simplePhotoEditor.hueRotationAngle / (2 * Math.PI) * 360.0, 0, 360, SliderHueRotation_ValueChanged);

            StackPanel stackPanelRight = new StackPanel();

            stackPanelRight.Orientation = Orientation.Vertical;
            stackPanelRight.Width       = 130;

            AddTextToggleBlock(stackPanelRight, "Posterize", simplePhotoEditor.hueDoPosterize, ToggleSwitchDoPosterize_Toggled);
            AddTextSliderBlock(stackPanelRight, "Red Count", simplePhotoEditor.huePosterizeRedCount, 4, 16, SliderRedCount_ValueChanged);
            AddTextSliderBlock(stackPanelRight, "Green Count", simplePhotoEditor.huePosterizeGreenCount, 4, 16, SliderGreenCount_ValueChanged);
            AddTextSliderBlock(stackPanelRight, "Blue Count", simplePhotoEditor.huePosterizeBlueCount, 4, 16, SliderBlueCount_ValueChanged);


            StackPanel stackPanelCombined = new StackPanel();

            stackPanelCombined.Orientation = Orientation.Horizontal;
            stackPanelCombined.Children.Add(stackPanel);
            stackPanelCombined.Children.Add(stackPanelRight);

            Border border = new Border();

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

            FlyoutShowOptions flyoutShowOptions = new FlyoutShowOptions();

            flyoutShowOptions.Placement = FlyoutPlacementMode.RightEdgeAlignedBottom;
            flyout.Content = border;
            flyout.ShowAt(placementTarget, flyoutShowOptions);
        }
Exemple #26
0
        public void OpenFlyout(FlyoutShowOptions options)
        {
            ShowOptions = options;

            if (State == ViewState.Closing_Stage2)
            {
                return;
            }

            switch (State)
            {
            case ViewState.Hidden:
                BeginOpen();
                break;

            case ViewState.Open:
                BeginClose();
                break;
            }
        }
        public void Image_PointerReleased(object sender, PointerRoutedEventArgs args)
        {
            myImageBorder.BorderBrush = new SolidColorBrush(Colors.Blue);

            if (wasLeftPointerPressed)
            {
                if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 7))
                {
                    FlyoutShowOptions myOption = new FlyoutShowOptions();
                    myOption.ShowMode  = FlyoutShowMode.Transient;
                    myOption.Placement = FlyoutPlacementMode.RightEdgeAlignedTop;
                    CommandBarFlyout1.ShowAt(Image1, myOption);
                }
                else
                {
                    CommandBarFlyout1.ShowAt(Image1);
                }
                wasLeftPointerPressed = false;
            }
            args.Handled = true;
        }
Exemple #28
0
    //private void RadioButton_Checked(object sender, RoutedEventArgs e)
    //{
    //    if (sender is RadioButton rd)
    //    {
    //        if (this.DataContext is ViewModels.FileExplorerViewModel fevm && fevm?.Content?.Item.Order != null)
    //        {
    //            fevm.Content.Item.Order = fevm.Content.Item.Order.GetBasicOrder(rd.Tag.ToString(), fevm.Content.Item.Order?.KeyIsAscending ?? true);
    //        }
    //    }
    //}

    //private void RadioButton_Unchecked(object sender, RoutedEventArgs e)
    //{
    //    if (sender is ToggleButton rd)
    //    {
    //        if (this.DataContext is ViewModels.FileExplorerViewModel fevm && fevm?.Content?.Item != null)
    //        {
    //            fevm.Content.Item.Order = new ViewModels.FileItemViewModel.OrderStatus();
    //        }
    //    }
    //}

    //private void CheckBox_Checked_1(object sender, RoutedEventArgs e)
    //{
    //    if (sender is ToggleButton tb)
    //    {
    //        if (this.DataContext is ViewModels.FileExplorerViewModel fevm && fevm?.Content?.Item.Order != null)
    //        {
    //            fevm.Content.Item.Order = fevm.Content.Item.Order.GetBasicOrder(fevm.Content.Item.Order.Key, tb.Tag.ToString() == "Ascending");
    //        }
    //    }
    //}

    //private void CheckBox_Unchecked_1(object sender, RoutedEventArgs e)
    //{
    //    if (sender is ToggleButton tb)
    //    {
    //        if (this.DataContext is ViewModels.FileExplorerViewModel fevm && fevm?.Content?.Item.Order != null)
    //        {
    //            fevm.Content.Item.Order = fevm.Content.Item.Order.GetBasicOrder(fevm.Content.Item.Order.Key, tb.Tag.ToString() != "Ascending");
    //        }
    //    }
    //}

    private void UserControl_ContextRequested(UIElement sender, ContextRequestedEventArgs args)
    {
        var option = new FlyoutShowOptions();

        if (args.TryGetPosition(sender, out Point p))
        {
            option.Position = p;
        }

        if (this.content.DataContext is ViewModels.ContentViewModel vm)
        {
            var menu = new MenuFlyout();
            foreach (var item in Models.MenuCommand.GetMenuFlyoutItems(vm.Item.MenuCommands))
            {
                menu.Items.Add(item);
            }

            if (vm.Item?.IsFolder is true)
            {
                //var item = new MenuFlyoutItem()
                //{
                //    //ToDo: Fix and translate.
                //    Text = "Rename",
                //};
                //item.Click += async (sender, e) => await Helper.UIHelper.OpenRename(null);
                //menu.Items.Add(item);
            }
            {
                var item = new MenuFlyoutItem()
                {
                    Text = Application.ResourceLoader.Loader.GetString("Command/Property"),
                };
                item.DataContext = vm.Item;
                item.Click      += MenuFlyoutItem_Click_Property;
                menu.Items.Add(item);
            }
            menu.ShowAt(sender, option);
        }
        args.Handled = true;
    }
Exemple #29
0
        private void DisplayGraphSettings()
        {
            if (m_graphSettings == null)
            {
                m_graphSettings = new GraphingSettings();
                m_graphSettings.GraphThemeSettingChanged += OnGraphThemeSettingChanged;
            }

            if (m_graphFlyout == null)
            {
                m_graphFlyout         = new Flyout();
                m_graphFlyout.Content = m_graphSettings;
            }

            m_graphSettings.SetGrapher(this.GraphingControl);
            m_graphSettings.IsMatchAppTheme = IsMatchAppTheme;

            var options = new FlyoutShowOptions();

            options.Placement = FlyoutPlacementMode.BottomEdgeAlignedRight;
            m_graphFlyout.ShowAt(GraphSettingsButton, options);
        }
        private async Task <TextBlock> CreateScheduleTextBlock(string scheduleName)
        {
            var employees = await EmployeeApi.Loader.Get();

            var employee = employees.Find(e => e.id.ToString() == scheduleName);
            var result   = new TextBlock {
                Text = (employee != null) ? employee.FullName : scheduleName
            };
            var contextMenu = new MenuFlyout();

            result.ContextFlyout = contextMenu;
            MenuFlyoutItem deleteMenuItem = new MenuFlyoutItem();

            deleteMenuItem.Text   = "Delete";
            deleteMenuItem.Click += (s, e) => DeleteSchedule(scheduleName);
            contextMenu.Items.Add(deleteMenuItem);
            var options = new FlyoutShowOptions();

            options.ShowMode    = FlyoutShowMode.Transient;
            result.RightTapped += (s, e) => contextMenu.ShowAt(result, options);
            result.Tag          = scheduleName;
            return(result);
        }