public MainWindow()
        {
            InitializeComponent();
            CargoCollectionViewModels = new ObservableCollection <CargoCollectionViewModel>();
            CargoViewModels           = new ObservableCollection <CargoViewModel>();
            CMContext = new CargoManagementContext();
            CMContext.CargoCollection.Load();
            CMContext.Cargo.Load();
            CMContext.Block.Load();
            CMContext.Warehouse.Load();
            CMContext.Plane.Load();
            CMContext.PurchaseOrder.Load();
            CMContext.PurchaseOrderCollection.Load();
            CMContext.SellOrder.Load();
            CMContext.SellOrderCollection.Load();
            CMContext.PurchasePrizeDic.Load();
            InitializeViewModels();

            SearchView = new SearchUserControl(CMContext, CargoCollectionViewModels)
            {
                VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Stretch
            };
            PurchaseCargoView = new PurchaseCargoUserControl(CMContext, WarehouseRootViewModel, CargoViewModels, CargoCollectionViewModels, PurchaseOrderCollectionViewModels)
            {
                VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Stretch
            };
            SellCargoView = new SellCargoUserControl(CMContext, CargoCollectionViewModels, SellOrderCollectionViewModels)
            {
                VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Stretch
            };
            CategoryManagementView = new CategoryManagementUserControl(CMContext, CargoViewModels, CargoCollectionViewModels)
            {
                VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Stretch
            };
            WarehouseManagementView = new WarehouseManagementUserControl(CMContext, WarehouseRootViewModel, CargoCollectionViewModels)
            {
                VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Stretch
            };
            LogPurchaseOrderView = new LogPurchaseOrderUserControl(CMContext, PurchaseOrderCollectionViewModels)
            {
                VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Stretch
            };
            LogSellOrderView = new LogSellOrderUserControl(CMContext, SellOrderCollectionViewModels)
            {
                VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Stretch
            };

            //DateTime time = new DateTime();
            //Console.WriteLine(time);
            //Thread.Sleep(1000);
            //DateTime time2 = DateTime.Now;
            //Console.WriteLine(time2);
            //Console.WriteLine(time < time2);
            this.DataContext = new MainWindowViewModel(CMContext);
            this.ShowPanel.Children.Add(SearchView);
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.window = ((CargoManagementSystem.View.PurchaseCargoUserControl)(target));
                return;

            case 2:
                this.DataGrid = ((System.Windows.Controls.DataGrid)(target));
                return;

            case 3:
                this.CargoName = ((MaterialDesignThemes.Wpf.DataGridTextColumn)(target));
                return;

            case 4:
                this.Category = ((MaterialDesignThemes.Wpf.DataGridTextColumn)(target));
                return;

            case 5:
                this.Material = ((MaterialDesignThemes.Wpf.DataGridTextColumn)(target));
                return;

            case 6:
                this.Size = ((MaterialDesignThemes.Wpf.DataGridTextColumn)(target));
                return;

            case 7:
                this.SizeUnit = ((MaterialDesignThemes.Wpf.DataGridTextColumn)(target));
                return;

            case 8:
                this.StdCategory = ((MaterialDesignThemes.Wpf.DataGridTextColumn)(target));
                return;

            case 9:
                this.StdName = ((MaterialDesignThemes.Wpf.DataGridTextColumn)(target));
                return;

            case 10:
                this.Operation = ((System.Windows.Controls.DataGridTemplateColumn)(target));
                return;

            case 11:
                this.OutOrderButton = ((System.Windows.Controls.Button)(target));
                return;

            case 12:
                this.tt = ((System.Windows.Media.TranslateTransform)(target));
                return;

            case 13:
                this.InOrderButton = ((System.Windows.Controls.Button)(target));
                return;

            case 14:
                this.OrderDataGrid = ((System.Windows.Controls.DataGrid)(target));
                return;

            case 15:
                this.DeleteOrderCollectionButton = ((System.Windows.Controls.Button)(target));
                return;

            case 16:
                this.ConfirmOrderCollectionButton = ((System.Windows.Controls.Button)(target));
                return;
            }
            this._contentLoaded = true;
        }