Esempio n. 1
0
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            if (cbScreenList.SelectedItem == null)
            {
                MessageBox.Show("请选择场景!");
                return;
            }
            _Screen = (t_Screen)cbScreenList.SelectedItem;

            _IsOK = true;
            this.Close();
        }
Esempio n. 2
0
 /// <summary>
 /// 插入t_Screen
 /// </summary>
 public virtual bool Insert(t_Screen screen)
 {
     string sql = @"insert into t_Screen (ScreenName, ImageURL, ParentScreenID, StationID, Flag, Width, Height, BackColor, AutoSize)
     values ( @ScreenName, @ImageURL, @ParentScreenID, @StationID, @Flag, @Width, @Height, @BackColor, @AutoSize)";
     SqlParameter[] parameters = new SqlParameter[]
     {
         //new SqlParameter("@ScreenID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "ScreenID", DataRowVersion.Default, screen.ScreenID),
         new SqlParameter("@ScreenName", SqlDbType.VarChar, 64, ParameterDirection.Input, false, 0, 0, "ScreenName", DataRowVersion.Default, screen.ScreenName),
         new SqlParameter("@ImageURL", SqlDbType.VarChar, 256, ParameterDirection.Input, false, 0, 0, "ImageURL", DataRowVersion.Default, screen.ImageURL),
         new SqlParameter("@ParentScreenID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "ParentScreenID", DataRowVersion.Default, screen.ParentScreenID),
         new SqlParameter("@StationID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "StationID", DataRowVersion.Default, screen.StationID),
         new SqlParameter("@Flag", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "Flag", DataRowVersion.Default, screen.Flag),
         new SqlParameter("@Width", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "Width", DataRowVersion.Default, screen.Width),
         new SqlParameter("@Height", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "Height", DataRowVersion.Default, screen.Height),
         new SqlParameter("@BackColor", SqlDbType.VarChar, 40, ParameterDirection.Input, false, 0, 0, "BackColor", DataRowVersion.Default, screen.BackColor),
         new SqlParameter("@AutoSize", SqlDbType.Bit, 1, ParameterDirection.Input, false, 0, 0, "AutoSize", DataRowVersion.Default, screen.AutoSize)
     };
     return db.ExecuteNoQuery(sql, parameters) > -1;
 }
Esempio n. 3
0
 //ScreenEdit _mw)
 public ScreenViewModel(t_Screen _mScreen, OpType mType, ScreenEdit mWindow)
 {
     OperationType = mType;
     if (mType == OpType.Add)
     {
         _ParentScreen = _mScreen;
         ScreenObj = new t_Screen();
         _ScreenObj = new t_Screen();
     }
     else
     {
         ScreenObj = new t_Screen();
         ScreenObj.Clone(_mScreen);
         _ScreenObj = _mScreen;
     }
     _Window = mWindow;
     //UpdatetxtSource(_Window.gridContent);
     Init();
 }
Esempio n. 4
0
        public void ScreenInit(t_Screen obj)
        {
            this.Children.Clear();
            RectangleGeometry r = new RectangleGeometry();
            Rect rect = new Rect();
            if (obj.Width != null && obj.Height != null)
            {
                this.Width = this.Width = rect.Width = obj.Width;
                this.Height = this.Height = rect.Height = obj.Height;
            }
            else
            {
                this.Width = this.Width = rect.Width = 1024;
                this.Height = this.Height = rect.Height = 768;
            }
            r.Rect = rect;
            this.Clip = r;

            SetScreenImg(obj.ImageURL);
        }
Esempio n. 5
0
        public void ScreenInit(t_Screen obj)
        {
            _screen = obj;
            csScreen.Children.Clear();
            //RectangleGeometry r = new RectangleGeometry();
            //Rect rect = new Rect();
            csScreen.Width = obj.Width > 100 ? obj.Width : 1920;
            csScreen.Height = obj.Height > 100 ? obj.Height : 1024;
            //r.Rect = rect;
            //this.Clip = r;

            double sfPerw = 200 / csScreen.Width;
            double sfPerh = 150 / csScreen.Height;
            if (sfPerh < sfPerw)
                sfPerw = sfPerh;
            ScaleTransform mainShowCanvasScaleTrans = new ScaleTransform();
            mainShowCanvasScaleTrans.CenterX = 0.0;
            mainShowCanvasScaleTrans.CenterY = 0.0;
            mainShowCanvasScaleTrans.ScaleX = sfPerw;
            mainShowCanvasScaleTrans.ScaleY = sfPerw;
            csScreen.RenderTransform = mainShowCanvasScaleTrans;

            SetScreenImg(obj.ImageURL);
        }
Esempio n. 6
0
        /// <summary>
        /// 属性窗口,打开场景事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        protected void prop_ChangeScreen(object sender, EventArgs args)
        {
            ScreenArgs mobj = (ScreenArgs)args;
            _CurrentScreen = mobj.Screen;

            if (_CurrentScreen != null)
            {
                if (MessageBox.Show("确定当前改动吗?", "提示", MessageBoxButton.OKCancel)
                    == MessageBoxResult.OK)
                {
                    IsShowSaveToot = false;
                    SaveElement();
                }
                else
                {
                    ISBack = false;
                    LoadScreenData(_CurrentScreen);
                }
            }
        }
Esempio n. 7
0
        //ScreenView _ScreenView = new ScreenView();
        /// <summary>
        /// 加载场景
        /// </summary>
        /// <param name="_Screen"></param>
        private void LoadScreenData(t_Screen _Screen)
        {
            mStartTime = DateTime.Now;

            tbWait.IsBusy = true;
            //每次在数据库中去查询次
            var v = listScreen.Where(a => a.ScreenID == _Screen.ScreenID);
            ShowLoadTimeLen("0");
            if (v.Count() > 0)
            {
                _Screen = v.First();
            }
            else
            {
                MessageBox.Show("场景不存在!", "温馨提示", MessageBoxButton.OK);
                return;
            }

            if (ReturnScreen != null)
            {
                if (_Screen.ScreenID != ReturnScreen.ScreenID)
                {
                    if (!ISBack)
                    {
                        LoadScreenList.Push(ReturnScreen);
                    }
                    ReturnScreen = _Screen;
                }
            }
            else
            {
                ReturnScreen = _Screen;
            }

            _ScreenView.ScreenInit(_Screen);
            ShowLoadTimeLen("1");

            var lst = new List<MonitorControl>();
            foreach (var mc in csScreen.Children.OfType<MonitorControl>())
            {
                lst.Add(mc);
            }
            for (int i = 0; i < lst.Count; i++)
            {
                lst[i].DesignMode();
            }

            ScreenAllElement.Clear();
            csScreen.Children.Clear();
            lblShowMsg.Text = _Screen.ScreenName;

            // BackgroundPanel.BgImagePath = _Screen.ImageURL;

            //AddElementCanvas.Width = csScreen.Width = 1000;
            //AddElementCanvas.Height = csScreen.Height =600;

            //设置当前
            _CurrentScreen = _Screen;

            SetScreenImg(_Screen.ImageURL);

            ShowLoadTimeLen("2");

            AddElementCanvas.Width = csScreen.Width = _Screen.Width > 100d ? _Screen.Width : 1920;
            AddElementCanvas.Height = csScreen.Height =  _Screen.Height > 100d ? _Screen.Height : 1024;
            UpdateThumbnail();

            ShowLoadTimeLen("3");
            //_DataContext.Load(_DataContext.GetT_Element_RealTimeLineQuery().Where(a => a.ScreenID == _Screen.ScreenID)
            //    , LoadElementRealtimeLineCompleted, null);
            ////加载元素
            //_DataContext.Load(_DataContext.GetT_ElementsByScreenIDQuery(_Screen.ScreenID),
            //    LoadElementCompleted, _Screen.ScreenID);

            Task.Factory.StartNew(LoadElementPropertiesCompleted, _Screen.ScreenID);
            //加载元素
            //Task.Factory.StartNew(LoadElementCompleted, _Screen.ScreenID);

            _sacleIndex = 5;
            CanvasScaleTransform.ScaleX = 1d;
            CanvasScaleTransform.ScaleY = 1d;
            CanvasTranslateTransform.X = 0d;
            CanvasTranslateTransform.Y = 0d;
            AutoSize = _Screen.AutoSize;
        }
Esempio n. 8
0
 public ScreenEdit(t_Screen _mScreen,OpType mType)
 {
     InitializeComponent();
     this.DataContext = new ScreenViewModel(_mScreen, mType,this);
 }
Esempio n. 9
0
 public static void Load(t_Screen screen)
 {
     if (screen == null)
         return;
     ISBack = false;
     _instance.LoadScreenData(screen);
 }
Esempio n. 10
0
 void trList_ContextMenuOpening(object sender, ContextMenuEventArgs e)
 {
     _select = (e.OriginalSource as FrameworkElement).DataContext as t_Screen;
     if (null != _select)
     {
         t_Screen _TreeSelect = trList.SelectedItem as t_Screen;
         if (_TreeSelect != null)
         {
             if (_TreeSelect.ScreenID != _select.ScreenID)//选择与右键不一致
             {
                 e.Handled = true;
                 return;
             }
         }
         MenuStatus(true);
     }
     else
     {
         MenuStatus(false);
     }
 }
Esempio n. 11
0
 ///// <summary>
 ///// Screen构造函数
 ///// </summary>
 //public t_Screen(DataRow row)
 //{
 //    //
 //    _ScreenID = Convert.ToInt32(row["ScreenID"]);
 //    //
 //    _ScreenName = row["ScreenName"].ToString().Trim();
 //    //
 //    _ImageURL = row["ImageURL"].ToString().Trim();
 //    //
 //    _ParentScreenID = Convert.ToInt32(row["ParentScreenID"]);
 //    //
 //    _StationID = Convert.ToInt32(row["StationID"]);
 //    //
 //    _Flag = Convert.ToInt32(row["Flag"]);
 //    //
 //    _Width = Convert.ToInt32(row["Width"]);
 //    //
 //    _Height = Convert.ToInt32(row["Height"]);
 //    //
 //    _BackColor = row["BackColor"].ToString().Trim();
 //    //
 //    _AutoSize = Convert.ToBoolean(row["AutoSize"]);
 //}
 public void Clone(t_Screen obj)
 {
     //
     ScreenID = obj.ScreenID;
     //
     ScreenName = obj.ScreenName;
     //
     ImageURL = obj.ImageURL;
     //
     ParentScreenID = obj.ParentScreenID;
     //
     StationID = obj.StationID;
     //
     Flag = obj.Flag;
     //
     Width = obj.Width;
     //
     Height = obj.Height;
     //
     BackColor = obj.BackColor;
     //
     AutoSize = obj.AutoSize;
 }
Esempio n. 12
0
        /// <summary>
        /// 更新t_Screen
        /// </summary>
        public virtual bool Update(t_Screen screen)
        {
            string sql = "update t_Screen set  ScreenName = @ScreenName,  ImageURL = @ImageURL,    StationID = @StationID,  Flag = @Flag,  Width = @Width,  Height = @Height,  BackColor = @BackColor,  AutoSize = @AutoSize where  ScreenID = @ScreenID";
            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@ScreenID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "ScreenID", DataRowVersion.Default, screen.ScreenID),
                new SqlParameter("@ScreenName", SqlDbType.VarChar, 64, ParameterDirection.Input, false, 0, 0, "ScreenName", DataRowVersion.Default, screen.ScreenName),
                new SqlParameter("@ImageURL", SqlDbType.VarChar, 256, ParameterDirection.Input, false, 0, 0, "ImageURL", DataRowVersion.Default, screen.ImageURL),

                new SqlParameter("@StationID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "StationID", DataRowVersion.Default, screen.StationID),
                new SqlParameter("@Flag", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "Flag", DataRowVersion.Default, screen.Flag),
                new SqlParameter("@Width", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "Width", DataRowVersion.Default, screen.Width),
                new SqlParameter("@Height", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "Height", DataRowVersion.Default, screen.Height),
                new SqlParameter("@BackColor", SqlDbType.VarChar, 40, ParameterDirection.Input, false, 0, 0, "BackColor", DataRowVersion.Default, screen.BackColor),
                new SqlParameter("@AutoSize", SqlDbType.Bit, 1, ParameterDirection.Input, false, 0, 0, "AutoSize", DataRowVersion.Default, screen.AutoSize)
            };
            return db.ExecuteNoQuery(sql, parameters) > -1;
        }
Esempio n. 13
0
 public MenuItem InitMenuScriptItem(t_Screen screen)
 {
     var menuItem = new MenuItem();
     menuItem.Header = screen.ScreenName;
     var children = listScreen.Where(s => s.ParentScreenID == screen.ScreenID);
     if (children.Count() > 0)
     {
         foreach (var s in children)
         {
             menuItem.Items.Add(InitMenuScriptItem(s));
         }
     }
     menuItem.Command = _SenceCommand;
     menuItem.CommandParameter = screen;
     return menuItem;
 }
Esempio n. 14
0
 private void ShowName(t_Screen screen)
 {
     base.OnLoadScreen(this, screen);
 }
Esempio n. 15
0
        public void SetScreenImg(t_Screen screen)
        {
            if (_CurrentScreen == null || screen == null)
                return;
            if (_CurrentScreen.ScreenID != screen.ScreenID)
                return;

            SetScreenImg(screen.ImageURL);
        }
Esempio n. 16
0
 /// <summary>
 /// 从listScreen中选择默认场景 
 /// </summary>
 public bool SetDefultScreen()
 {
     if (listScreen == null)
         return false;
     if (listScreen.Count() == 0)
     {
         _CurrentScreen = null;
         return false;
     }
     if (SystemParam == null)
     {
         MessageBox.Show("加载系统参数出错,无法显示!", "温馨提示:", MessageBoxButton.OK);
         return false;
     }
     var v = listScreen.Where(a => a.ScreenID == SystemParam.StartScreenID);
     if (v.Count() == 0)
     {
         _CurrentScreen = listScreen.First();
         return false;
     }
     _CurrentScreen = v.First();
     MainPage = _CurrentScreen;
     return true;
 }
Esempio n. 17
0
 public void LoadSence(t_Screen screen)
 {
     ISBack = false;
     LoadScreenData(screen);
 }
Esempio n. 18
0
 public void UpdateScreen(t_Screen obj)
 {
     string strSQL = "update t_Screen set Width=@Width,Height=@Height,AutoSize=@AutoSize,ImageURL=@ImageURL where ScreenID=@ScreenID";
     SqlParameter[] parameters = new SqlParameter[]
                                             {
                                                     new SqlParameter("@ScreenID", obj.ScreenID),
                                                     new SqlParameter("@Width", obj.Width),
                                                     new SqlParameter("@Height", obj.Height),
                                                     new SqlParameter("@AutoSize", obj.AutoSize),
                                                     new SqlParameter("@ImageURL", obj.ImageURL)
                                             };
     CmdList.Add(new CommandList() { strCommandText = strSQL, Params = parameters });
 }
Esempio n. 19
0
 protected void OnLoadScreen(object sender, t_Screen screen)
 {
     if (null != LoadScreen)
     {
         LoadScreen(screen);
     }
 }
Esempio n. 20
0
 public LoadScreenEventArgs(t_Screen screen)
 {
     this.Screen = screen;
 }
Esempio n. 21
0
 private void ShowName(t_Screen screen)
 {
     //LoadScreen.Load(screen);
     OnLoadScreen(this, screen);
 }