private void OKButton_Click(object sender, RoutedEventArgs e) { if (cbScreenList.SelectedItem == null) { MessageBox.Show("请选择场景!"); return; } _Screen = (t_Screen)cbScreenList.SelectedItem; _IsOK = true; this.DialogResult = true; }
public ScreenEdit(t_Screen t_Scr, OpType moptype) { InitializeComponent(); Scree = t_Scr; if (moptype == OpType.Alert) { txtName.Text = t_Scr.ScreenName; txtImage.Text = t_Scr.ImageURL; } optype = moptype; BindSite(); }
public void ScreenInit(t_Screen obj) { csScreen.Children.Clear(); RectangleGeometry r = new RectangleGeometry(); Rect rect = new Rect(); if (obj.Width != null && obj.Height != null) { csScreen.Width= this.Width = rect.Width = obj.Width.Value; csScreen.Height= this.Height = rect.Height = obj.Height.Value; } else { csScreen.Width = this.Width = rect.Width = 1024; csScreen.Height = this.Height = rect.Height = 768; } r.Rect = rect; this.Clip = r; SetScreenImg(obj.ImageURL); }
/// <summary> /// 从listScreen中选择默认场景 /// </summary> public void SetDefultScreen() { if (listScreen == null) return; if (listScreen.Count() == 0) { _CurrentScreen = null; return; } if (SystemParam == null) { MessageBox.Show("加载系统参数出错,无法显示!", "温馨提示:", MessageBoxButton.OK); return; } var v = listScreen.Where(a => a.ScreenID == SystemParam.StartScreenID); if (v.Count() == 0) { _CurrentScreen = listScreen.First(); return; } _CurrentScreen = v.First(); MainPage = _CurrentScreen; }
public MenuScriptItem InitMenuScriptItem(t_Screen screen) { var menuItem = new MenuScriptItem(); 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; }
public static void Load(t_Screen screen) { if (screen == null) return; ISBack = false; _instance.LoadScreenData(screen); }
private void LoadSence(t_Screen screen) { ISBack = false; LoadScreenData(screen); }
//ScreenView _ScreenView = new ScreenView(); /// <summary> /// 加载场景 /// </summary> /// <param name="_Screen"></param> private void LoadScreenData(t_Screen _Screen) { //每次在数据库中去查询次 var v = LoadScreen._DataContext.t_Screens.Where(a => a.ScreenID == _Screen.ScreenID); 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); double sfPerw =200/ _ScreenView.Width; double sfPerh = 150 / _ScreenView.Height; if (sfPerh < sfPerw) sfPerw = sfPerh; ScaleTransform mainShowCanvasScaleTrans = new ScaleTransform(); mainShowCanvasScaleTrans.CenterX = 0.0; mainShowCanvasScaleTrans.CenterY = 0.0; mainShowCanvasScaleTrans.ScaleX = sfPerw; mainShowCanvasScaleTrans.ScaleY = sfPerw; _ScreenView.RenderTransform = mainShowCanvasScaleTrans; tbWait.IsBusy = true; csScreen.Children.OfType<MonitorControl>().ToList().ForEach(mc => mc.UnDesignMode()); ScreenAllElement.Clear(); csScreen.Children.Clear(); lblShowMsg.Content = _Screen.ScreenName; //设置当前 _CurrentScreen = _Screen; //AutoSize = _Screen.AutoSize.HasValue ? _Screen.AutoSize.Value : false; SetScreenImg(_Screen.ImageURL); AddElementCanvas.Width = csScreen.Width = (_Screen.Width.HasValue && _Screen.Width > 100d) ? _Screen.Width.Value : 1920; AddElementCanvas.Height = csScreen.Height = (_Screen.Height.HasValue && _Screen.Height > 100d) ? _Screen.Height.Value : 1024; UpdateThumbnail(); _DataContext.Load(_DataContext.GetT_Element_RealTimeLineQuery().Where(a => a.ScreenID == _Screen.ScreenID) , LoadElementRealtimeLineCompleted, null); //加载元素 _DataContext.Load(_DataContext.GetT_ElementsByScreenIDQuery(_Screen.ScreenID), LoadElementCompleted, _Screen.ScreenID); _sacleIndex = 5; CanvasScaleTransform.ScaleX = 1d; CanvasScaleTransform.ScaleY = 1d; CanvasTranslateTransform.X = 0d; CanvasTranslateTransform.Y = 0d; AutoSize = _Screen.AutoSize.HasValue ? _Screen.AutoSize.Value : false; }
private void ShowName(t_Screen screen) { LoadScreen.Load(screen); }
private void OKButton_Click(object sender, RoutedEventArgs e) { if (cbScreen.SelectedItem == null) { MessageBox.Show("请选择站点!","温馨提示",MessageBoxButton.OK); return; } if (txtImage.Text.Trim() == "") { MessageBox.Show("请选择场景背影图片!", "温馨提示", MessageBoxButton.OK); return; } if (optype == OpType.Add) { t_Screen mobj = new t_Screen(); mobj.ScreenName = txtName.Text; mobj.ImageURL = txtImage.Text; mobj.StationID = int.Parse(((ComboBoxItem)cbScreen.SelectedItem).Tag.ToString()); mobj.ParentScreenID = Scree.ScreenID; mobj.Width = (int)ImgWidth; mobj.Height = (int)ImgHeight; mobj.AutoSize = false; _DataContext.t_Screens.Add(mobj); _DataContext.SubmitChanges(SubmitCompleted, mobj); } else { _DataContext.Load(_DataContext.GetT_ScreenQuery().Where(a=>a.ScreenID ==Scree.ScreenID), LoadScreenComplete, null); } // this.DialogResult = true; }
private void BoindTree() { List<t_Screen> listRoot = listScreen.Where(a => a.ParentScreenID == 0).ToList(); t_Screen tsroot = new t_Screen(); tsroot.ScreenID = 0; tsroot.ScreenName = "所有场景"; TreeViewItem RootItem = CreateTreeItem(tsroot); tvScreen.Items.Add(RootItem); foreach (t_Screen obj in listRoot) { TreeViewItem tvi = CreateTreeItem(obj); bindChild(tvi, obj); RootItem.Items.Add(tvi); } }
/// <summary> /// 加载子集 /// </summary> /// <param name="root"></param> /// <param name="m_obj"></param> private void bindChild(TreeViewItem root, t_Screen m_obj) { List<t_Screen> listRoot = listScreen.Where(a => a.ParentScreenID == m_obj.ScreenID).ToList(); foreach (t_Screen obj in listRoot) { TreeViewItem tvi = CreateTreeItem(obj); bindChild(tvi, obj); root.Items.Add(tvi); } }
/// <summary> /// 用于向 t_Screen EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet<T> 属性的 .Add 方法。 /// </summary> public void AddTot_Screen(t_Screen t_Screen) { base.AddObject("t_Screen", t_Screen); }
/// <summary> /// 创建新的 t_Screen 对象。 /// </summary> /// <param name="screenID">ScreenID 属性的初始值。</param> public static t_Screen Createt_Screen(global::System.Int32 screenID) { t_Screen t_Screen = new t_Screen(); t_Screen.ScreenID = screenID; return t_Screen; }
public void SetScreenImg(t_Screen screen) { if (_CurrentScreen == null || screen == null) return; if (_CurrentScreen.ScreenID != screen.ScreenID) return; SetScreenImg(screen.ImageURL); }
/// <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); } } }
private TreeViewItem CreateTreeItem(t_Screen m_obj) { TreeViewItem tvi = new TreeViewItem(); tvi.Header = m_obj.ScreenName; tvi.MouseRightButtonDown += new MouseButtonEventHandler(tvi_MouseRightButtonDown); tvi.Tag = m_obj; return tvi; }