protected override void OnUnloaded()
 {
     base.OnUnloaded();
     this.DataContext = null;
     this.viewModel.Dispose();
     this.viewModel = null;
 }
 protected override void OnLoaded()
 {
     Instance         = this;
     this.DataContext = this.viewModel =
         new ViewModelTradingStationLotEditor(
             this.lot,
             callbackSave: () => this.CloseWindow(DialogResult.OK),
             callbackCancel: () => this.CloseWindow(DialogResult.Cancel));
 }
        protected override void OnUnloaded()
        {
            if (ReferenceEquals(this, Instance))
            {
                Instance = null;
            }

            this.DataContext = null;
            this.viewModel.Dispose();
            this.viewModel = null;
        }