Пример #1
0
        public override void ShowDialog(PropertyValue propertyValue, System.Windows.IInputElement commandSource)
        {
            EventActionWin    wn     = new EventActionWin();
            EventActionDefine action = propertyValue.Value as EventActionDefine;

            wn.action_url       = action.url;
            wn.action_params    = action.action_params;
            wn.event_linkParams = action.event_params;

            if (wn.ShowDialog().Equals(true))
            {
                var       ownerActivityConverter = new ModelPropertyEntryToOwnerActivityConverter();
                ModelItem activityItem           = ownerActivityConverter.Convert(propertyValue.ParentProperty, typeof(ModelItem), false, null) as ModelItem;
                using (ModelEditingScope editingScope = activityItem.BeginEdit())
                {
                    EventActionDefine newValue = new EventActionDefine();
                    newValue.url           = wn.action_url;
                    newValue.action_params = wn.action_params;
                    newValue.event_params  = wn.event_linkParams;

                    propertyValue.Value = newValue;
                    editingScope.Complete();

                    var control = commandSource as Control;
                    var oldData = control.DataContext;
                    control.DataContext = null;
                    control.DataContext = oldData;
                }
            }
        }
Пример #2
0
        public override void ShowDialog(PropertyValue propertyValue, System.Windows.IInputElement commandSource)
        {
            TimeoutWin wn = new TimeoutWin();
            Dictionary <string, object> action = propertyValue.Value as Dictionary <string, object>;

            wn.time_start    = action.ContainsKey("start") ? (action["start"] as string) : "";
            wn.time_offset   = action.ContainsKey("offset") ? (action["offset"] as TimeSpan?) : null;
            wn.time_exact    = action.ContainsKey("exact") ? (action["exact"] as DateTime?) : null;
            wn.time_callback = action.ContainsKey("callback") ? (action["callback"] as string) : "";
            wn.time_action   = action.ContainsKey("action") ? (action["action"] as string) : "";

            if (wn.ShowDialog().Equals(true))
            {
                var       ownerActivityConverter = new ModelPropertyEntryToOwnerActivityConverter();
                ModelItem activityItem           = ownerActivityConverter.Convert(propertyValue.ParentProperty, typeof(ModelItem), false, null) as ModelItem;
                using (ModelEditingScope editingScope = activityItem.BeginEdit())
                {
                    Dictionary <string, object> newValue = new Dictionary <string, object>();
                    newValue["start"]    = wn.time_start;
                    newValue["offset"]   = wn.time_offset;
                    newValue["exact"]    = wn.time_exact;
                    newValue["action"]   = wn.time_action;
                    newValue["callback"] = wn.time_callback;

                    propertyValue.Value = newValue;
                    editingScope.Complete();

                    var control = commandSource as Control;
                    var oldData = control.DataContext;
                    control.DataContext = null;
                    control.DataContext = oldData;
                }
            }
        }
Пример #3
0
        public static MouseEventArgs ToEto(this swi.MouseButtonEventArgs e, sw.IInputElement control, swi.MouseButtonState buttonState = swi.MouseButtonState.Pressed)
        {
            var buttons   = e.GetEtoButtons(buttonState);
            var modifiers = swi.Keyboard.Modifiers.ToEto();
            var location  = e.GetPosition(control).ToEto();

            return(new MouseEventArgs(buttons, modifiers, location));
        }
Пример #4
0
        public void ProcessMouseMove(System.Windows.IInputElement src, MouseEventArgs e)
        {
            if (!isDragging)
            {
                return;
            }
            SetNearestNeighbors(selectedChild);
            double newTop, newLeft;
            Point  newCursorPoint = e.GetPosition(src);
            double cursorXDiff    = newCursorPoint.X - cursorStartPoint.X;
            double cursorYDiff    = newCursorPoint.Y - cursorStartPoint.Y;

            newTop  = canvasStartTop + cursorYDiff;
            newLeft = canvasStartLeft + cursorXDiff;
            MovePanel(selectedChild, newTop, newLeft, newCursorPoint);
        }
Пример #5
0
        public static MouseEventArgs ToEto(this swi.MouseEventArgs e, sw.IInputElement control, swi.MouseButtonState buttonState = swi.MouseButtonState.Pressed)
        {
            var buttons = MouseButtons.None;

            if (e.LeftButton == buttonState)
            {
                buttons |= MouseButtons.Primary;
            }
            if (e.RightButton == buttonState)
            {
                buttons |= MouseButtons.Alternate;
            }
            if (e.MiddleButton == buttonState)
            {
                buttons |= MouseButtons.Middle;
            }
            var modifiers = KeyMap.Convert(swi.Key.None, swi.Keyboard.Modifiers);
            var location  = e.GetPosition(control).ToEto();

            return(new MouseEventArgs(buttons, modifiers, location));
        }
Пример #6
0
        public static MouseEventArgs ConvertMouseEvent(sw.IInputElement control, swi.MouseEventArgs e)
        {
            var buttons = MouseButtons.None;

            if (e.LeftButton == swi.MouseButtonState.Pressed)
            {
                buttons |= MouseButtons.Primary;
            }
            if (e.RightButton == swi.MouseButtonState.Pressed)
            {
                buttons |= MouseButtons.Alternate;
            }
            if (e.MiddleButton == swi.MouseButtonState.Pressed)
            {
                buttons |= MouseButtons.Middle;
            }
            var modifiers = Key.None;
            var location  = Generator.Convert(e.GetPosition(control));

            return(new MouseEventArgs(buttons, modifiers, location));
        }
Пример #7
0
        public override void ShowDialog(PropertyValue propertyValue, System.Windows.IInputElement commandSource)
        {
            ParamTransferWin wn = new ParamTransferWin(propertyValue.Value as List <paramtransfer_item>);

            //wn.newValue = propertyValue.Value as List<string>;
            if (wn.ShowDialog().Equals(true))
            {
                var       ownerActivityConverter = new ModelPropertyEntryToOwnerActivityConverter();
                ModelItem activityItem           = ownerActivityConverter.Convert(propertyValue.ParentProperty, typeof(ModelItem), false, null) as ModelItem;
                using (ModelEditingScope editingScope = activityItem.BeginEdit())
                {
                    propertyValue.Value = wn.params_transfer;
                    editingScope.Complete();

                    var control = commandSource as Control;
                    var oldData = control.DataContext;
                    control.DataContext = null;
                    control.DataContext = oldData;
                }
            }
        }
Пример #8
0
        public static MouseEventArgs ToEto(this swi.MouseWheelEventArgs e, sw.IInputElement control, swi.MouseButtonState buttonState = swi.MouseButtonState.Pressed)
        {
            var buttons = MouseButtons.None;

            if (e.LeftButton == buttonState)
            {
                buttons |= MouseButtons.Primary;
            }
            if (e.RightButton == buttonState)
            {
                buttons |= MouseButtons.Alternate;
            }
            if (e.MiddleButton == buttonState)
            {
                buttons |= MouseButtons.Middle;
            }
            var modifiers = Keys.None;
            var location  = e.GetPosition(control).ToEto();
            var delta     = new SizeF(0, (float)e.Delta / WheelDelta);

            return(new MouseEventArgs(buttons, modifiers, location, delta));
        }
Пример #9
0
        public override void ShowDialog(PropertyValue propertyValue, System.Windows.IInputElement commandSource)
        {
            // https://stackoverflow.com/questions/8731605/exposing-collection-of-arguments-for-activity-in-property-grid
            var       PropertyName = propertyValue.ParentProperty.PropertyName;
            ModelItem activity     = new ModelPropertyEntryToOwnerActivityConverter().Convert(propertyValue.ParentProperty, typeof(ModelItem), false, null) as ModelItem;

            DynamicArgumentDesignerOptions options1 = new DynamicArgumentDesignerOptions();

            options1.Title = activity.GetValue <string>("DisplayName");
            DynamicArgumentDesignerOptions options = options1;

            if (!activity.Properties[PropertyName].IsSet)
            {
                Log.Output(PropertyName + " is not set");
                return;
            }
            ModelItem collection = activity.Properties[PropertyName].Collection;

            if (collection == null)
            {
                collection = activity.Properties[PropertyName].Dictionary;
            }
            if (collection == null)
            {
                Log.Output(PropertyName + " is not a Collection or Dictionary");
                return;
            }
            using (ModelEditingScope scope = collection.BeginEdit(PropertyName + "Editing"))
            {
                if (DynamicArgumentDialog.ShowDialog(activity, collection, activity.GetEditingContext(), activity.View, options))
                {
                    scope.Complete();
                }
                else
                {
                    scope.Revert();
                }
            }
        }
Пример #10
0
 public MouseWrapper(SystemWindows.IInputElement inputElement)
 {
     _inputElement = inputElement ?? throw new ArgumentNullException(nameof(inputElement));
 }