コード例 #1
0
            void button_Click(object sender, RoutedEventArgs e)
            {
                Button btn = (Button)sender;
                StateNumberSelection StateSelectionPopup = new StateNumberSelection(designerCanvas.avaliableStateNumberList, btn.Content.ToString(), designerCanvas.CurrentBrandId
                                                                                    , designerCanvas.TransactionList);

                StateSelectionPopup.ShowDialog();

                //BufferPositions bufferPopup = new BufferPositions(btn.Content.ToString());
                //bufferPopup.ShowDialog();
                btn.Content = StateSelectionPopup.StateNumber;


                var Selection = designerCanvas.SelectionService.CurrentSelection;
                ViewModelDesignerItem Ditem = new ViewModelDesignerItem();

                foreach (var slc in Selection)
                {
                    Ditem = (ViewModelDesignerItem)slc;
                }
                DockPanel    Sourcepnl        = (DockPanel)Ditem.Content;
                PropertyGrid SelectedPgrid    = designerCanvas.TransactionList.FindAll(x => x.TransactionName == designerCanvas.CurrentTransactionName).Find(x => x.Id == Sourcepnl.Uid).PropertyGrid;
                string       SelectedProperty = btn.Name.ToString();
                string       newValue         = btn.Content.ToString();
                Object       stateobj         = (Object)SelectedPgrid.SelectedObject;

                Type         ClassType = stateobj.GetType();
                PropertyInfo property  = ClassType.GetProperty(SelectedProperty);

                property.SetValue(stateobj, newValue, null);
                designerCanvas.TransactionList.FindAll(x => x.TransactionName == designerCanvas.CurrentTransactionName).Find(x => x.Id == Sourcepnl.Uid).PropertyGrid.SelectedObject = stateobj;
            }
コード例 #2
0
            void button_Click(object sender, RoutedEventArgs e)
            {
                Button btn = (Button)sender;
                StateNumberSelection StateSelectionPopup = new StateNumberSelection(designerCanvas.avaliableStateNumberList, btn.Content.ToString(), designerCanvas.CurrentBrandId
                                                                                    , designerCanvas.TransactionList);

                StateSelectionPopup.ShowDialog();

                var Selection = designerCanvas.SelectionService.CurrentSelection;
                ViewModelDesignerItem Ditem = new ViewModelDesignerItem();

                foreach (var slc in Selection)
                {
                    Ditem = (ViewModelDesignerItem)slc;
                }
                DockPanel Sourcepnl = (DockPanel)Ditem.Content;


                //StateNumber deðiþmememiþ
                if (btn.Content.ToString() == StateSelectionPopup.StateNumber)
                {
                    return;
                }

                //State number ve baðlantýlý yerlerde gerekli güncellemeler
                string ExStateId  = btn.Content.ToString();
                string NewStateId = StateSelectionPopup.StateNumber;

                PropertyGrid SelectedPgrid = designerCanvas.TransactionList.FindAll(x => x.TransactionName == designerCanvas.CurrentTransactionName).Find(x => x.Id == ExStateId).PropertyGrid;

                Object state = (Object)SelectedPgrid.SelectedObject;

                if (state != null)
                {
                    btn.Content = NewStateId;
                    string SelectedProperty      = btn.Name.ToString();
                    string SelectedPropertyValue = NewStateId;

                    //state güncellemesi
                    SelectedPgrid.SelectedObject.GetType().GetProperty("StateNumber").SetValue(SelectedPgrid.SelectedObject, SelectedPropertyValue);
                    SelectedPgrid.SelectedObjectName = SelectedPropertyValue;

                    designerCanvas.TransactionList.FindAll(x => x.TransactionName == designerCanvas.CurrentTransactionName)
                    .Find(x => x.Id == ExStateId).PropertyGrid = SelectedPgrid;
                    designerCanvas.TransactionList.FindAll(x => x.TransactionName == designerCanvas.CurrentTransactionName)
                    .Find(x => x.Id == ExStateId).Id = SelectedPropertyValue;

                    Sourcepnl.Uid = SelectedPropertyValue;
                    Ditem.Content = Sourcepnl;
                    designerCanvas.avaliableStateNumberList.Remove(SelectedPropertyValue);

                    //parent State Güncellemesi
                    List <ModelParentStateObject> PStateList = new List <ModelParentStateObject>();
                    PStateList = designerCanvas.TransactionList.FindAll(x => x.TransactionName == designerCanvas.CurrentTransactionName).Find(x => x.Id == SelectedPropertyValue).ParentStateList;
                    if (PStateList.Count != 0)
                    {
                        for (int i = 0; i < PStateList.Count; i++)
                        {
                            SelectedPgrid = designerCanvas.TransactionList.Find(x => x.Id == PStateList[i].ParentId).PropertyGrid;
                            SelectedPgrid.SelectedObject.GetType().GetProperty(PStateList[i].PropertyName).SetValue(SelectedPgrid.SelectedObject, SelectedPropertyValue);
                            designerCanvas.TransactionList.Find(x => x.Id == PStateList[i].ParentId).PropertyGrid.SelectedObject = SelectedPgrid.SelectedObject;
                        }
                    }
                }
                else
                {
                }
            }