コード例 #1
0
        static void ThumbDragDelta(object sender, DragDeltaEventArgs e)
        {
            Thumb thumb = sender as Thumb;

            if (thumb == null)
            {
                return;
            }

            double left = (double)thumb.GetValue(Canvas.LeftProperty);
            double top  = (double)thumb.GetValue(Canvas.TopProperty);

            thumb.SetValue(Canvas.LeftProperty, left + e.HorizontalChange);
            thumb.SetValue(Canvas.TopProperty, top + e.VerticalChange);
        }
コード例 #2
0
        private static void ApplyCustomThumbSetting(Thumb thumb)
        {
            var dragablzItem = thumb.VisualTreeAncestory().OfType <DragablzItem>().FirstOrDefault();

            if (dragablzItem == null)
            {
                throw new ApplicationException("Cannot find parent DragablzItem for custom thumb");
            }

            System.Diagnostics.Debug.WriteLine("ApplyCustomThumbSetting " + dragablzItem.IsDragging);

            var enableCustomThumb = (bool)thumb.GetValue(IsCustomThumbProperty);

            dragablzItem._customThumb = enableCustomThumb ? thumb : null;
            dragablzItem._templateSubscriptions.Disposable = dragablzItem.SelectAndSubscribeToThumb().Item2;

            if (dragablzItem._customThumb != null && dragablzItem._isTemplateThumbWithMouseAfterSeize)
            {
                dragablzItem.Dispatcher.BeginInvoke(new Action(() => dragablzItem._customThumb.RaiseEvent(new MouseButtonEventArgs(InputManager.Current.PrimaryMouseDevice,
                                                                                                                                   0,
                                                                                                                                   MouseButton.Left)
                {
                    RoutedEvent = MouseLeftButtonDownEvent
                })));
            }
        }
コード例 #3
0
        private static void ApplyCustomThumbSetting(Thumb thumb)
        {
            var dockItem = thumb.GetVisualAncestors().OfType <DockItem>().FirstOrDefault();

            if (dockItem == null)
            {
                throw new ApplicationException("Cannot find parent DockItem or custom Thumb");
            }

            var enableCustomThumb = thumb.GetValue(IsCustomThumbProperty);

            dockItem._customThumb = enableCustomThumb ? thumb : null;
            dockItem._templateSubscriptions.Disposable = dockItem.SelectAndSubscribeToThumb().Item2;

            if (dockItem._customThumb != null && dockItem._isTemplateThumbWithMouseAfterSeize)
            {
                Dispatcher.UIThread.InvokeAsync(
                    new Action(
                        () =>
                        dockItem._customThumb.RaiseEvent(new PointerPressedEventArgs(PointerPressedEvent)
                {
                    ClickCount  = 0,
                    Device      = MouseDevice.Instance,
                    MouseButton = MouseButton.Left
                })));
            }
        }
コード例 #4
0
        private static void DragBottom(object sender, DragDeltaEventArgs e)
        {
            Thumb thumb = sender as Thumb;

            if (thumb.GetValue(BottomResize) is Window window)
            {
                window.Height += window.SafeHeightChange(e.VerticalChange);
            }
        }
コード例 #5
0
        private static void DragRight(object sender, DragDeltaEventArgs e)
        {
            Thumb thumb = sender as Thumb;

            if (thumb.GetValue(RightResize) is Window window)
            {
                window.Width += window.SafeWidthChange(e.HorizontalChange);
            }
        }
コード例 #6
0
        private static void DragTop(object sender, DragDeltaEventArgs e)
        {
            Thumb thumb = sender as Thumb;

            if (thumb.GetValue(TopResize) is Window window)
            {
                double verticalChange = window.SafeHeightChange(e.VerticalChange, false);
                window.Height -= verticalChange;
                window.Top    += verticalChange;
            }
        }
コード例 #7
0
        private static void DragLeft(object sender, DragDeltaEventArgs e)
        {
            Thumb thumb = sender as Thumb;

            if (thumb.GetValue(LeftResize) is Window window)
            {
                double horizontalChange = window.SafeWidthChange(e.HorizontalChange, false);
                window.Width -= horizontalChange;
                window.Left  += horizontalChange;
            }
        }
コード例 #8
0
        private static void DragBottomRight(object sender, DragDeltaEventArgs e)
        {
            Thumb thumb = sender as Thumb;

            if (thumb.GetValue(BottomRightResize) is Window window)
            {
                double verticalChange   = window.SafeHeightChange(e.VerticalChange);
                double horizontalChange = window.SafeWidthChange(e.HorizontalChange);
                window.Width  += horizontalChange;
                window.Height += verticalChange;
            }
        }
コード例 #9
0
        /// <summary>
        /// Gets a list of points who starting from the transitionname in t1 and ends with the transitionname in t2
        /// </summary>
        /// <param name="t1">Transitionname</param>
        /// <param name="t2">Transitionname</param>
        /// <param name="conformanceCheckingCanvas">Canvas</param>
        /// <returns>Returns a list of points</returns>
        /// <autor>Andrej Albrecht</autor>
        private List <Point2D> GetListWithPointsToFromCanvas(string t1, string t2, Canvas conformanceCheckingCanvas)
        {
            List <Point2D> listWithPointsTo = new List <Point2D>();

            foreach (Object child in conformanceCheckingCanvas.Children)
            {
                Thumb thumb = child as Thumb;
                if (thumb != null && thumb.Name.Equals("Transition"))
                {
                    if ((thumb.GetValue(ContentProperty).ToString()).Contains(t1))
                    {
                        //For extension:
                        //System.Console.WriteLine("TransitionT1Left left:" + Canvas.GetLeft(KindThumb) + " top:" + Canvas.GetTop(KindThumb) + " Content: " + KindThumb.GetValue(Label.ContentProperty).ToString());
                    }
                    else if ((thumb.GetValue(ContentProperty).ToString()).Contains(t2))
                    {
                        listWithPointsTo.Add(new Point2D(Canvas.GetLeft(thumb), Canvas.GetTop(thumb)));
                    }
                }
            }

            return(listWithPointsTo);
        }
コード例 #10
0
        /// <summary>
        /// Method for the right click on a transition.
        /// This method opens a footprintviewer
        /// </summary>
        /// <autor>Andrej Albrecht</autor>
        private static void Transition_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                Thumb  thumb          = (Thumb)sender;
                String transitionName = thumb.GetValue(ContentProperty).ToString();

                ModernWindow footprintViewer = new ModernWindow
                {
                    Style   = (Style)Application.Current.Resources["EmptyWindow"],
                    Width   = 600,
                    Height  = 550,
                    Content = new FootprintViewer(transitionName),
                    //Topmost = true
                };
                footprintViewer.ShowDialog();
            }
            catch (Exception Ex)
            {
                ErrorHandling.ReportErrorToUser("Error: " + Ex.Message + Ex.StackTrace);
            }
        }
コード例 #11
0
        /// <summary>
        /// Search Method to highlight specific transitions on a PetriNet. Checks all Child Thumb Objects of the processModelCanvas
        /// Object for Filetype Transition and the Search String.
        /// </summary>
        /// <param Name="sender"></param>
        /// <param Name="e"></param>
        /// <author>Bernd Nottbeck</author>
        private void SearchPetriNet(object sender, RoutedEventArgs e) //TextChangedEventArgs e)
        {
            String searchText = ((TextBox)sender).Text.ToUpper();

            foreach (Object kind in ProcessModelCanvas.Children)
            {
                if (kind is Thumb)
                {
                    Thumb kindT = (Thumb)kind;
                    if (kindT.Name.Equals("Transition"))
                    {
                        if ((kindT.GetValue(ContentProperty).ToString().ToUpper()).Contains(searchText) && searchText != "")
                        {
                            kindT.Background = Brushes.Aquamarine;
                        }
                        else
                        {
                            kindT.Background = Brushes.LightGray;
                        }
                    }
                }
            }
        }
コード例 #12
0
 public static Brush GetHoverBorderBrush(Thumb thumb)
 {
     return((Brush)thumb.GetValue(HoverBorderBrushProperty));
 }
コード例 #13
0
 public static bool GetThumbCanBeDragged(Thumb el)
 {
     return((bool)el.GetValue(ThumbCanBeDraggedProperty));
 }
コード例 #14
0
 public static Brush GetHoverBackground(Thumb thumb)
 {
     return((Brush)thumb.GetValue(HoverBackgroundProperty));
 }
コード例 #15
0
 public static Color?GetShadowColor(Thumb thumb)
 {
     return((Color?)thumb.GetValue(ShadowColorProperty));
 }
コード例 #16
0
 public static CornerRadius GetCornerRadius(Thumb thumb)
 {
     return((CornerRadius)thumb.GetValue(CornerRadiusProperty));
 }
コード例 #17
0
 public static DataTemplateSelector GetContentTemplateSelector(Thumb thunb)
 {
     return((DataTemplateSelector)thunb.GetValue(ContentTemplateSelectorProperty));
 }
コード例 #18
0
 internal static bool GetIsEnabled(Thumb thumb)
 {
     return((bool)thumb.GetValue(IsEnabledProperty));
 }
コード例 #19
0
 public static DataGridColumn GetSyncColumn(Thumb obj)
 => (DataGridColumn)obj.GetValue(SyncColumnProperty);
コード例 #20
0
ファイル: DragablzItem.cs プロジェクト: zjamt/SimpleRemote
 public static bool GetIsCustomThumb(Thumb element)
 {
     return((bool)element.GetValue(IsCustomThumbProperty));
 }
コード例 #21
0
 public static object GetContent(Thumb thunb)
 {
     return((object)thunb.GetValue(ContentProperty));
 }
コード例 #22
0
 public static DataTemplate GetContentTemplate(Thumb thunb)
 {
     return((DataTemplate)thunb.GetValue(ContentTemplateProperty));
 }
コード例 #23
0
 public static bool GetIsExpanded(Thumb thumb)
 {
     return((bool)thumb.GetValue(IsExpandedProperty));
 }