Example #1
0
        void OnClicked4(object sender, RoutedEventArgs e)
        {
            if (_dlg == null)
            {
                _dlg = new Dlg
                {
                    Background      = null,
                    Resizeable      = false,
                    HideTitleBar    = true,
                    BorderThickness = new Thickness(0),
                    PhonePlacement  = DlgPlacement.CenterScreen,
                    WinPlacement    = DlgPlacement.CenterScreen,
                };

                // 通过data描述的方式构建发杂path的方式如下行注释掉的方式调用
                //Path path = Res.ParsePath("M30,15 C30,23.2843 23.2843,30 15,30 C6.71573,30 0,23.2843 0,15 C0,6.71573 6.71573,0 15,0 C23.2843,0 30,6.71573 30,15 z");
                Ellipse path = new Ellipse
                {
                    Height           = 200,
                    Width            = 140,
                    StrokeThickness  = 4,
                    IsHitTestVisible = true,
                    Fill             = new SolidColorBrush(Colors.Green),
                    Stroke           = new SolidColorBrush(Colors.Red),
                };
                _dlg.Content = path;
            }
            _dlg.Show();
        }
Example #2
0
        /// <summary>
        /// 显示登录页面
        /// </summary>
        /// <param name="p_isPopup">是否为弹出式</param>
        public static void ShowLogin(bool p_isPopup)
        {
            Kit.RunAsync(() =>
            {
                // 外部未指定时采用默认登录页
                Type tp  = _loginPageType == null ? Type.GetType("Dt.App.DefaultLogin,Dt.App") : _loginPageType;
                var page = Activator.CreateInstance(tp) as UIElement;
                if (!p_isPopup)
                {
                    SysVisual.RootContent = page;
                    return;
                }

                // 弹出式登录页面在未登录遇到需要登录的功能时
                var dlg = new Dlg
                {
                    Resizeable     = false,
                    HideTitleBar   = true,
                    PhonePlacement = DlgPlacement.Maximized,
                    WinPlacement   = DlgPlacement.Maximized,
                    Content        = page,
                };
                dlg.Show();
            });
        }
Example #3
0
        public override void OnCellClick(RptCellArgs p_args)
        {
            var row = p_args.Data;

            if (p_args.Row == 0 && p_args.Col == 1)
            {
                if (p_args.Text != "根菜单")
                {
                    OnBack(null, null);
                }
            }
            else if (p_args.Col == 1)
            {
                if (row.Bool("isgroup"))
                {
                    var info = new MyRptInfo {
                        Name = "脚本", Params = new Dict {
                            { "parentid", row.Str("id") }, { "parentname", row.Str("name") }
                        }
                    };
                    var ls = View.Tag as Stack <RptInfo>;
                    if (ls == null)
                    {
                        ls       = new Stack <RptInfo>();
                        View.Tag = ls;
                    }
                    ls.Push(View.Info);
                    View.LoadReport(info);
                }
                else
                {
                    Dlg dlg = new Dlg();
                    var pnl = new StackPanel
                    {
                        Children =
                        {
                            new TextBlock {
                                Text = "id:" + row.Str("id")
                            },
                            new TextBlock {
                                Text = "parentid:" + row.Str("parentid")
                            },
                            new TextBlock {
                                Text = "name:" + row.Str("name")
                            },
                            new TextBlock {
                                Text = "isgroup:" + row.Str("isgroup")
                            },
                        },
                        Margin = new Thickness(20),
                    };
                    dlg.Content = pnl;
                    dlg.Show();
                }
            }
            else if (p_args.Col == 2)
            {
                Kit.Msg(row.Bool("isgroup") ? "分组菜单" : "实体菜单");
            }
        }
Example #4
0
 /// <summary>
 /// 显示对话框
 /// </summary>
 /// <param name="p_dlg">对话框</param>
 /// <param name="p_winPlacement">windows模式的显示位置</param>
 /// <param name="p_phonePlacement">phone模式的显示位置</param>
 /// <param name="p_target">采用相对位置显示时的目标元素</param>
 /// <param name="p_hideTitleBar">否隐藏标题栏</param>
 /// <param name="p_isPinned">是否固定对话框</param>
 public static void ShowAt(
     this Dlg p_dlg,
     DlgPlacement p_winPlacement,
     DlgPlacement p_phonePlacement,
     FrameworkElement p_target = null,
     bool p_hideTitleBar       = false,
     bool p_isPinned           = false)
 {
     if (p_dlg != null)
     {
         p_dlg.WinPlacement   = p_winPlacement;
         p_dlg.PhonePlacement = p_phonePlacement;
         if (p_target != null)
         {
             p_dlg.PlacementTarget = p_target;
         }
         if (p_hideTitleBar)
         {
             p_dlg.HideTitleBar = true;
         }
         if (p_isPinned)
         {
             p_dlg.IsPinned = true;
         }
         p_dlg.Show();
     }
 }
Example #5
0
        void OnDetail(object sender, Mi e)
        {
            Dlg dlg = new Dlg();

            dlg.Content = new TextBlock {
                Margin = new Thickness(20), Text = $"id:{View.Info.Params["parentid"]}\r\nname:{View.Info.Params["parentname"]}"
            };
            dlg.Show();
        }
Example #6
0
        void OnNaviClick(object sender, RoutedEventArgs e)
        {
            Dlg dlg = new Dlg();

            dlg.Content = new TabNav1();
            if (!Kit.IsPhoneUI)
            {
                dlg.Width  = 300;
                dlg.Height = 300;
            }
            dlg.Show();
        }
Example #7
0
        /// <summary>
        /// 显示错误对话框
        /// </summary>
        /// <param name="p_content">消息内容</param>
        /// <param name="p_title">标题</param>
        public void Error(string p_content, string p_title)
        {
            var dlg = new Dlg {
                Title = p_title, IsPinned = true
            };

            if (Kit.IsPhoneUI)
            {
                dlg.PhonePlacement = DlgPlacement.CenterScreen;
                dlg.Width          = SysVisual.ViewWidth - 40;
            }
            else
            {
                dlg.WinPlacement = DlgPlacement.CenterScreen;
                dlg.MinWidth     = 300;
                dlg.MaxWidth     = SysVisual.ViewWidth / 4;
                dlg.ShowVeil     = true;
            }
            Grid grid = new Grid {
                Margin = new Thickness(20), VerticalAlignment = VerticalAlignment.Center
            };

            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = GridLength.Auto
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1.0, GridUnitType.Star)
            });
            grid.Children.Add(new TextBlock {
                Text = "\uE037", FontFamily = Res.IconFont, Foreground = Res.RedBrush, FontSize = 30, Margin = new Thickness(0, 0, 10, 0),
            });
            var tb = new TextBlock {
                Text = p_content, TextWrapping = TextWrapping.Wrap, VerticalAlignment = VerticalAlignment.Center
            };

            Grid.SetColumn(tb, 1);
            grid.Children.Add(tb);
            dlg.Content = grid;
            dlg.Show();
        }
Example #8
0
        public static void ShowBox()
        {
            // 桌面
            if (SysVisual.RootContent is Desktop)
            {
                // 桌面时停靠在左侧
                if (_win == null)
                {
                    _win = new SysTrace();
                    _win.SetSplitWidth(400);
                }

                // 注销后再打开时可能异常!
                Desktop.Inst.LeftWin = _win;
                return;
            }

            // phone模式
            if (SysVisual.RootContent is Frame)
            {
                Kit.OpenWin(typeof(SysTrace));
                return;
            }

            // win模式未登录
            if (_dlg == null)
            {
                var trace = new SysTrace();
                _dlg = new Dlg
                {
                    Title        = "系统监视",
                    Content      = trace,
                    IsPinned     = true,
                    WinPlacement = DlgPlacement.FromLeft,
                    BorderBrush  = Res.浅灰边框,
                    Width        = 400
                };
            }
            _dlg.Show();
        }
Example #9
0
        void OnSetting(object sender, EventArgs e)
        {
            Type tp = Kit.GetViewType("我的设置");

            if (tp == null)
            {
                Kit.Msg("未找到设置视图!");
                return;
            }

            var dlg = new Dlg {
                Title = "设置"
            };

            if (!Kit.IsPhoneUI)
            {
                dlg.Width  = 400;
                dlg.Height = 500;
            }
            dlg.Content = Activator.CreateInstance(tp);
            dlg.Show();
        }
Example #10
0
        void OnLocalDb(object sender, Mi e)
        {
            if (Kit.IsPhoneUI || SysVisual.RootContent is Desktop)
            {
                Kit.OpenWin(typeof(LocalDbView));
                return;
            }

            // win模式未登录
            if (_dlgDb == null)
            {
                _dlgDb = new Dlg
                {
                    Title        = "本地库",
                    Content      = new LocalDbView(),
                    IsPinned     = true,
                    WinPlacement = DlgPlacement.Maximized,
                    BorderBrush  = Res.浅灰边框,
                };
            }
            _dlgDb.Show();
        }
Example #11
0
        /// <summary>
        /// 显示提示信息
        /// </summary>
        /// <param name="p_target"></param>
        /// <param name="p_msg"></param>
        /// <param name="p_brush"></param>
        public static void ShowMessage(FrameworkElement p_target, string p_msg, SolidColorBrush p_brush)
        {
            Dlg dlg = new Dlg
            {
                WinPlacement       = DlgPlacement.TargetOuterTop,
                PhonePlacement     = DlgPlacement.TargetOuterTop,
                PlacementTarget    = p_target,
                HideTitleBar       = true,
                Background         = null,
                Foreground         = Res.WhiteBrush,
                BorderThickness    = new Thickness(0),
                Resizeable         = false,
                AutoAdjustPosition = false,
            };

            Grid grid = new Grid
            {
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                }
            };

            // 消息内容
            grid.Children.Add(new Border
            {
                Background      = p_brush,
                BorderThickness = new Thickness(0),
                MinHeight       = 40,
                MinWidth        = 100,
                MaxWidth        = 200,
                Child           = new TextBlock {
                    Text = p_msg, VerticalAlignment = VerticalAlignment.Center, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(10)
                },
            });

            // 三角
            Polygon poly = new Polygon
            {
                Points = new PointCollection {
                    new Point(0, 0), new Point(10, 10), new Point(20, 0)
                },
                Fill   = p_brush,
                Width  = 18,
                Height = 14,
                HorizontalAlignment = HorizontalAlignment.Left,
                Stretch             = Stretch.Fill,
                Margin = new Thickness(18, -2, 0, 0),
            };

            Grid.SetRow(poly, 1);
            grid.Children.Add(poly);

            dlg.Content = grid;
            dlg.Show();
        }