コード例 #1
0
        void openRunMode(string arg)
        {
            var doc = new ControlWindowDocument(_parentNode, _dataModel, true);

            fullScreenWindow         = new Window();
            fullScreenWindow.Content = doc;
            fullScreenWindow.Owner   = this.GetParentByName <Window>(null);
            fullScreenWindow.GoFullscreen();
            fullScreenWindow.Closed += (s, e) => {
                bool cancel = false;
                doc.OnClose(ref cancel);
            };
            fullScreenWindow.ShowDialog();
        }
コード例 #2
0
        /// <summary>
        /// 打开窗口,并且定位到引用了指定点名的组件上
        /// </summary>
        /// <param name="windowid"></param>
        /// <param name="pointName"></param>
        public void OpenWindow(int windowid, string pointName)
        {
            //查看已经打开的窗口
            foreach (Documents.DocTabItem item in documentContainer.Items)
            {
                if (item.Content is Documents.ControlWindowDocument)
                {
                    var doc = item.Content as Documents.ControlWindowDocument;
                    if (doc._dataModel.id == windowid)
                    {
                        MainWindow.Instance.documentContainer.SelectedItem = item;
                        doc.SelectWebControlByPointName(pointName);
                        return;
                    }
                }
            }

            var node = this.Nodes.FindWindowNode(windowid);

            if (node != null)
            {
                var doc = new Documents.ControlWindowDocument(node.Parent as ControlWindowContainerNode, node.DataModel, false);
                doc.SelectWebControlByPointName(pointName);
                MainWindow.Instance.SetActiveDocument(doc);
                return;
            }
            this.Cursor = Cursors.Wait;
            Helper.Remote.Invoke <SunRizServer.ControlWindow>("GetWindowInfo", (datamodel, err) => {
                this.Cursor = null;
                if (err != null)
                {
                    MessageBox.Show(this, err);
                }
                else
                {
                    var doc = new Documents.ControlWindowDocument(null, datamodel, false);
                    doc.SelectWebControlByPointName(pointName);
                    MainWindow.Instance.SetActiveDocument(doc);
                }
            }, windowid, null);
        }
コード例 #3
0
 /// <summary>
 /// 打开窗口
 /// </summary>
 /// <param name="windowCode">窗口编号</param>
 void open(string windowCode)
 {
     Helper.Remote.Invoke <ControlWindow>("GetWindowInfo", (win, err) => {
         if (err != null)
         {
             MessageBox.Show(this.GetParentByName <Window>(null), err);
         }
         else
         {
             ControlWindowDocument doc = new ControlWindowDocument(null, win, true);
             doc.Title      = win.Name;
             Window window  = new Window();
             window.Content = doc;
             if (win.windowWidth != null)
             {
                 window.Width = win.windowWidth.Value;
             }
             if (win.windowHeight != null)
             {
                 window.Height = win.windowHeight.Value;
             }
             if (win.windowWidth == null && win.windowHeight == null)
             {
                 window.WindowState = WindowState.Maximized;
             }
             else if (win.windowWidth != null && win.windowHeight != null)
             {
                 window.ResizeMode = ResizeMode.NoResize;
             }
             window.Closed += (s, e) => {
                 bool c = false;
                 doc.OnClose(ref c);
             };
             window.Show();
         }
     }, 0, windowCode);
 }