コード例 #1
0
        protected override void Save(object model)
        {
            if (_XiaoQu != null)
            {
                if (_XiaoQu.XueYuanId == 0)
                {
                    ModernDialog dialog = new ModernDialog() { Content = "学院名称不能为空" };
                    dialog.ShowDialog();
                    return;
                }

                if (string.IsNullOrEmpty(_XiaoQu.Name))
                {
                    ModernDialog dialog = new ModernDialog() { Content = "校区名称不能为空" };
                    dialog.ShowDialog();
                    return;
                }
                Services.XiaoQuServicesClient service = new Services.XiaoQuServicesClient();
                //新增
                if (_XiaoQu.Id == 0)
                {
                    int i = service.XiaoQuAdd(_XiaoQu);
                }
                //修改
                else
                {
                    int i = service.XiaoQuUpdate(_XiaoQu);
                }
                BorderVisibility = Visibility.Collapsed;
                service.Close();
            }
        }
コード例 #2
0
ファイル: ModernDialog.cs プロジェクト: yangdaichun/ZHXY.ZSXT
        /// <summary>
        /// Displays a messagebox.
        /// </summary>
        /// <param name="text">The text.</param>
        /// <param name="title">The title.</param>
        /// <param name="button">The button.</param>
        /// <param name="owner">The window owning the messagebox. The messagebox will be located at the center of the owner.</param>
        /// <returns></returns>
        public static MessageBoxResult ShowMessage(string text, string title, MessageBoxButton button, Window owner = null)
        {
            var dlg = new ModernDialog {
                Title = title,
                Content = new BBCodeBlock { BBCode = text, Margin = new Thickness(0, 0, 0, 8) },
                MinHeight = 0,
                MinWidth = 0,
                MaxHeight = 480,
                MaxWidth = 640,
            };
            if (owner != null) {
                dlg.Owner = owner;
            }

            dlg.Buttons = GetButtons(dlg, button);
            dlg.ShowDialog();
            return dlg.messageBoxResult;
        }