コード例 #1
0
 private void Create(t_Control tControl)
 {
     if (null != tControl)
     {
         LoadScreen._instance.CreateControl(LoadScreen._instance.csScreen, tControl, 150, 150, 0, 0);
     }
 }
コード例 #2
0
ファイル: ControlVM.cs プロジェクト: Jitlee/WPFMonitor
        private void Load()
        {
            _controls = new ControlDA().selectAllDate();

            _tpControls = _controls.Where(c => c.ControlType == 1).ToList();
            _ztControls = _controls.Where(c => c.ControlType == 2).ToList();
            _ggControls = _controls.Where(c => c.ControlType == 3).ToList();

            t_Control pointControl = new t_Control()
            {
                ControlID = -1,
                ControlCaption = "指针",
                ControlName = "指针",
                ImageURL = "point.jpg"
            };

            _tpControls.Insert(0, pointControl);
            _ztControls.Insert(0, pointControl);
            _ggControls.Insert(0, pointControl);

            Application.Current.Dispatcher.BeginInvoke(new Action(() => {
                RaisePropertyChanged("TPControls");
                RaisePropertyChanged("ZTControls");
                RaisePropertyChanged("GGControls");
                IsLoaded = true;
            }));
        }
コード例 #3
0
ファイル: ControlDA.cs プロジェクト: Jitlee/WPFMonitor
        public List<t_Control> selectAllDate()
        {
            string sql = "select * from t_Control";

            DataTable dt = null;
            dt = db.ExecuteQuery(sql);
            List<t_Control> _List = new List<t_Control>();
            foreach (DataRow dr in dt.Rows)
            {
            t_Control obj = new t_Control(dr);
            _List.Add(obj);
            }
            return _List;
        }
コード例 #4
0
ファイル: ControlDA.cs プロジェクト: Jitlee/WPFMonitor
 /// <summary>
 /// 插入t_Control
 /// </summary>
 public virtual bool Insert(t_Control control)
 {
     string sql = "insert into t_Control (ControlID, ControlName, ControlType, ImageURL, ControlTypeName, ControlCaption) values (@ControlID, @ControlName, @ControlType, @ImageURL, @ControlTypeName, @ControlCaption)";
     SqlParameter [] parameters = new SqlParameter[]
     {
         new SqlParameter("@ControlID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "ControlID", DataRowVersion.Default, control.ControlID),
         new SqlParameter("@ControlName", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "ControlName", DataRowVersion.Default, control.ControlName),
         new SqlParameter("@ControlType", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "ControlType", DataRowVersion.Default, control.ControlType),
         new SqlParameter("@ImageURL", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "ImageURL", DataRowVersion.Default, control.ImageURL),
         new SqlParameter("@ControlTypeName", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "ControlTypeName", DataRowVersion.Default, control.ControlTypeName),
         new SqlParameter("@ControlCaption", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "ControlCaption", DataRowVersion.Default, control.ControlCaption)
     };
     return db.ExecuteNoQuery(sql, parameters) > -1;
 }
コード例 #5
0
ファイル: t_Control.cs プロジェクト: Jitlee/WPFMonitor
 public void Clone(t_Control obj)
 {
     //
     ControlID = obj.ControlID;
     //
     ControlName = obj.ControlName;
     //
     ControlType = obj.ControlType;
     //
     ImageURL = obj.ImageURL;
     //
     ControlTypeName = obj.ControlTypeName;
     //
     ControlCaption = obj.ControlCaption;
 }
コード例 #6
0
ファイル: Adorner.cs プロジェクト: Jitlee/WPFMonitor
 /// <summary>
 /// 加载ToolTip子元素
 /// </summary>
 /// <param name="result"></param>
 private void LoadToolTip(List<t_Element> elements)
 {
     if (elements.Count() > 0)
     {
         LoadToolTipProperty(elements);
     }
     else
     {
         //LoadScreen._DataContext.Load(LoadScreen._DataContext.GetT_ControlByTypeQuery(-1), LoadControlsByTypeCallback, null);
         _t_toolTipControl = new ControlDA().SelectBy(-1).FirstOrDefault();
         CreateToolTip(_t_toolTipControl);
     }
 }
コード例 #7
0
ファイル: Adorner.cs プロジェクト: Jitlee/WPFMonitor
 //private void LoadControlsByTypeCallback(LoadOperation<t_Control> result)
 //{
 //    if (!result.HasError)
 //    {
 //        _t_toolTipControl = result.Entities.FirstOrDefault();
 //        CreateToolTip(_t_toolTipControl);
 //    }
 //}
 private void CreateToolTip(t_Control t_control)
 {
     var target = _associatedElement as MonitorControl;
     if (null != target)
     {
         if (t_control != null)
         {
             target.IsToolTipLoaded = true;
             var toolTipControl = new ToolTipControl(target);
             toolTipControl.SetValue(Canvas.ZIndexProperty, 10000);
             var listElementProperties = new List<t_ElementProperty>();
             var toolTipControlElement = MonitorControl.OnInitControl(t_control);
             toolTipControlElement.Transparent = 100;
             toolTipControlElement.ControlID = -9999;
             toolTipControlElement.ElementType = "ToolTip";
             toolTipControlElement.ElementName = t_control.ControlName;
             toolTipControl.ScreenElement = toolTipControlElement;
             toolTipControlElement.Width = 300;
             toolTipControlElement.Height = 200;
             var elementProperties = new ControlPropertyDA().SelectByControlId(t_control.ControlID);
             foreach (t_ControlProperty property in elementProperties)
             {
                 t_ElementProperty tt = new t_ElementProperty();
                 tt.Caption = property.Caption;
                 tt.ElementID = toolTipControlElement.ElementID;
                 tt.PropertyNo = property.PropertyNo;
                 tt.PropertyValue = property.DefaultValue;
                 tt.PropertyName = property.PropertyName;
                 listElementProperties.Add(tt);
             }
             toolTipControl.ScreenElement = toolTipControlElement;
             toolTipControl.ListElementProp = listElementProperties;
             toolTipControl.ElementState = ElementSate.New;
             toolTipControl.SetPropertyValue();
             toolTipControl.SetCommonPropertyValue();
             _parent.Children.Add(toolTipControl);
             toolTipControl.DesignMode();
             toolTipControl.SetPosition();
             target.ToolTipControl = toolTipControl;
             if (null != CurrenttoolTipControl)
             {
                 CurrenttoolTipControl.IsOpen = false;
                 Adorner.RemoveMutiSelected(CurrenttoolTipControl.AdornerLayer);
             }
             CurrenttoolTipControl = toolTipControl;
             toolTipControl.IsOpen = true;
         }
     }
 }
コード例 #8
0
ファイル: MonitorControl.cs プロジェクト: Jitlee/WPFMonitor
 internal static t_Element OnInitControl(t_Control control)
 {
     return InitElement(control);
 }
コード例 #9
0
ファイル: LoadScreen.xaml.cs プロジェクト: Jitlee/WPFMonitor
 /// <summary>
 /// 初使化Element
 /// </summary>
 /// <param name="tCon"></param>
 /// <returns></returns>
 public t_Element InitElement(t_Control tCon)
 {
     t_Element mElem = new t_Element();
     mElem.ChildScreenID = "0";
     mElem.ControlID = tCon.ControlID;
     mElem.ElementName = tCon.ControlName;
     mElem.ImageURL = tCon.ImageURL;
     mElem.TxtInfo = "";
     mElem.ForeColor = "RGB(0,0,0)";
     mElem.Font = "宋体";
     mElem.DeviceID = -1;
     mElem.ChannelNo = -1;
     mElem.BackColor = "RGB(255,255,255)";
     mElem.Transparent = 100;
     mElem.oldX = 0;
     mElem.oldY = 0;
     mElem.Method = 0;
     mElem.MinFloat = 0;
     mElem.MaxFloat = 0;
     //mElem.SerialNum = "";
     //mElem.TotalLength = "";
     if (tCon.ImageURL == "MonitorSystem.Other.RealTimeT")
     {
         mElem.BackColor = "#FFEBE8D9";
         mElem.ForeColor = "#FFD5D5FF";
     }
     mElem.LevelNo = 1;
     mElem.ComputeStr = "";
     return mElem;
 }
コード例 #10
0
ファイル: LoadScreen.xaml.cs プロジェクト: Jitlee/WPFMonitor
        public MonitorControl CreateControl(Canvas canvas, t_Control t, double width, double height, double x, double y)
        {
            if (t != null && t.ControlID > 0)
            {
                t_Element mElement = InitElement(t);

                mElement.Width = (int)width;
                mElement.Height = (int)height;
                mElement.ScreenX = (int)x;
                mElement.ScreenY = (int)y;
                mElement.ScreenID = _CurrentScreen.ScreenID;

                IEnumerable<t_ControlProperty> listObj = this._controlsPeoperties.
                    Where(a => a.ControlID == t.ControlID);
                List<t_ElementProperty> listElementPro = new List<t_ElementProperty>();
                foreach (t_ControlProperty cp in listObj)
                {
                    t_ElementProperty tt = new t_ElementProperty();
                    tt.Caption = cp.Caption;
                    tt.ElementID = mElement.ElementID;
                    tt.PropertyNo = cp.PropertyNo;
                    tt.PropertyValue = cp.DefaultValue;
                    tt.PropertyName = cp.PropertyName;
                    listElementPro.Add(tt);
                }

                var monitorControl = ShowElement(canvas, mElement, ElementSate.New, listElementPro);
                monitorControl.DesignMode();
                return monitorControl;
            }
            return null;
        }
コード例 #11
0
ファイル: ControlDA.cs プロジェクト: Jitlee/WPFMonitor
 public t_Control selectARowDate(string m_id)
 {
     string sql = string.Format("select * from t_Control where  Controlid='{0}'",m_id);
       DataTable dt = null;
     try
      {
      dt = db.ExecuteQueryDataSet(sql).Tables[0];
     }
       catch (Exception ex)
     {
      throw ex;
       }
     if (dt == null)
      return null;
     if (dt.Rows.Count == 0)
     return null;
     DataRow dr = dt.Rows[0];
     t_Control m_Cont=new t_Control(dr);
      return m_Cont;
 }
コード例 #12
0
ファイル: ControlDA.cs プロジェクト: Jitlee/WPFMonitor
 /// <summary>
 /// 更新t_Control
 /// </summary>
 public virtual bool Update(t_Control control)
 {
     string sql = "update t_Control set  ControlName = @ControlName,  ControlType = @ControlType,  ImageURL = @ImageURL,  ControlTypeName = @ControlTypeName,  ControlCaption = @ControlCaption where  ControlID = @ControlID";
     SqlParameter [] parameters = new SqlParameter[]
     {
         new SqlParameter("@ControlID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "ControlID", DataRowVersion.Default, control.ControlID),
         new SqlParameter("@ControlName", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "ControlName", DataRowVersion.Default, control.ControlName),
         new SqlParameter("@ControlType", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "ControlType", DataRowVersion.Default, control.ControlType),
         new SqlParameter("@ImageURL", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "ImageURL", DataRowVersion.Default, control.ImageURL),
         new SqlParameter("@ControlTypeName", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "ControlTypeName", DataRowVersion.Default, control.ControlTypeName),
         new SqlParameter("@ControlCaption", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "ControlCaption", DataRowVersion.Default, control.ControlCaption)
     };
     return db.ExecuteNoQuery(sql, parameters) > -1;
 }