Ejemplo n.º 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);
        }
Ejemplo n.º 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
                })));
            }
        }
Ejemplo n.º 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
                })));
            }
        }
        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);
            }
        }
        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);
            }
        }
        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;
            }
        }
        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;
            }
        }
        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;
            }
        }
        /// <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);
        }
        /// <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);
            }
        }
Ejemplo n.º 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;
                        }
                    }
                }
            }
        }
Ejemplo n.º 12
0
 public static Brush GetHoverBorderBrush(Thumb thumb)
 {
     return((Brush)thumb.GetValue(HoverBorderBrushProperty));
 }
Ejemplo n.º 13
0
 public static bool GetThumbCanBeDragged(Thumb el)
 {
     return((bool)el.GetValue(ThumbCanBeDraggedProperty));
 }
Ejemplo n.º 14
0
 public static Brush GetHoverBackground(Thumb thumb)
 {
     return((Brush)thumb.GetValue(HoverBackgroundProperty));
 }
Ejemplo n.º 15
0
 public static Color?GetShadowColor(Thumb thumb)
 {
     return((Color?)thumb.GetValue(ShadowColorProperty));
 }
Ejemplo n.º 16
0
 public static CornerRadius GetCornerRadius(Thumb thumb)
 {
     return((CornerRadius)thumb.GetValue(CornerRadiusProperty));
 }
Ejemplo n.º 17
0
 public static DataTemplateSelector GetContentTemplateSelector(Thumb thunb)
 {
     return((DataTemplateSelector)thunb.GetValue(ContentTemplateSelectorProperty));
 }
Ejemplo n.º 18
0
 internal static bool GetIsEnabled(Thumb thumb)
 {
     return((bool)thumb.GetValue(IsEnabledProperty));
 }
 public static DataGridColumn GetSyncColumn(Thumb obj)
 => (DataGridColumn)obj.GetValue(SyncColumnProperty);
Ejemplo n.º 20
0
 public static bool GetIsCustomThumb(Thumb element)
 {
     return((bool)element.GetValue(IsCustomThumbProperty));
 }
Ejemplo n.º 21
0
 public static object GetContent(Thumb thunb)
 {
     return((object)thunb.GetValue(ContentProperty));
 }
Ejemplo n.º 22
0
 public static DataTemplate GetContentTemplate(Thumb thunb)
 {
     return((DataTemplate)thunb.GetValue(ContentTemplateProperty));
 }
 public static bool GetIsExpanded(Thumb thumb)
 {
     return((bool)thumb.GetValue(IsExpandedProperty));
 }