public VmMainWindow(MainWindow frm, Application myApplication)
            {
                DeviceBasedOnType  = new List <ObjectItem>();
                this.frm           = frm;
                this.myApplication = myApplication;
                MyGrid             = new ObservableCollection <ModelData>();
                CmdAdd             = new Helpers.RelayCommand(ExeAdd);
                CmdAddAttr         = new Helpers.RelayCommand(ExeAddAttr);
                Type       = new ObservableCollection <ComboModelView>();
                StringType = new List <string>();
                MaterialModel _devices = new MaterialModel();


                myApplication.Selection[0].ExecuteFormula("Ut;A5;", out catalogName); //only if run from materials and uner materials. have to do one for standardkatalog

                MaskDescriptionModel mappedDesc = new MaskDescriptionModel();

                myApplication.Folders.Catalogs.Children.ToList().ForEach(items =>
                {
                    if (items.Name == catalogName)
                    {
                        _devices.DeviceObjMat        = getAllDeviceMat();
                        _devices.DeviceByStringTypes = getAllDeviceByStringType(_devices.DeviceObjMat);
                        getAllDeviceByStringType(_devices.DeviceObjMat).Distinct().ToList().ForEach(item => { Type.Add(new ComboModelView()
                            {
                                TypeName = item
                            });  StringType.Add(item); });
                    }
                });

                Icon = myApplication.Folders.Attributes.Image;
            }
Example #2
0
        public ObjectitemTabTree(MaskDescriptionModel source)
        {
            Source = source;
            ////TabTreeIcon = Source.Image;
            TabTreeChildren = new List <ObjectitemTabTree>();
            if (!String.IsNullOrEmpty(Source.FolderName))
            {
                TabTreeName = Source.FolderName;
            }

            else if (!String.IsNullOrEmpty(Source.Typename))
            {
                TabTreeName = Source.Typename;
            }
            else
            {
                TabTreeName = source.TabName.Name;
            }

            if (source.TabAttributes != null && source.TabAttributes.Count != 0)
            {
                foreach (var item in source.TabAttributes)
                {
                    TabTreeChildren.Add(new ObjectitemTabTree(item));
                }
            }

            if (Source.TreeView != null)
            {
                foreach (var child in Source.TreeView)
                {
                    TabTreeChildren.Add(new ObjectitemTabTree(child));
                }
            }
        }
Example #3
0
        private void TreeView_Drop(object sender, DragEventArgs e)
        {
            //string str = (string)e.Data.GetData(typeof(string));
            ObjectitemToDragToTree DroopedItem  = e.Data.GetData(typeof(ObjectitemToDragToTree)) as ObjectitemToDragToTree;
            TreeViewItem           treeViewItem = FindAncestor <TreeViewItem>((DependencyObject)e.OriginalSource);

            if (treeViewItem != null)
            {
                nodeDrop = treeViewItem.DataContext as ObjectitemTabTree;
                var droppedNode = (ObjectitemTabTree)treeViewItem.Header;

                if (nodeDrop.Source != null)
                {
                    MaskDescriptionModel  mask     = new MaskDescriptionModel();
                    ObjectMaskDescription listMask = new ObjectMaskDescription();
                    listMask.Name = DroopedItem.ToDragTreeName;
                    mask.TabName  = listMask;
                    object idFromValue = new object();
                    try
                    {
                        idFromValue = DroopedItem.Source.Attributes.Where(x => x.Id.Equals(AttributeId.Aid)).Select(x => x.Value).FirstOrDefault();
                    }
                    catch { MessageBox.Show("Id cant befound for this attribute, please check value at TId."); }
                    ObjectitemTabTree obj = new ObjectitemTabTree(mask);
                    obj.AddedId = idFromValue.ToString();
                    nodeDrop.TabTreeChildren.Add(obj);
                    treeViewItem.Items.Refresh();
                    if (nodeDrop != null)
                    {
                        MessageBox.Show("You have added item to " + nodeDrop.TabTreeName);
                    }
                }
                else
                {
                    MessageBox.Show("Please drag to an attribute tab.");
                }
            }
            else
            {
                MessageBox.Show("Please select a proper drop off point.");
            }
        }
Example #4
0
        private void PushImportPage(object obj)
        {
            List <ObjectItemTypeDefinationModel> selectedData = GetAllSelectedChildrens(Tree);
            MaskDescriptionModel          mappedDesc          = new MaskDescriptionModel();
            List <ObjectitemTabTree>      Tabmodel            = new List <ObjectitemTabTree>();
            List <ObjectitemToDragToTree> attModel            = new List <ObjectitemToDragToTree>();
            var definations = GetAllAttribute();

            definations.ForEach(x => { if (x.Name != "Project System Templates")
                                       {
                                           attModel.Add(new ObjectitemToDragToTree(x));
                                       }
                                });
            //attModel.Add(new ObjectitemToDragToTree(definations));
            foreach (var item in selectedData)
            {
                mappedDesc.FolderName = item.Name;
                List <MaskDescriptionModel> ListmappedDesc = new List <MaskDescriptionModel>();
                foreach (var types in item.FolderChildren)
                {
                    var maskDesc = GetMaskDescription(types.Source.Id);
                    MaskDescriptionModel childMapping = new MaskDescriptionModel();
                    childMapping.TreeView = MapMaskDescriptionModel(maskDesc);
                    childMapping.Typename = types.Name;
                    ListmappedDesc.Add(childMapping);
                }
                mappedDesc.TreeView = ListmappedDesc;
                Tabmodel.Add(new ObjectitemTabTree(mappedDesc));
            }
            if (selectedData.Count == 0)
            {
                System.Windows.MessageBox.Show("Please Select Some Data!!!");
            }
            else
            {
                ImportWindow importPage = new ImportWindow();
                importPage.DataContext = new ImportWindowViewModel(this.myApplication, Tabmodel, attModel);
                importPage.ShowDialog();
            }
        }
            private List <MaskDescriptionModel> MapMaskDescriptionModel(IList <ObjectMaskDescription> maskDescription)
            {
                List <MaskDescriptionModel> tabsAndAtt = new List <MaskDescriptionModel>();
                MaskDescriptionModel        singletab  = new MaskDescriptionModel();

                foreach (var obj in maskDescription)
                {
                    if (obj.ID.Equals(AttributeId.Unspecified))
                    {
                        if (singletab.TabAttributes != null)
                        {
                            tabsAndAtt.Add(singletab);
                        }

                        singletab         = new MaskDescriptionModel();
                        singletab.TabName = obj;
                    }

                    if (singletab.TabAttributes == null)
                    {
                        singletab.TabAttributes = new List <ObjectMaskDescription>();
                    }

                    if (!obj.ID.Equals(AttributeId.Unspecified))
                    {
                        singletab.TabAttributes.Add(obj);
                    }
                }

                if (singletab != null)
                {
                    tabsAndAtt.Add(singletab);
                }

                return(tabsAndAtt);
            }
        private List <MaskDescriptionModel> MapSheetAsObjTypeDefination(SpreadSheetHelper spreadSheetHelper)
        {
            int rowIndex = 1;
            List <MaskDescriptionModel>  TotalTabAndAtt = new List <MaskDescriptionModel>();
            MaskDescriptionModel         TabsAndAtt     = new MaskDescriptionModel();
            List <ExcelAttributeMapping> totalAtt       = new List <ExcelAttributeMapping>();

            foreach (Row row in spreadSheetHelper.Rows)
            {
                ExcelAttributeMapping AttNameID = new ExcelAttributeMapping();

                var RowA = row.Descendants <Cell>().Where(x => x.CellReference == "A" + rowIndex).FirstOrDefault();
                var RowB = row.Descendants <Cell>().Where(x => x.CellReference == "B" + rowIndex).FirstOrDefault();
                var RowC = row.Descendants <Cell>().Where(x => x.CellReference == "C" + rowIndex).FirstOrDefault();

                var ValueA = CellValueFromCell(RowA, spreadSheetHelper);
                var ValueB = CellValueFromCell(RowB, spreadSheetHelper);
                var ValueC = CellValueFromCell(RowC, spreadSheetHelper);

                if (String.IsNullOrEmpty(ValueB) && RowB != null)
                {
                    ValueB = RowB.CellValue.InnerText;
                }
                if (String.IsNullOrEmpty(ValueC) && RowC != null)
                {
                    ValueC = RowC.CellValue.InnerText;
                }

                if (ValueB != null && ValueB.Equals("Tab Name"))
                {
                    if (rowIndex > 2)
                    {
                        TabsAndAtt.AttibuteNameAndID = totalAtt;
                        TotalTabAndAtt.Add(TabsAndAtt);
                        TabsAndAtt = new MaskDescriptionModel();
                        totalAtt   = new List <ExcelAttributeMapping>();
                    }

                    if (ValueB != null)
                    {
                        TabsAndAtt.TabNameString = ValueA;
                    }
                }
                else if (ValueB != null && !ValueB.Equals("Tab Name") && !ValueB.Equals("AttributeID"))
                {
                    AttNameID.AttributesNameString = ValueA;
                    AttNameID.AttributesIdString   = ValueB;
                    if (!String.IsNullOrEmpty(ValueC))
                    {
                        AttNameID.Function = ValueC;
                    }
                }
                if (AttNameID.AttributesIdString != null)
                {
                    totalAtt.Add(AttNameID);
                }

                rowIndex++;
            }

            if (TabsAndAtt != null && TotalTabAndAtt != null && totalAtt != null)
            {
                TabsAndAtt.AttibuteNameAndID = totalAtt;
            }
            TotalTabAndAtt.Add(TabsAndAtt);

            return(TotalTabAndAtt);
        }