Beispiel #1
0
        partial void MainWindowCtor()
        {
            try
            {
                this.InitializeComponent();

                BaseViewModel.GetAddDatabseView         = this.GetAddDatabaseView;
                BaseViewModel.GetSettingView            = this.GetSettingView;
                BaseViewModel.GetCreateMinorVersionView = this.GetCreateMinorVersionView;
                BaseViewModel.GetMessageBox             = (text, title, buttons) => this.GetMessageBox(text, title, buttons, false);
                BaseViewModel.GetMarkdownBox            = (text, title, buttons) => this.GetMessageBox(text, title, buttons, true);
                BaseViewModel.OpenImportWindow          = this.OpenImportWindow;
                BaseViewModel.OpenExportWindow          = this.OpenExportWindow;
                this.DataContext = this.mainWindowViewModel;

                var monitor = new VerticalPositionMonitor();
                this.DatabaseList.PositionMonitor = monitor;
                this.DatabaseList.PreviewMouseUp += this.DatabaseListPreviewMouseUp;
                monitor.OrderChanged   += this.DatabaseOrderChanged;
                this.dialogHost.Loaded += this.DialogHostLoaded;
            }
            catch (Exception e)
            {
                var n = new Greg.WPF.Utility.ExceptionMessageBox(e, "Unhandled Exception");
                n.ShowDialog();
            }
        }
        public BasicExampleMainModel()
        {
            _basicColourMonitor = new PositionMonitor();
            _basicColourMonitor.LocationChanged += (sender, args) => BasicColourMonitorText = args.Location.ToString();
            _peopleMonitor = new VerticalPositionMonitor();
            _peopleMonitor.OrderChanged += PeopleMonitorOnOrderChanged;

            _people.Add(new Person {
                FirstName = "Albert", LastName = "Einstein"
            });
            _people.Add(new Person {
                FirstName = "Neil", LastName = "Tyson"
            });
            _people.Add(new Person {
                FirstName = "James", LastName = "Willock"
            });                                                                    //i move in esteemed circles ;)

            _viewModels.Add(new SimpleViewModel {
                Name = "Alpha", SimpleContent = "This is the alpha content"
            });
            _viewModels.Add(new SimpleViewModel {
                Name = "Beta", SimpleContent = "Beta content", IsSelected = true
            });
            _viewModels.Add(new SimpleViewModel {
                Name = "Gamma", SimpleContent = "And here is the gamma content"
            });

            SelectedViewModel = _viewModels[1];

            _interTabClient = new BasicExampleInterTabClient();

            _addNewPerson = new AnotherCommandImplementation(
                x =>
            {
                _newPersonCount++;
                _people.Add(new Person
                {
                    FirstName = "Hello_" + _newPersonCount,
                    LastName  = "World_" + _newPersonCount
                });
            });

            _addNewViewModel = new AnotherCommandImplementation(
                x =>
            {
                _newViewModelCount++;
                _viewModels.Add(new SimpleViewModel()
                {
                    Name          = "New Tab " + _newViewModelCount,
                    SimpleContent = "New Tab Content " + _newViewModelCount
                });
                SelectedViewModel = _viewModels.Last();
            });
        }
Beispiel #3
0
        public DragablzVerticalItemsControl()
        {
            MouseDown += DragablzVerticalItemsControl_MouseDown;
            var VerticalPositionMonitor = new VerticalPositionMonitor();

            VerticalPositionMonitor.OrderChanged    += VerticalPositionMonitor_OrderChanged;
            VerticalPositionMonitor.LocationChanged += VerticalPositionMonitor_LocationChanged;
            PositionMonitor = VerticalPositionMonitor;
            var customOrganiser = new CustomOrganiser();

            customOrganiser.DragCompleted += CustomOrganiser_DragCompleted;
            ItemsOrganiser = customOrganiser;
        }