/// <summary> /// 获取选中对象 /// </summary> /// <param name="e">事件数据</param> /// <param name="eventType">事件类型</param> /// <returns>选中对象</returns> private WfElement GetWfElement(MouseButtonEventArgs e, EventType eventType) { WfElement element = new WfElement(); element.X = e.GetPosition(null).X; element.Y = e.GetPosition(null).Y; element.EventType = eventType; if (((System.Windows.FrameworkElement)e.OriginalSource).DataContext is WorkflowRuntime.ViewModels.DiagramPageViewModel) { element.SrcElement = SrcElement.Null; element.ExtraInfo = string.Empty; } else if (((System.Windows.FrameworkElement)e.OriginalSource).DataContext is Northwoods.GoXam.PartManager.PartBinding && ((Northwoods.GoXam.PartManager.PartBinding)(((System.Windows.FrameworkElement)(((System.Windows.RoutedEventArgs)(e)).OriginalSource)).DataContext)).Node != null) { string selectedNodeID = ((WorkflowRuntime.Models.ActivityNode)(((Northwoods.GoXam.Part)(((Northwoods.GoXam.PartManager.PartBinding)(((System.Windows.FrameworkElement)(((System.Windows.RoutedEventArgs)(e)).OriginalSource)).DataContext)).Node)).Data)).InstanceID; element.ExtraInfo = GetExtraInfo(SrcElement.Point, selectedNodeID); element.SrcElement = SrcElement.Point; } else if (((System.Windows.FrameworkElement)e.OriginalSource).DataContext is Northwoods.GoXam.PartManager.PartBinding && ((Northwoods.GoXam.PartManager.PartBinding)(((System.Windows.FrameworkElement)(((System.Windows.RoutedEventArgs)(e)).OriginalSource)).DataContext)).Link != null) { string selectedLineID = ((WorkflowRuntime.Models.ActivityLink)(((Northwoods.GoXam.Part)(((Northwoods.GoXam.PartManager.PartBinding)(((System.Windows.FrameworkElement)(((System.Windows.RoutedEventArgs)(e)).OriginalSource)).DataContext)).Link)).Data)).Key; element.ExtraInfo = GetExtraInfo(SrcElement.Line, selectedLineID); element.SrcElement = SrcElement.Line; } return(element); }
/// <summary> /// 调用事件处理方法 /// </summary> /// <param name="element">选中对象</param> private void WfElementClicked(WfElement element) { string js = @"var data={}; data.eventType='" + ((int)element.EventType).ToString() + "';data.x=" + element.X.ToString() + ";data.y=" + element.Y.ToString() + ";data.extraInfo='" + element.ExtraInfo + "';data.srcElement='" + ((int)element.SrcElement).ToString() + "'; if (typeof OnWfElementClicked != 'undefined'& typeof OnWfElementClicked =='function') OnWfElementClicked(data);"; HtmlPage.Window.Eval(js); }
/// <summary> /// 调用事件处理方法 /// </summary> /// <param name="element">选中对象</param> private void WfElementClicked(WfElement element) { string js = @"var data={}; data.eventType='" + ((int)element.EventType).ToString() + "';data.x=" + element.X.ToString() + ";data.y=" + element.Y.ToString() + ";data.extraInfo='" + element.ExtraInfo + "';data.srcElement='" + ((int)element.SrcElement).ToString() + "'; if (typeof OnWfElementClicked != 'undefined'& typeof OnWfElementClicked =='function') OnWfElementClicked(data);"; HtmlPage.Window.Eval(js); }
/// <summary> /// 获取选中对象 /// </summary> /// <param name="e">事件数据</param> /// <param name="eventType">事件类型</param> /// <returns>选中对象</returns> private WfElement GetWfElement(MouseButtonEventArgs e, EventType eventType) { WfElement element = new WfElement(); element.X = e.GetPosition(null).X; element.Y = e.GetPosition(null).Y; element.EventType = eventType; if (((System.Windows.FrameworkElement)e.OriginalSource).DataContext is WorkflowRuntime.ViewModels.DiagramPageViewModel) { element.SrcElement = SrcElement.Null; element.ExtraInfo = string.Empty; } else if (((System.Windows.FrameworkElement)e.OriginalSource).DataContext is Northwoods.GoXam.PartManager.PartBinding && ((Northwoods.GoXam.PartManager.PartBinding)(((System.Windows.FrameworkElement)(((System.Windows.RoutedEventArgs)(e)).OriginalSource)).DataContext)).Node != null) { string selectedNodeID = ((WorkflowRuntime.Models.ActivityNode)(((Northwoods.GoXam.Part)(((Northwoods.GoXam.PartManager.PartBinding)(((System.Windows.FrameworkElement)(((System.Windows.RoutedEventArgs)(e)).OriginalSource)).DataContext)).Node)).Data)).InstanceID; element.ExtraInfo = GetExtraInfo(SrcElement.Point, selectedNodeID); element.SrcElement = SrcElement.Point; } else if (((System.Windows.FrameworkElement)e.OriginalSource).DataContext is Northwoods.GoXam.PartManager.PartBinding && ((Northwoods.GoXam.PartManager.PartBinding)(((System.Windows.FrameworkElement)(((System.Windows.RoutedEventArgs)(e)).OriginalSource)).DataContext)).Link != null) { string selectedLineID = ((WorkflowRuntime.Models.ActivityLink)(((Northwoods.GoXam.Part)(((Northwoods.GoXam.PartManager.PartBinding)(((System.Windows.FrameworkElement)(((System.Windows.RoutedEventArgs)(e)).OriginalSource)).DataContext)).Link)).Data)).Key; element.ExtraInfo = GetExtraInfo(SrcElement.Line, selectedLineID); element.SrcElement = SrcElement.Line; } return element; }