Esempio n. 1
0
        private void Dispose()
        {
            SchemeViewModel        svm = (ViewItems[0].View as FrameworkElement).DataContext as SchemeViewModel;
            SchemeConvertViewModel cvm = (ViewItems[1].View as FrameworkElement).DataContext as SchemeConvertViewModel;

            this.SetNodeEvent        -= svm.SetNode;
            this.ClearNodeEvent      -= svm.ClearNode;
            this.ParseFileDoneEvent  -= cvm.ParseFileDone;
            this.SetCurrentPathEvent -= svm.SetCurrentPath;
            this.SetCurrentPathEvent -= cvm.SetCurrentPath;
            this.CleanUpEvent        -= svm.CleanUp;
            this.CleanUpEvent        -= cvm.CleanUp;
            Cleanup();
        }
Esempio n. 2
0
        public CCheckerViewModel(ISnackbarMessageQueue snackbarMessageQueue, Dispatcher dispatcher)
        {
            SchemeViewModel        svm = new SchemeViewModel(snackbarMessageQueue);
            SchemeConvertViewModel cvm = new SchemeConvertViewModel(snackbarMessageQueue);

            this.SetNodeEvent        += svm.SetNode;
            this.ClearNodeEvent      += svm.ClearNode;
            this.ParseFileDoneEvent  += cvm.ParseFileDone;
            this.SetCurrentPathEvent += svm.SetCurrentPath;
            this.SetCurrentPathEvent += cvm.SetCurrentPath;
            this.CleanUpEvent        += svm.CleanUp;
            this.CleanUpEvent        += cvm.CleanUp;
            ViewItems = new[]
            {
                new ViewItem("统计和修改", new SchemeView()
                {
                    DataContext = svm,
                }),
                new ViewItem("转换", new SchemeConvert(cvm)),
            };
            this.mainDispatcher = dispatcher ?? throw new ArgumentNullException(nameof(dispatcher));
        }
 public SchemeConvert(SchemeConvertViewModel cvm)
 {
     InitializeComponent();
     this.DataContext = cvm;
     (this.DataContext as SchemeConvertViewModel).Init(this.Dispatcher);
 }