コード例 #1
0
 private void UserControl_Loaded(object sender, RoutedEventArgs e)
 {
     if (this.myLoaded)
     {
         return;
     }
     this.myLoaded = true;
     this.dgvOrderChanges.ItemsSource             = this.deliveryInViewModels;
     this.deliveryInViewModels.CollectionChanged += OrderReturns_CollectionChanged;
     this.cbbDeliveryCompanies.ItemsSource        = DeliveryCompanyService.GetDeliveryCompaniyNames();
 }
コード例 #2
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            if (this.myLoaded)
            {
                return;
            }
            try
            {
                this.dpStart.Value = DateTime.Now.AddDays(-30);
                this.cbbOrderType.Bind <OrderType>();
                this.cbbState.Bind <OrderState>();
                this.cbbCreateType.Bind <OrderCreateType>();
                orderService = ServiceContainer.GetService <OrderService>();
                vs           = ServiceContainer.GetService <VendorService>();

                //快递公司
                var coms = DeliveryCompanyService.GetDeliveryCompaniyNames().ToList();
                coms.Insert(0, "");
                this.cbbDeliveryCompany.ItemsSource = coms;

                //店铺
                var shops = ServiceContainer.GetService <ShopService>().GetByAll().Datas.Where(obj => obj.Enabled).ToList();
                shops.Insert(0, new Shop {
                    Mark = ""
                });
                this.cbbShops.ItemsSource = shops;

                //旗帜
                var flags = new ColorFlag[]
                {
                    ColorFlag.UN_LABEL, ColorFlag.RED, ColorFlag.YELLOW, ColorFlag.GREEN, ColorFlag.BLUE, ColorFlag.PINK
                };
                var flagVms = flags.Select(obj => new OrderFlagViewModel(false, obj)).ToArray();
                this.cbbFlags.ItemsSource = flagVms;

                var shippers = ServiceContainer.GetService <GoodsService>().GetAllShippers().Datas;
                shippers.Insert(0, "");
                this.cbbShippers.ItemsSource = shippers;

                this.myLoaded = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #3
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                if (this.isLoaded)
                {
                    return;
                }

                try
                {
                    MessageCenter.Instance.Start();
                    MessageCenter.Instance.MessageArrived += new EventHandler <MessageArrviedEventArgs>(Instance_MessageArrived);
                }
                catch (Exception ee)
                {
                    var ie = ee;
                    while (ie.InnerException != null)
                    {
                        ie = ie.InnerException;
                    }
                    MessageBox.Show("初始化网络同步端口失败,你在快递分配的操作将无法实时更新到其它电脑" + Environment.NewLine + ie.Message, "错误");
                }

                //生成快递右键菜单
                var ptcs = DeliveryCompanyService.GetDeliveryCompaniyNames();
                foreach (var ptc in ptcs)
                {
                    MenuItem miDeliveryCompanyChose = new MenuItem {
                        Header = ptc, Tag = ptc
                    };
                    miDeliveryCompanyChose.Click += miDeliveryCompanyChose_Click;
                    this.dgvOrders.ContextMenu.Items.Insert(this.dgvOrders.ContextMenu.Items.Count - 2, miDeliveryCompanyChose);
                }
                isLoaded = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }