示例#1
0
        public MainWindowViewModel()
        {
            #region initialisation of main db
            Companies = new ObservableCollection <Company>(Company.GetCompanies()); //with test data - Company.GetCompanies()
            #endregion

            #region initialisation of commands
            ShowCompanyView = new InterfaceCommand(ShowCompanyView_Execute, ShowCompanyView_CanExecute);
            ChangeElement   = new InterfaceCommand(ChangeElement_Execute, ChangeElement_CanExecute);
            #endregion

            #region initialisation of all Views for bindind
            CompanyViewBinding  = new CompanyView();
            AdressViewBinding   = new AdressView();
            EmployeeViewBinding = new EmployeeView();
            #endregion

            #region initialisation of all View Models for bindind
            CompanyViewModelBinding  = new CompanyViewModel();
            AdressViewModelBinding   = new AdressViewModel();
            EmployeeViewModelBinding = new EmployeeViewModel();
            #endregion

            #region bind all View Models to Views
            CompanyViewBinding.DataContext  = CompanyViewModelBinding;
            AdressViewBinding.DataContext   = AdressViewModelBinding;
            EmployeeViewBinding.DataContext = EmployeeViewModelBinding;
            #endregion
        }
示例#2
0
        static void Main()
        {
            AdressView view = new AdressView();

            view.Visible = false;
            List <Contact> contacts = new List <Contact>();
            // contacts.Add(new Contact("a","b","1","0"));
            ContactController controller = new ContactController(view, contacts);

            view.ShowDialog();

            /*Application.EnableVisualStyles();
             * Application.SetCompatibleTextRenderingDefault(false);
             * Application.Run(new AdressView());*/
        }