Ejemplo n.º 1
0
 private void OnWindowMessage(DialogMessage dialogMessage)
 {
     Telerik.Windows.Controls.RadWindow win = CreateWindow(dialogMessage);
     if (win != null)
     {
         win.Show();
     }
 }
Ejemplo n.º 2
0
        private static ICommand GetCommand()
        {
            return(new ILight.Core.Model.CommandBase((p) =>
            {
                CmdWin win;
                int width = 600;
                int height = 400;
                if (p is CmdWin)
                {
                    win = p as CmdWin;
                }
                else
                {
                    win = Newtonsoft.Json.JsonConvert.DeserializeObject <CmdWin>((string)p);
                }
                #region 最近访问
                //if (Recent.item_list.Contains(dll))
                //{
                //    Recent.item_list.RemoveAt(Recent.item_list.IndexOf(dll));
                //}
                //if (Recent.item_list.Count == _recentMax)
                //{
                //    Recent.item_list.RemoveAt(Recent.item_list.Count - 1);
                //}
                //Recent.item_list.Insert(0, dll);
                #endregion
                Action <object> action = (frm) =>
                {
                    if (win.Win == IHome.Models.CmdWin.WinType.tab)
                    {
                        foreach (ILight.Controls.RadControls.RadTabItemCloseable item in ((Telerik.Windows.Controls.RadTabControl)((System.Windows.FrameworkElement)System.Windows.Application.Current.RootVisual).FindName("MainTab")).Items)
                        {
                            if (item.Content.GetType().FullName == win.type_name)
                            {
                                item.IsSelected = true;
                                return;
                            }
                        }

                        ILight.Controls.RadControls.RadTabItemCloseable tab = new ILight.Controls.RadControls.RadTabItemCloseable()
                        {
                            Header = win.name, Content = frm, IsSelected = true
                        };
                        ((Telerik.Windows.Controls.RadTabControl)((System.Windows.FrameworkElement)System.Windows.Application.Current.RootVisual).FindName("MainTab")).Items.Add(tab);
                    }
                    else if (win.Win == IHome.Models.CmdWin.WinType.window)
                    {
                        Telerik.Windows.Controls.RadWindow child = new Telerik.Windows.Controls.RadWindow()
                        {
                            Header = win.name, Content = frm
                        };
                        child.WindowStartupLocation = Telerik.Windows.Controls.WindowStartupLocation.CenterScreen;
                        child.Show();
                    }
                    else if (win.Win == IHome.Models.CmdWin.WinType.modal)
                    {
                        Telerik.Windows.Controls.RadWindow child = new Telerik.Windows.Controls.RadWindow()
                        {
                            Header = win.name, Content = frm
                        };
                        child.WindowStartupLocation = Telerik.Windows.Controls.WindowStartupLocation.CenterScreen;
                        child.ShowDialog();
                    }
                };
                if (win.VeiwModel != null)
                {
                    ILight.Core.Reflection.AssemblyProvider.GetInstanceAsync(win.type_name, win.xap_name, win.version, action, win.VeiwModel);
                }
                else
                {
                    ILight.Core.Reflection.AssemblyProvider.GetInstanceAsync(win.type_name, win.xap_name, win.version, action);
                }
            }));
        }