Esempio n. 1
0
        public static void Open_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            try
            {
                Dictionary<string, object> paraDic = e.Parameter as Dictionary<string, object>;
                if (paraDic == null)
                {
                    return;
                }
                string type = (string)paraDic["type"];
                switch (type)
                {
                    case "addNew":
                        CC.AddNew(paraDic);
                        break;
                    case "saveLow":
                        CC.SaveLow(paraDic);
                        break;
                    case "selectImage":
                        CC.selectImage(paraDic);
                        break;
                    case "detail":
                        CC.Detail(paraDic);
                        break;
                    case "saveDetails":
                        CC.saveDetails(paraDic);
                        break;
                    case "TableCommonDeleteData":
                        CC.TableCommonDeleteData(paraDic);
                        break;
                    case "ImageView":
                        CC.ImageView(paraDic);
                        break;
                    case "TypeDetail":
                        CC.TypeDetail(paraDic);
                        break;
                    default:
                        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"];
                        }
                        WinDetail wd1 = new WinDetail(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"]);
                        break;
                }

            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(ex.Message.ToString());
            }
        }
Esempio n. 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
            {

            }
        }