示例#1
0
        public ThresholdDataSet(IController controller, Int32 configurationID)
        {
            organizationData = new ThresholdData("Organization");
            roleData = new ThresholdData("Role"); 
            billetData = new ThresholdData("Billet"); 
            informationProductData = new ThresholdData("Information Product"); 
            activityData = new ThresholdData("Activity");
            thresholdData = new ThresholdData[] { organizationData, roleData, billetData, informationProductData, activityData };
            
            XPathNodeIterator thresholds = controller.GetComponentAndChildren(configurationID, "Configuration", new ComponentOptions()).CreateNavigator().Select("/Components/Component/Component[@Type='Threshold']");
            if (thresholds.Count != 0)
            {
                ColorConverter cv = new ColorConverter();
                String baseString = "ComponentParameters/Parameter[@category='Threshold']/Parameter[@displayedName='";
                foreach (XPathNavigator threshold in thresholds)
                {
                    String name = threshold.GetAttribute("Name", "");
                    Double _lv = Double.Parse(threshold.SelectSingleNode(baseString + "LowerThresholdValue']/@value").ToString());
                    Double _mv1 = Double.Parse(threshold.SelectSingleNode(baseString + "MiddleThresholdValue1']/@value").ToString());
                    Double _mv2 = Double.Parse(threshold.SelectSingleNode(baseString + "MiddleThresholdValue2']/@value").ToString());
                    Double _uv = Double.Parse(threshold.SelectSingleNode(baseString + "UpperThresholdValue']/@value").ToString());
                    Boolean _lowerCheck = Boolean.Parse(threshold.SelectSingleNode(baseString + "LowerThresholdValueIsEqual']/@value").ToString());
                    Boolean _middleCheck1 = Boolean.Parse(threshold.SelectSingleNode(baseString + "MiddleThresholdValue1IsEqual']/@value").ToString());
                    Boolean _middleCheck2 = Boolean.Parse(threshold.SelectSingleNode(baseString + "MiddleThresholdValue2IsEqual']/@value").ToString());
                    Boolean _upperCheck = Boolean.Parse(threshold.SelectSingleNode(baseString + "UpperThresholdValueIsEqual']/@value").ToString());
                    Color _lowerColor = (Color)cv.ConvertFromString(threshold.SelectSingleNode(baseString + "LowerThresholdColor']/@value").ToString());
                    Color _middleColor = (Color)cv.ConvertFromString(threshold.SelectSingleNode(baseString + "MiddleThresholdColor']/@value").ToString());
                    Color _upperColor = (Color)cv.ConvertFromString(threshold.SelectSingleNode(baseString + "UpperThresholdColor']/@value").ToString());
                    bool found = false;
                    for(int i = 0; i < thresholdData.Length; i++)
                    {
                        ThresholdData data = thresholdData[i];
                        if (data.Name.Equals(name))
                        {
                            found = true;
                            data.LowerValue = _lv;
                            data.MiddleValue1 = _mv1;
                            data.MiddleValue2 = _mv2;
                            data.UpperValue = _uv;

                            data.LowerCheck = _lowerCheck;
                            data.MiddleCheck1 = _middleCheck1;
                            data.MiddleCheck2 = _middleCheck2;
                            data.UpperCheck = _upperCheck;

                            data.LowerColor = _lowerColor;
                            data.MiddleColor = _middleColor;
                            data.UpperColor = _upperColor;
                        }
                    }
                    if (!found)
                    {
                        throw new Exception("Could not find threshold data: " + name);
                    }
                }
            }
        }
示例#2
0
        public static List<Function> GetFunctions(int RootID, int ComponentID, String linkType, IController passedController)
        {
            ComponentOptions compOptions = new ComponentOptions();
            compOptions.LevelDown = 0;
            IXPathNavigable comp = passedController.GetComponentAndChildren(RootID, ComponentID, linkType, compOptions);

            if (comp != null)
            {
                XPathNavigator nav = comp.CreateNavigator();

                //XPathNodeIterator iterator = nav.Select("//Component[@" + XmlSchemaConstants.Display.Component.Id + "='" + ComponentID + "']");

                XPathNodeIterator iterator = nav.Select("/Components/Component");

                if (iterator.Count > 0)
                {
                    iterator.MoveNext();

                    return GetFunctions(iterator.Current);
                }
            }

            return new List<Function>();
        }
示例#3
0
        public ListDialog(String p_listAddFromScreen, String p_listItemType, String p_listLinkType, IController p_listController, int p_rootIDForList, String p_callingLinkType, IController p_callingController, int p_callingRootID)
            : base()
        {
            myHelper = new ViewComponentHelper(this);

            InitializeComponent();

            CreateColumns();

            m_listLinkType = p_listLinkType;
            m_callingLinkType = p_callingLinkType;

            m_listItemType = p_listItemType;

            m_rootIDForList = p_rootIDForList;
            m_callingRootID = p_callingRootID;

            listController = p_listController;
            callingController = p_callingController;

            amountToAddUpDown = new NumericUpDown();
            this.myScrollingListView.Controls.Add(amountToAddUpDown);
            amountToAddUpDown.Hide();

            this.myScrollingListView.ItemSelectionChanged += new ListViewItemSelectionChangedEventHandler(listView1_ItemSelectionChanged);
            this.myScrollingListView.DoubleClick += new EventHandler(ListDialog_DoubleClick);
            this.myScrollingListView.HScrollMoved += new EventHandler(listView1_ScrollMoved);
            this.myScrollingListView.VScrollMoved += new EventHandler(listView1_ScrollMoved);
            this.myScrollingListView.MouseWheelRotated += new EventHandler(listView1_MouseWheelRotated);

            this.amountToAddUpDown.KeyDown += new KeyEventHandler(newNumericUpDown_KeyDown);

            // initialize label
            ComponentOptions compOptions = new ComponentOptions();
            compOptions.LevelDown = 0;

            IXPathNavigable callingInfoIXP = callingController.GetComponentAndChildren(m_callingRootID, p_callingLinkType, compOptions);
            XPathNavigator callingNavigator = callingInfoIXP.CreateNavigator();

            XPathNavigator callingRootComponent = callingNavigator.SelectSingleNode("/Components/Component");

            if (callingRootComponent != null)
            {
                String rootName = callingRootComponent.GetAttribute("Name", callingRootComponent.NamespaceURI);
                String rootType = callingRootComponent.GetAttribute("Type", callingRootComponent.NamespaceURI);
                addButtonLabel.Text = "Add selected items to " + rootType + " " + rootName + ":";
            }

            // initialize title
            this.Text = "Items of type " + m_listItemType + " from the " + p_listAddFromScreen;

            addButton.AutoSize = true;
            addButton.Text = "Add";
            addButton.Click += new EventHandler(AddButton_Click);
            closeButton.Click += new EventHandler(buttonCancel_Click);

            this.myScrollingListView.MultiSelect = true;

            // update / close hooks:
            callingController.RegisterForUpdate(this);
            this.FormClosing += new FormClosingEventHandler(ListDialog_FormClosing);

            // default images
            Dictionary<String, Bitmap> typeImage = listController.GetIcons();
            ImageList tempList = new ImageList();
            Image image;

            foreach (String k in typeImage.Keys)
            {
                image = typeImage[k];
                tempList.Images.Add(k, image);
            }

            this.myScrollingListView.SmallImageList = tempList;
        }