public object DeviceValueToUIValue(GXProperty sender, object value)
        {
            DataType dt = (sender as GXIEC62056Property).DataType;

            if (!(value is DateTime))
            {
                if (dt == DataType.DateTime)
                {
                    return(Parser.IEC62056Parser.StringToDateTime(value.ToString()));
                }
                else if (dt == DataType.Date)
                {
                    return(Parser.IEC62056Parser.StringToDateTime(value.ToString()).ToShortDateString());
                }
                else if (dt == DataType.Time)
                {
                    return(Parser.IEC62056Parser.StringToTime(value.ToString()));
                }
            }
            if (dt == DataType.OctetString)
            {
                value = ASCIIEncoding.ASCII.GetString(GXCommon.HexToBytes(value.ToString(), false));
            }
            return(value);
        }
Exemple #2
0
 public AddressDlg(GXProperty property)
 {
     InitializeComponent();
     m_Property = property;
     System.Threading.Thread.CurrentThread.CurrentUICulture = System.Threading.Thread.CurrentThread.CurrentCulture;
     //Update resources..
     nameLbl.Text = "OBIS " + Gurux.IEC62056_21.AddIn.Properties.Resources.AddressTxt;
 }
 public object UIValueToDeviceValue(GXProperty sender, object value)
 {
     if (sender.ValueType == typeof(DateTime))
     {
         return(Parser.IEC62056Parser.DateTimeToString((DateTime)value, true));
     }
     return(value);
 }
 private void PopulateTree(GXProperty target, GXTable table)
 {
     TreeNode propNode = new TreeNode(Resources.None);            
     this.DataSourceTree.Nodes.Add(propNode);    
     TreeNode selNode = null;
     foreach (GXProperty prop in table.Columns)
     {
         propNode = new TreeNode(prop.DisplayName, 3, 3);
         propNode.Tag = prop;
         this.DataSourceTree.Nodes.Add(propNode);                
         if (target == prop)
         {
             selNode = propNode;
         }
     }
     if (selNode != null)
     {
         this.DataSourceTree.SelectedNode = selNode;
     }
     else
     {
         this.DataSourceTree.SelectedNode = this.DataSourceTree.Nodes[0];
     }
 }
 /// <summary>
 /// If editor is used to shown table columns.
 /// </summary>
 public GXDataIOSourceDialog(GXProperty target, GXTable table)
 {
     InitializeComponent();
     PopulateTree(target, table);
 }
		public PropertyDlg(GXDevice GXDevice1, GXProperty GXProperty1, bool Edit)
		{
			m_GXProperty1 = GXProperty1;
			m_GXDevice1 = GXDevice1;
			m_edit = Edit;
			m_Types = CreateTypeTable();
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			PropertyDlgBase DlgBase = new PropertyDlgBase();
			DlgBase.SortTabOrder(GeneralGB);
			DlgBase.SortTabOrder(Common2Tab);
		}