コード例 #1
0
ファイル: NewsManager.xaml.cs プロジェクト: jjg0519/OA
        private void BtnEdit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (dgNewsList.SelectedItem == null)
                {
                    MessageWindow.Show("", "请先选择一条新闻,再进行编辑!", MessageIcon.Error, MessageWindowType.Flow);

                    return;
                }

                NewsViewModel item = (NewsViewModel)dgNewsList.SelectedItem;
                viewModel.CurrentEntity          = item;
                viewModel.CurrentEntity.ParentVM = viewModel;
                NewsView addView = new NewsView(viewModel.CurrentEntity, ViewState.UPDATE);
                SMT.SAAS.Controls.Toolkit.Windows.Window host = ProgramManager.ShowProgram("修改新闻", "", UpdateFormID, addView, true, true, null);
                addView.Reset += (obj, arg) =>
                {
                    host.Close();
                };
                host.Closed += (obj, arg) =>
                {
                    //  viewModel.Refresh();
                };
            }
            catch (Exception ex)
            {
            }
        }
コード例 #2
0
ファイル: Window - 副本.cs プロジェクト: jjg0519/OA
        /// <summary>
        /// 显示窗口
        /// </summary>
        /// <typeparam name="TResult">窗口返回的结果的类型</typeparam>
        /// <param name="windowmodel">窗口模式,为<see cref="DialogMode"/></param>类型
        /// <param name="parent">窗口父容器</param>
        /// <param name="result">此参数未使用</param>
        /// <param name="close">此参数未使用</param>
        /// <param name="isResizable">窗口是否可拖拽大小</param>
        /// <param name="GUID">
        /// 窗口标识.
        /// 可根据此ID限制此窗口只能弹出一个
        /// </param>
        public void Show <TResult>(DialogMode windowmodel, FrameworkElement parent, TResult result, Action <TResult> close, bool isResizable, string GUID)
        {
            try
            {
                try
                {
                    double height = SMT.SAAS.Main.CurrentContext.AppContext.AppHost.SilverlightHostRoot.ActualHeight;
                    double width  = SMT.SAAS.Main.CurrentContext.AppContext.AppHost.SilverlightHostRoot.ActualWidth;
                    //MessageBox.Show("1高:" + (height - 50) + " 宽:" + (width - 50));
                    this.MinHeight = height - 50;
                    this.MinWidth  = width - 50;
                }
                catch (Exception ex)
                {
                }
                this._window = ProgramManager.ShowProgram(TitleContent.ToString(), string.Empty, GUID, this, isResizable, true, null);

                //MessageBox.Show("1高:" + this._window.MinHeight + " 宽:" + this._window.MinWidth);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                //MessageBox.Show("Down");
            }
        }
コード例 #3
0
ファイル: Window.cs プロジェクト: jjg0519/OA
        /// <summary>
        /// 显示窗口
        /// </summary>
        /// <typeparam name="TResult">窗口返回的结果的类型</typeparam>
        /// <param name="windowmodel">窗口模式,为<see cref="DialogMode"/></param>类型
        /// <param name="parent">窗口父容器</param>
        /// <param name="result">此参数未使用</param>
        /// <param name="close">此参数未使用</param>
        /// <param name="isResizable">窗口是否可拖拽大小</param>
        /// <param name="GUID">
        /// 窗口标识.
        /// 可根据此ID限制此窗口只能弹出一个
        /// </param>
        public void Show <TResult>(DialogMode windowmodel, FrameworkElement parent, TResult result, Action <TResult> close, bool isResizable, string GUID)
        {
            try
            {
                double height = 0;
                double width  = 0;
                try
                {
                    height = SMT.SAAS.Main.CurrentContext.AppContext.AppHost.SilverlightHostRoot.ActualHeight;
                    width  = SMT.SAAS.Main.CurrentContext.AppContext.AppHost.SilverlightHostRoot.ActualWidth;
                    //MessageBox.Show("1高:" + (height - 50) + " 宽:" + (width - 50));
                }
                catch (Exception ex)
                {
                }
                //string msg = "弹出窗内部Form指定高度:" + this.Height + "类型" + this.Height.GetType().Name + " 宽度:" + this.Width + "类型:" + this.Height.GetType().Name
                //    + "弹出窗内部Form指定最小高度:" + this.MinHeight + "类型" + this.MinHeight.GetType().Name + " 最小宽度:" + this.MinWidth + "类型" + this.MinWidth.GetType().Name
                //    + " 当前silverlight显示区高度:" + height + " 宽度:" + width;
                //SMT.SAAS.Main.CurrentContext.AppContext.SystemMessage(msg);
                //SMT.SAAS.Main.CurrentContext.AppContext.ShowSystemMessageText();
                if (height > 0)
                {
                    if (this.MinHeight > height)
                    {
                        this.MinHeight = height - 50;
                    }
                    if (this.Height > height)
                    {
                        this.MinHeight = height - 50;
                    }
                }
                if (width > 0)
                {
                    if (this.MinWidth > width)
                    {
                        this.MinWidth = width - 50;
                    }
                    if (this.Width > width)
                    {
                        this.MinWidth = width - 50;
                    }
                }

                this._window = ProgramManager.ShowProgram(TitleContent.ToString(), string.Empty, GUID, this, isResizable, true, null);

                //MessageBox.Show("1高:" + this._window.MinHeight + " 宽:" + this._window.MinWidth);
            }
            catch (Exception ex)
            {
                SMT.SAAS.Main.CurrentContext.AppContext.SystemMessage(ex.ToString());
                SMT.SAAS.Main.CurrentContext.AppContext.ShowSystemMessageText();
            }
            finally
            {
                //MessageBox.Show("Down");
            }
        }
コード例 #4
0
ファイル: NewsManager.xaml.cs プロジェクト: jjg0519/OA
        private void BtnAdd_Click(object sender, RoutedEventArgs e)
        {
            NewsViewModel wm = new NewsViewModel()
            {
                NEWSID = Guid.NewGuid().ToString(), ParentVM = viewModel
            };
            NewsView addView = new NewsView(wm, ViewState.ADD);

            SMT.SAAS.Controls.Toolkit.Windows.Window host = ProgramManager.ShowProgram("新建新闻", "", AddFormID, addView, true, true, null);
            addView.Reset += (obj, arg) =>
            {
                host.Close();
            };
            host.Closed += (obj, arg) =>
            {
                // viewModel.Refresh();
            };
        }
コード例 #5
0
        /// <summary>
        /// 打开一个窗口
        /// </summary>
        /// <typeparam name="TResult">窗口返回的类型</typeparam>
        /// </summary>
        /// <param name="dialogMode">窗口模式.为<see cref="DialogMode"/>类型</param>
        /// <param name="container">缺省,此参数已过期</param>
        /// <param name="caption">标题</param>
        /// <param name="content">内容</param>
        /// <param name="icon">图标类型.为<see cref="MessageIcon"/>类型</param>
        /// <param name="result">点击按钮执行的Action</param>
        /// <param name="defaultResult">默认结果</param>
        /// <param name="buttons">要显示的按钮.一般使用String集合</param>
        public static void Show <TResult>(DialogMode dialogMode, FrameworkElement container, string caption, object content, MessageIcon icon, Action <TResult> result, TResult defaultResult, AutoDisappear autoDisappear, params TResult[] buttons)
        {
            SMT.SAAS.Controls.Toolkit.Windows.Window window = null;
            _DialogMode = dialogMode;

            #region 根据选项判断弹出框大小
            Size size = new Size(300, 150);
            switch (icon)
            {
            case MessageIcon.None:
                size = new Size(300, 150);
                break;

            case MessageIcon.Information:
                size = new Size(300, 150);
                break;

            case MessageIcon.Exclamation:
                size = new Size(300, 150);
                break;

            case MessageIcon.Question:
                size = new Size(300, 150);
                break;

            case MessageIcon.Error:
                size = new Size(480, 210);
                break;

            default:
                break;
            }
            #endregion

            #region MessageContent
            var grid = new Grid();
            grid.Margin = new Thickness(4);
            grid.Width  = size.Width - 40;
            grid.Height = size.Height - 60;

            grid.Background = new SolidColorBrush(Colors.Transparent);

            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = GridLength.Auto
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition());

            grid.RowDefinitions.Add(new RowDefinition());
            grid.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            string IocPath = string.Format("/SMT.SaaS.Window;Component/Resources/{0}.png", icon.ToString());
            if (icon != MessageIcon.None)
            {
                Rectangle  rect  = new Rectangle();
                ImageBrush imgbr = new ImageBrush();
                imgbr.ImageSource        = new BitmapImage(new Uri(IocPath, UriKind.RelativeOrAbsolute));
                imgbr.Stretch            = Stretch.Fill;
                rect.Fill                = imgbr;
                rect.Height              = 48; rect.Width = 48;
                rect.HorizontalAlignment = HorizontalAlignment.Center;
                rect.VerticalAlignment   = VerticalAlignment.Top;

                Grid.SetColumn(rect, 0);
                Grid.SetRow(rect, 0);
                // grid.Children.Add(rect);
            }
            #endregion

            # region Buttons
コード例 #6
0
ファイル: Window - 副本.cs プロジェクト: jjg0519/OA
 /// <summary>
 /// 显示窗口
 /// 兼容MVC 平台弹出窗口
 /// Author:傅意成
 /// Date:2012-07-12
 /// </summary>
 public void ShowMvcPlat <TResult>(DialogMode windowmodel, FrameworkElement parent, TResult result, Action <TResult> close)
 {
     this._window = ProgramManager.ShowMvcProgram(TitleContent.ToString(), string.Empty, Guid.NewGuid().ToString(), this, false, true, null);
 }
コード例 #7
0
ファイル: Window - 副本.cs プロジェクト: jjg0519/OA
 public void Show <TResult>(DialogMode windowmodel, FrameworkElement parent, TResult result, Action <TResult> close, bool isResizable, bool isSysApp, string GUID)
 {
     this._window = ProgramManager.ShowProgram(TitleContent.ToString(), string.Empty, GUID, this, isResizable, isSysApp, null);
 }
コード例 #8
0
ファイル: Window - 副本.cs プロジェクト: jjg0519/OA
 /// <summary>
 /// 显示窗口
 /// </summary>
 /// <param name="GUID">
 /// 窗口标识.
 /// 可根据此ID限制此窗口只能弹出一个
 /// </param>
 public void Show(string GUID)
 {
     this._window = ProgramManager.ShowProgram(TitleContent.ToString(), string.Empty, GUID, this, true, false, null);
 }
コード例 #9
0
ファイル: Window - 副本.cs プロジェクト: jjg0519/OA
 /// <summary>
 /// 显示窗口
 /// </summary>
 public void Show()
 {
     this._window = ProgramManager.ShowProgram(TitleContent.ToString(), string.Empty, Guid.NewGuid().ToString(), this, true, false, null);
 }
コード例 #10
0
ファイル: WindowsManager.cs プロジェクト: jjg0519/OA
 private static void window_Dragged(object sender, EventArgs e)
 {
     Window window = (Window)sender;
 }
コード例 #11
0
ファイル: WindowsManager.cs プロジェクト: jjg0519/OA
 public static void ShowWindow(Window window, Point location, bool isResizable, bool isSysApp)
 {
     ShowWindow(window, location, false, false, Guid.NewGuid().ToString());
 }
コード例 #12
0
ファイル: WindowsManager.cs プロジェクト: jjg0519/OA
 public static void ShowWindow(Window window, Point location)
 {
     ShowWindow(window, location, false, false);
 }
コード例 #13
0
ファイル: WindowsManager.cs プロジェクト: jjg0519/OA
        public static void ArrangeActiveWindow(bool showIFrame)
        {
            Window activeWindow = null;

            activeWindow = GetActiveWindow(activeWindow);
        }