예제 #1
0
 public StateP(ViewModelDesignerCanvas Canvas)
     : base(Canvas)
 {
     StateType        = "P";
     StateDescription = "StatePointer";
     _NextStateNumber = "255";
 }
예제 #2
0
 public StateBase(ViewModelDesignerCanvas Canvas)
 {
     designerCanvas = Canvas;
     _Guid          = "1";
     _Status        = "1";
     _ConfigVersion = "1";
 }
        //ViewProperties on Drop to canvas
        private void TransactionDiagram_PreviewDrop(object sender, DragEventArgs e)
        {
            ViewModelDesignerCanvas dcanvas = new ViewModelDesignerCanvas();

            dcanvas       = (ViewModelDesignerCanvas)sender;
            SelectedPgrid = new PropertyGrid();

            TreeViewItem ChildNode = new TreeViewItem();

            ChildNode = TreeFlow.SelectedItem as TreeViewItem;
            ItemsControl parent     = ItemsControl.ItemsControlFromItemContainer(ChildNode);
            TreeViewItem parentNode = parent as TreeViewItem;

            if (parentNode != null && !String.IsNullOrEmpty(parentNode.Header.ToString()))
            {
                dcanvas.ProjectName            = parentNode.Header.ToString();
                dcanvas.CurrentTransactionName = TransDiagramName.Header.ToString();

                ModelDragObject        dragObject = e.Data.GetData(typeof(ModelDragObject)) as ModelDragObject;
                ModelCanvasStateObject state      = new ModelCanvasStateObject();

                if (dragObject != null && !String.IsNullOrEmpty(dragObject.Xaml))
                {
                    ViewModelDesignerItem newItem = null;
                    Object content = XamlReader.Load(XmlReader.Create(new StringReader(dragObject.Xaml)));
                    if (content != null)
                    {
                        newItem = new ViewModelDesignerItem();
                        DockPanel pnl = (DockPanel)content;

                        string StateBrandName = pnl.ToolTip.ToString();
                        if (StateBrandName != "P" && StateBrandName != "GENERIC")
                        {
                            string StateBrandId = ConfigurationManager.AppSettings[StateBrandName];
                            if (dcanvas.CurrentBrandId != StateBrandId)
                            {
                                MessageBox.Show("Kullanmak istediğiniz State " + StateBrandName + " için sadece kullanılabilir, lütfen Mevcut Brande uygun State kullanınız");
                                return;
                            }
                        }

                        string       frmName       = "State" + pnl.Tag.ToString();
                        string       Id            = dcanvas.avaliableStateNumberList[0].ToString();
                        Type         ClassType     = Type.GetType("ATMDesigner.UI.States." + frmName);
                        Object       ClassInstance = Activator.CreateInstance(ClassType);
                        PropertyInfo StateNo       = ClassType.GetProperty("StateNumber");
                        StateNo.SetValue(ClassInstance, Id, null);

                        propertyGrid.SelectedObject     = ClassInstance;
                        propertyGrid.SelectedObjectName = Id;

                        SelectedPgrid.SelectedObject     = ClassInstance;
                        SelectedPgrid.SelectedObjectName = Id;

                        PropertyGridList.Add(SelectedPgrid);
                    }
                }
            }
        }
예제 #4
0
        void DragThumb_DragDelta(object sender, DragDeltaEventArgs e)
        {
            ViewModelDesignerItem   designerItem = this.DataContext as ViewModelDesignerItem;
            ViewModelDesignerCanvas designer     = VisualTreeHelper.GetParent(designerItem) as ViewModelDesignerCanvas;

            if (designerItem != null && designer != null && designerItem.IsSelected)
            {
                double minLeft = double.MaxValue;
                double minTop  = double.MaxValue;

                // we only move DesignerItems
                var designerItems = designer.SelectionService.CurrentSelection.OfType <ViewModelDesignerItem>();

                foreach (ViewModelDesignerItem item in designerItems)
                {
                    double left = Canvas.GetLeft(item);
                    double top  = Canvas.GetTop(item);

                    minLeft = double.IsNaN(left) ? 0 : Math.Min(left, minLeft);
                    minTop  = double.IsNaN(top) ? 0 : Math.Min(top, minTop);
                }

                double deltaHorizontal = Math.Max(-minLeft, e.HorizontalChange);
                double deltaVertical   = Math.Max(-minTop, e.VerticalChange);

                foreach (ViewModelDesignerItem item in designerItems)
                {
                    double left = Canvas.GetLeft(item);
                    double top  = Canvas.GetTop(item);

                    if (double.IsNaN(left))
                    {
                        left = 0;
                    }
                    if (double.IsNaN(top))
                    {
                        top = 0;
                    }

                    Canvas.SetLeft(item, left + deltaHorizontal);
                    Canvas.SetTop(item, top + deltaVertical);
                }

                designer.InvalidateMeasure();
                e.Handled = true;
            }
        }
        //on Drag Drop event
        private void ViewPropertyGrid(object param)
        {
            DragEventArgs           e       = param as DragEventArgs;
            ViewModelDesignerCanvas dcanvas = new ViewModelDesignerCanvas();
            //dcanvas = (ViewModelDesignerCanvas)sender;
            //SelectedPgrid = new PropertyGrid();

            ModelDragObject        dragObject = e.Data.GetData(typeof(ModelDragObject)) as ModelDragObject;
            ModelCanvasStateObject state      = new ModelCanvasStateObject();

            if (dragObject != null && !String.IsNullOrEmpty(dragObject.Xaml))
            {
                ViewModelDesignerItem newItem = null;
                Object content = XamlReader.Load(XmlReader.Create(new StringReader(dragObject.Xaml)));
                if (content != null)
                {
                    newItem = new ViewModelDesignerItem();
                    DockPanel pnl     = (DockPanel)content;
                    string    frmName = "State" + pnl.Tag.ToString();
                    string    Id      = (dcanvas.avaliableStateNumberList[dcanvas.TransactionList.Count]).ToString();
                    state.Type = pnl.Tag.ToString();


                    Type   CAType = Type.GetType("ATMDesigner.UI.States." + frmName);
                    Object myObj  = Activator.CreateInstance(CAType);

                    PropertyInfo StateNo = CAType.GetProperty("StateNumber");
                    StateNo.SetValue(myObj, Id, null);

                    PropertyInfo stateType = CAType.GetProperty("StateType");
                    stateType.SetValue(myObj, pnl.Tag.ToString(), null);

                    PropertyInfo Desc = CAType.GetProperty("StateDescription");
                    Desc.SetValue(myObj, frmName, null);
                    StateObj = myObj;
                }
            }
        }
예제 #6
0
 public StateF(ViewModelDesignerCanvas Canvas)
     : base(Canvas)
 {
     SetDefaultData();
 }
예제 #7
0
 public Statee001(ViewModelDesignerCanvas Canvas)
     : base(Canvas)
 {
     SetDefaultValues();
 }
        void ResizeThumb_DragDelta(object sender, DragDeltaEventArgs e)
        {
            return;

            ViewModelDesignerItem   designerItem = this.DataContext as ViewModelDesignerItem;
            ViewModelDesignerCanvas designer     = VisualTreeHelper.GetParent(designerItem) as ViewModelDesignerCanvas;

            if (designerItem != null && designer != null && designerItem.IsSelected)
            {
                double minLeft, minTop, minDeltaHorizontal, minDeltaVertical;
                double dragDeltaVertical, dragDeltaHorizontal, scale;

                IEnumerable <ViewModelDesignerItem> selectedDesignerItems = designer.SelectionService.CurrentSelection.OfType <ViewModelDesignerItem>();

                CalculateDragLimits(selectedDesignerItems, out minLeft, out minTop,
                                    out minDeltaHorizontal, out minDeltaVertical);

                foreach (ViewModelDesignerItem item in selectedDesignerItems)
                {
                    if (item != null && item.ParentID == Guid.Empty)
                    {
                        switch (base.VerticalAlignment)
                        {
                        case VerticalAlignment.Bottom:
                            dragDeltaVertical = Math.Min(-e.VerticalChange, minDeltaVertical);
                            scale             = (item.ActualHeight - dragDeltaVertical) / item.ActualHeight;
                            DragBottom(scale, item, designer.SelectionService);
                            break;

                        case VerticalAlignment.Top:
                            double top = Canvas.GetTop(item);
                            dragDeltaVertical = Math.Min(Math.Max(-minTop, e.VerticalChange), minDeltaVertical);
                            scale             = (item.ActualHeight - dragDeltaVertical) / item.ActualHeight;
                            DragTop(scale, item, designer.SelectionService);
                            break;

                        default:
                            break;
                        }

                        switch (base.HorizontalAlignment)
                        {
                        case HorizontalAlignment.Left:
                            double left = Canvas.GetLeft(item);
                            dragDeltaHorizontal = Math.Min(Math.Max(-minLeft, e.HorizontalChange), minDeltaHorizontal);
                            scale = (item.ActualWidth - dragDeltaHorizontal) / item.ActualWidth;
                            DragLeft(scale, item, designer.SelectionService);
                            break;

                        case HorizontalAlignment.Right:
                            dragDeltaHorizontal = Math.Min(-e.HorizontalChange, minDeltaHorizontal);
                            scale = (item.ActualWidth - dragDeltaHorizontal) / item.ActualWidth;
                            DragRight(scale, item, designer.SelectionService);
                            break;

                        default:
                            break;
                        }
                    }
                }
                e.Handled = true;
            }
        }
예제 #9
0
 public StateSemicolon(ViewModelDesignerCanvas Canvas)
     : base(Canvas)
 {
     SetDefaultValues();
 }