Beispiel #1
0
        private static void TypeDetail(Dictionary<string, object> paraDic)
        {
            string pageID = (string)paraDic["pageID"];
            bool isEdit = false;
            if (paraDic.ContainsKey("isEdit"))
            {
                isEdit = (bool)paraDic["isEdit"];
            }
            string title = "";
            if (paraDic.ContainsKey("title"))
            {
                title = (string)paraDic["title"];
            }
            WinDetail2 wd1 = new WinDetail2(paraDic["context1"], isEdit, title);
            wd1.PageFrame.Navigate(new Uri(Tools.PageTool(pageID), UriKind.RelativeOrAbsolute));
            bool? res = wd1.ShowDialog();
            if (res.HasValue && res.Value)
            {

            }
            if (paraDic.ContainsKey("context2"))
                CommonReflashData((FrameworkElement)paraDic["context2"]);
        }
Beispiel #2
0
        internal static void CreateNew(object sender, ExecutedRoutedEventArgs e)
        {
            try
            {
                //获取参数,如果为空,就返回
                Dictionary<string, object> paraDic = e.Parameter as Dictionary<string, object>;
                if (paraDic == null)
                    return;
                //定义参数
                string type = ""; //新增哪个页面
                string pageID = ""; //导航页面
                bool isEdit = false; //是否可以编辑,就是是否出现保存和取消按钮
                string title = ""; //页面的标题
                //获取对应的参数
                if (paraDic.ContainsKey("type"))
                {
                    type = (string)paraDic["type"];
                }
                if (paraDic.ContainsKey("pageID"))
                {
                    pageID = (string)paraDic["pageID"];
                }
                if (paraDic.ContainsKey("isEdit"))
                {
                    isEdit = (bool)paraDic["isEdit"];
                }
                if (paraDic.ContainsKey("title"))
                {
                    title = (string)paraDic["title"];
                }
                switch (type)
                {
                    //珠宝增加
                    case "GoodsType":
                        ObservableCollection<Jewelry> main_ic = paraDic["context1"] as ObservableCollection<Jewelry>;
                        if (main_ic != null)
                        {
                            Jewelry _je = new Jewelry(true);
                            //main_ic.Add(_je);
                            WinDetail wd1 = new WinDetail(_je, isEdit, title);
                            wd1.PageFrame.Navigate(new Uri(Tools.PageTool(pageID), UriKind.RelativeOrAbsolute));
                            bool? res = wd1.ShowDialog();

                            if (res.HasValue && res.Value)
                            {

                            }
                            CommonReflashData((FrameworkElement)paraDic["context2"]);
                        }
                        break;
                    //珠宝类别增加
                    case "JeweleyCategoryType":
                    //珠宝归属人增加
                    case "JeweleyOwnType":
                    //珠宝颜色增加
                    case "JeweleyColorType":
                        //上面三个类别都用同一个操作
                        ObservableCollection<TypeEntity> ObTE = paraDic["context1"] as ObservableCollection<TypeEntity>;
                        if (ObTE != null)
                        {
                            TypeEntity _te = new TypeEntity(true);
                            //main_ic.Add(_je);
                            WinDetail2 wd1 = new WinDetail2(_te, isEdit, title);
                            wd1.PageFrame.Navigate(new Uri(Tools.PageTool(pageID), UriKind.RelativeOrAbsolute));
                            bool? res = wd1.ShowDialog();

                            if (res.HasValue && res.Value)
                            {

                            }
                            CommonReflashData((FrameworkElement)paraDic["context2"]);
                        }
                        break;
                    case "":
                        break;
                    default:
                        break;
                }
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message);
                //记录日志,暂未添加

            }
            finally
            {

            }
        }