Пример #1
0
        public static void goMessagePage(string title, string msg, string backUrl, MessageIcon icon)
        {
            title   = HttpUtility.UrlEncode(title);
            msg     = HttpUtility.UrlEncode(HttpUtility.HtmlEncode(msg));
            backUrl = HttpUtility.UrlEncode(HttpUtility.HtmlEncode(backUrl));
            string iconStr = icon == MessageIcon.Non ? "" : icon.ToString();

            HttpContext.Current.Response.Redirect(string.Format("/WebManage/tips.aspx?result={0}&msg={1}&title={2}&url={3}", iconStr, msg, title, backUrl));
        }
Пример #2
0
        public MessageResult Message(string msg, string caption, MessageIcon msgIcon, MessageButton msgBtn)
        {
            var result = MessageBox.Show(
                msg,
                caption,
                (MessageBoxButtons)Enum.Parse(typeof(MessageBoxButtons), msgBtn.ToString()),
                (MessageBoxIcon)Enum.Parse(typeof(MessageBoxIcon), msgIcon.ToString())
                );

            return((MessageResult)Enum.Parse(typeof(MessageResult), result.ToString()));
        }
Пример #3
0
        /// <summary>
        /// 页面提示信息方法
        /// </summary>
        /// <param name="title">提示标题</param>
        /// <param name="message">消息内容</param>
        /// <param name="url">链接地址</param>
        /// <param name="icon">提示图标</param>
        /// <param name="time">自动跳转时间(0为不自动跳转)</param>
        public static void Dialog(string title, string message, string url, MessageIcon icon, int time)
        {
            HttpContext.Current.Response.ContentType = "text/html";
            HttpContext.Current.Response.AddHeader("Content-Type", "text/html");
            StringBuilder sb = new StringBuilder();

            sb.Append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n");
            sb.Append("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
            sb.Append("<head>");
            sb.Append("<title>" + title + "</title>");
            sb.Append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />");
            if (time > 0)
            {
                sb.Append("<meta http-equiv=\"refresh\" content=\"" + time + ";url=" + (url == "-1" ? "javascript:history.go(-1)" : url) + "\" />");
            }
            sb.Append("<link rel=\"stylesheet\" type=\"text/css\" href=\"/css/dialog.css\" />");
            sb.Append("</head>");
            sb.Append("<body>");
            sb.Append("<table id=\"dialog\" class=\"dialog_blue\">");
            sb.Append("<tr class=\"dialog_header\" align=\"right\"><td class=\"h_l\"></td><td class=\"h_c\"><h2>" + title + "</h2>");
            sb.Append("<a href=\"javascript:window.close()\" class=\"close\"></a></td>");
            sb.Append("<td class=\"h_r\"></td></tr>");
            sb.Append("<tr class=\"dialog_content\">");
            sb.Append("<td class=\"c_l\"></td>");
            sb.Append("<td class=\"c_c\">");
            sb.Append("<div style=\"position:relative;width:430px;\">");
            sb.Append("<table style=\"border-collapse:separate;height:100%\" cellpadding=\"10\" cellspacing=\"10\">");
            sb.Append("<tr><td class=\"icon\"><img src=\"/images/dialog/ico_" + icon.ToString() + ".gif\"></td>");
            sb.Append("<td class=\"message\">");
            sb.Append(message);
            sb.Append("</td></tr></table></div>");
            if (time > 0)
            {
                sb.Append("<div class=\"buttonRow\"><a href=\"" + (url == "-1" ? "javascript:history.go(-1)" : url) + "\">如果页面没有自动跳转,请点击这里...</a></div>");
            }
            else if (url == "-1")
            {
                sb.Append("<div class=\"buttonRow\"><a href=\"javascript:history.go(-1);\">点击这里返回上一级操作</a></div>");
            }
            else
            {
                sb.Append("<div class=\"buttonRow\"><a href=\"" + url + "\">请点击这里进行下一步操作...</a></div>");
            }
            sb.Append("</td>");
            sb.Append("<td class=\"c_r\"></td>");
            sb.Append("</tr>");
            sb.Append("<tr class=\"dialog_bottom\"><td class=\"b_l\"></td><td class=\"b_c\"></td><td class=\"b_r\"></td></tr>");
            sb.Append("</table></body></html>");

            HttpContext.Current.Response.Write(sb.ToString());
            HttpContext.Current.Response.End();
        }
        public void Update(string message, string title, MessageOptions option, MessageIcon icon)
        {
            if (String.IsNullOrWhiteSpace(message))
            {
                throw new ArgumentException("message");
            }
            if (String.IsNullOrWhiteSpace(title))
            {
                throw new ArgumentException("title");
            }
            if (option == MessageOptions.None)
            {
                throw new ArgumentException("option");
            }
            if (icon == MessageIcon.None)
            {
                throw new ArgumentException("icon");
            }

            Title   = title;
            Message = message;
            Option  = option;
            Result  = MessageResult.None;

            switch (icon)
            {
            case MessageIcon.Question:
                Icon = SystemIcons.Question;
                break;

            case MessageIcon.Information:
                Icon = SystemIcons.Information;
                break;

            case MessageIcon.Warning:
                Icon = SystemIcons.Warning;
                break;

            case MessageIcon.Error:
                Icon = SystemIcons.Error;
                break;

            default:
                throw new NotImplementedException(icon.ToString());
            }
        }
        public void Update(string message, string title, MessageOptions option, MessageIcon icon)
        {
            if (String.IsNullOrWhiteSpace(message))
                throw new ArgumentException("message");
            if (String.IsNullOrWhiteSpace(title))
                throw new ArgumentException("title");
            if (option == MessageOptions.None)
                throw new ArgumentException("option");
            if (icon == MessageIcon.None)
                throw new ArgumentException("icon");

            Title = title;
            Message = message;
            Option = option;
            Result = MessageResult.None;

            switch (icon)
            {
                case MessageIcon.Question:
                    Icon = SystemIcons.Question;
                    break;
                case MessageIcon.Information:
                    Icon = SystemIcons.Information;
                    break;
                case MessageIcon.Warning:
                    Icon = SystemIcons.Warning;
                    break;
                case MessageIcon.Error:
                    Icon = SystemIcons.Error;
                    break;
                default:
                    throw new NotImplementedException(icon.ToString());
            }
        }
Пример #6
0
        /// <summary>
        /// 打开一个浮动窗口
        /// </summary>
        /// <param name="message">消息内容</param>
        /// <param name="icon">图标类型.为<see cref="MessageIcon"/>类型</param>
        private static void ShowFlowWindow(string message, MessageIcon icon)
        {
            //Get image path
            string IocPath = string.Format("/SMT.SaaS.Window;Component/Resources/{0}.png", icon.ToString());
            //create content
            Size size = new Size(0, 0);

            Grid grid = new Grid()
            {
                Opacity = 1
            };

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

            grid.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            grid.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            grid.RowDefinitions.Add(new RowDefinition());
            //grid.Effect = new DropShadowEffect() {BlurRadius=2};

            TransformGroup     group          = new TransformGroup();
            ScaleTransform     scaleTrans     = new ScaleTransform();
            RotateTransform    rotateTrans    = new RotateTransform();
            TranslateTransform translateTrans = new TranslateTransform()
            {
                Y = 100
            };
            SkewTransform skewTrans = new SkewTransform();

            group.Children.Add(scaleTrans);
            group.Children.Add(skewTrans);
            group.Children.Add(rotateTrans);
            group.Children.Add(translateTrans);
            grid.RenderTransform = group;

            Border _background = new Border()
            {
                BorderThickness = new Thickness(1)
            };

            _background.Background   = Application.Current.Resources["FlowMessageBackgroundBrush"] as Brush;
            _background.BorderBrush  = Application.Current.Resources["FlowMessageBorderSolidBrush"] as Brush;
            _background.CornerRadius = new CornerRadius(3);
            Grid.SetColumn(_background, 0);
            Grid.SetColumnSpan(_background, 2);
            Grid.SetRow(_background, 0);
            Grid.SetRowSpan(_background, 3);

            grid.Children.Add(_background);

            if (icon != MessageIcon.None)
            {
                Rectangle rect = new Rectangle()
                {
                    Margin = new Thickness(20, 5, 5, 5)
                };
                ImageBrush imgbr = new ImageBrush();
                imgbr.ImageSource        = new BitmapImage(new Uri(IocPath, UriKind.RelativeOrAbsolute));
                imgbr.Stretch            = Stretch.Fill;
                rect.Fill                = imgbr;
                rect.Height              = 24; rect.Width = 24;
                rect.HorizontalAlignment = HorizontalAlignment.Center;
                rect.VerticalAlignment   = VerticalAlignment.Center;

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

            TextBlock txbTitle = new TextBlock()
            {
                Text = "系统", FontFamily = new FontFamily("Arial,SimSun"), FontSize = 16, Foreground = new SolidColorBrush(Colors.Black), Margin = new Thickness(5, 5, 5, 2)
            };

            txbTitle.HorizontalAlignment = HorizontalAlignment.Left;
            txbTitle.VerticalAlignment   = VerticalAlignment.Center;
            txbTitle.MinWidth            = 250.0;
            Grid.SetColumn(txbTitle, 1);
            Grid.SetRow(txbTitle, 0);
            grid.Children.Add(txbTitle);

            TextBlock txbInfo = new TextBlock()
            {
                Text = message, FontFamily = new FontFamily("Arial,SimSun"), FontSize = 18, Foreground = new SolidColorBrush(Colors.Black), Margin = new Thickness(20, 5, 20, 10)
            };

            txbInfo.HorizontalAlignment = HorizontalAlignment.Left;
            txbInfo.VerticalAlignment   = VerticalAlignment.Center;
            Grid.SetColumn(txbInfo, 0);
            Grid.SetRow(txbInfo, 2);
            Grid.SetColumnSpan(txbInfo, 2);
            grid.Children.Add(txbInfo);

            Border lborder = new Border()
            {
                Height = 1, CornerRadius = new CornerRadius(1.0), Margin = new Thickness(20, 0, 5, 5)
            };

            lborder.Background = Application.Current.Resources["FlowMessageLineBorderSolidBrush"] as Brush;
            Grid.SetColumn(lborder, 0);
            Grid.SetRow(lborder, 1);
            Grid.SetColumnSpan(lborder, 2);
            grid.Children.Add(lborder);

            Model.DoubleKeyFramesModel transXkeyframes =

                new SMT.SAAS.AnimationEngine.Model.DoubleKeyFramesModel()
            {
                Target       = grid,
                BeginTime    = 0,
                PropertyPath = ConstPropertyPath.UIELEMENT_TRANSLATETRS_Y
            };

            transXkeyframes.KeyFrames = new SMT.SAAS.AnimationEngine.Model.KeyFrames <Double>[]
            {
                new Model.KeyFrames <Double>()
                {
                    Type = KeyFramesType.Linear, KeyTime = 0, Value = 100
                },
                new Model.KeyFrames <Double>()
                {
                    Type = KeyFramesType.Linear, KeyTime = 0.8, Value = 0
                },
                new Model.KeyFrames <Double>()
                {
                    Type = KeyFramesType.Linear, KeyTime = 1.6, Value = 0
                },
                new Model.KeyFrames <Double>()
                {
                    Type = KeyFramesType.Linear, KeyTime = 2.4, Value = -100
                }
            };

            Model.DoubleKeyFramesModel opactytykeyframes =
                new SMT.SAAS.AnimationEngine.Model.DoubleKeyFramesModel()
            {
                Target       = grid,
                BeginTime    = 0,
                PropertyPath = ConstPropertyPath.UIELEMENT_OPACITY
            };

            opactytykeyframes.KeyFrames = new SMT.SAAS.AnimationEngine.Model.KeyFrames <Double>[]
            {
                new Model.KeyFrames <Double>()
                {
                    Type = KeyFramesType.Linear, KeyTime = 0, Value = 0
                },
                new Model.KeyFrames <Double>()
                {
                    Type = KeyFramesType.Linear, KeyTime = 0.8, Value = 1
                },
                new Model.KeyFrames <Double>()
                {
                    Type = KeyFramesType.Linear, KeyTime = 1.6, Value = 1
                },
                new Model.KeyFrames <Double>()
                {
                    Type = KeyFramesType.Linear, KeyTime = 2.4, Value = 0
                }
            };

            List <IModel> _models = new List <IModel>()
            {
                transXkeyframes,
                opactytykeyframes
            };

            Storyboard _flowStroyboard = Engine.CreateStoryboard(_models);


            _flowStroyboard.Completed += (o, e) =>
            {
                if (Popup.IsOpen)
                {
                    Popup.IsOpen = false;
                }
            };

            if (!Popup.IsOpen)
            {
                Point point      = new Point(1024 / 2, 768 / 2);
                Size  windowSize = new Size(1024, 768);
                if (WindowsManager.Desktop != null)
                {
                    point             = new Point(WindowsManager.Desktop.ActualWidth / 2, WindowsManager.Desktop.ActualHeight / 2);
                    windowSize.Height = WindowsManager.Desktop.ActualHeight;
                    windowSize.Width  = WindowsManager.Desktop.ActualWidth;
                }
                else
                {
                    //new
                    var parent = (Application.Current.RootVisual as UserControl);
                    point             = new Point(parent.ActualWidth / 2, parent.ActualHeight / 2);
                    windowSize.Height = parent.ActualHeight;
                    windowSize.Width  = parent.ActualWidth;
                }

                Canvas canvas = new Canvas()
                {
                    Width = windowSize.Width, Height = windowSize.Height
                };

                Rectangle Overlay = new Rectangle()
                {
                    Width = windowSize.Width, Height = windowSize.Height
                };
                Overlay.Fill = new SolidColorBrush(Colors.Gray);

                Overlay.Opacity = .3;
                //canvas.Children.Add(Overlay);


                Canvas.SetLeft(grid, (point.X - 150 - grid.ActualWidth / 2));
                Canvas.SetTop(grid, (point.Y - 200 - grid.ActualHeight / 2));
                canvas.Children.Add(grid);
                Popup.IsOpen = true;
                Popup.Child  = canvas;
                _flowStroyboard.Begin();
            }
            else
            {
                return;
            }
        }
Пример #7
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