private void initViewModel()
        {
            var vm = DataContext as MainViewmodel;

            disposeViewModel(vm);
            vm = new MainViewmodel();
            vm.GraphItems.ListChanged += GraphItems_ListChanged;
            vm.AlarmSoundRequested    += vm_AlarmSoundRequested;
            DataContext = vm;
        }
 private void disposeViewModel(MainViewmodel vm)
 {
     if (vm == null)
     {
         return;
     }
     vm.GraphItems.ListChanged -= GraphItems_ListChanged;
     vm.AlarmSoundRequested    -= vm_AlarmSoundRequested;
     vm.Dispose();
 }