コード例 #1
0
 public override void SetOwner(object owner)
 {
     base.SetOwner(owner);
     if (owner is HMISimpleBase)
     {
         HMISimpleBase hmiBase = (HMISimpleBase)owner;
         HMIBase = hmiBase;
         Item    = hmiBase.Item;
         if (hmiBase is HMIBooleanBase)
         {
             HmiBoolean = hmiBase as HMIBooleanBase;
         }
     }
 }
コード例 #2
0
        /*
         * public void SetOwner(HMISimpleBase hmiBase)
         * {
         *  HMIBase = hmiBase;
         *  Item = hmiBase.Item;
         *  if (hmiBase is HMIBooleanBase)
         *      HmiBoolean = hmiBase as HMIBooleanBase;
         *  SqlTimeLast = Item.SqlTime;
         *  chart1.ValueFormatString = Item.FormatValue;
         * }
         */

        public override void SetOwner(object owner)
        {
            base.SetOwner(owner);
            if (owner is HMISimpleBase)
            {
                HMISimpleBase hmiBase = (HMISimpleBase)owner;
                HMIBase = hmiBase;
                Item    = hmiBase.Item;
                if (hmiBase is HMIBooleanBase)
                {
                    HmiBoolean = hmiBase as HMIBooleanBase;
                }
                SqlTimeLast = Item.SqlTime;
                chrBase.ValueFormatString = Item.FormatValue;
            }
        }
コード例 #3
0
ファイル: Global.cs プロジェクト: vscode1111/WebControl
 /// <summary>
 /// Добавление визуального элемента в коллекцию.
 /// </summary>
 public void AddUIControl(HMISimpleBase control)
 {
     UIControls.Add(control);
 }
コード例 #4
0
ファイル: ViewBase.cs プロジェクト: vscode1111/WebControl
        void ViewBase_Loaded(object sender, RoutedEventArgs e)
        {
            if (NavItem != null && NavItem.Group != null)
            {
                NavItem.Group.SelectedItem = NavItem;
            }

            if (!ItemsInited)
            {
                Type        myType     = GetType();
                FieldInfo[] FieldInfos = myType.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

                UIElement uiElement = null;
                foreach (FieldInfo info in FieldInfos)
                {
                    if (info.Name == "LayoutRoot")
                    {
                        uiElement = info.GetValue(this) as UIElement;
                    }
                }

                if (uiElement != null)
                {
                    GetTextBoxes(uiElement, UserControlExs);
                }

                string dataName;
                string extension;
                //Regex regex = new Regex("({\\w*\\.\\w*\\.\\w*\\.\\w*\\;(\\w*|\\w*\"\\w *\"\\w*)\\;\\w*})");
                foreach (UserControlEx userControl in UserControlExs)
                {
                    if (userControl is HMISimpleBase)
                    {
                        HMISimpleBase hmiSimple = userControl as HMISimpleBase;
                        if (!string.IsNullOrEmpty(hmiSimple.DataName))
                        {
                            ItemDataNames.Add(hmiSimple.DataName);
                        }
                    }
                    else if (userControl is HMINodeEx)
                    {
                        HMINodeEx hmiNodeEx = userControl as HMINodeEx;
                        if (!string.IsNullOrEmpty(hmiNodeEx.DataNameEx))
                        {
                            ItemDataNames.Add(string.Format("{0}_Status", hmiNodeEx.DataNameEx));
                            ItemDataNames.Add(string.Format("{0}_ReplyTime", hmiNodeEx.DataNameEx));
                        }

                        if (hmiNodeEx.AutoCaptions)
                        {
                            dataName = string.Format("{0}_Status", hmiNodeEx.DataNameEx);
                            if (Global.Default.ItemsRealDict.ContainsKey(dataName))
                            {
                                //MatchCollection matches = regex.Matches(Global.Default.ItemsRealDict[dataName].Description);
                                try
                                {
                                    extension = FindExtension(Global.Default.ItemsRealDict[dataName].Comment);

                                    string[] strOut = extension.Split(';');

                                    hmiNodeEx.CaptionAdditional = strOut[0];
                                    hmiNodeEx.CaptionMain       = strOut[1];
                                    hmiNodeEx.Type = (NodeType)int.Parse(strOut[2]);
                                }
                                catch { }
                            }
                        }
                    }
                }

                ItemsInited = true;
            }

            foreach (string dataName in ItemDataNames)
            {
                Global.Default.VisualControlActivate(dataName);
            }

            Global.Default.ForceInterfaceChanged(this, EventArgs.Empty);
        }