Exemplo n.º 1
0
        public void EventLog_Test_AddEvent_ClearLog()
        {
            String   log       = "Test log";
            SimEvent testEvent = new SimEvent(log, CubeSatCommSim.Model.EventSeverity.WARNING);

            int initNumOfEvents = EventLog.EventList.Count;

            EventLog.AddLog(testEvent);
            Assert.AreEqual(initNumOfEvents + 1, EventLog.EventList.Count);
            EventLog.ClearLog();
            Assert.AreEqual(initNumOfEvents, EventLog.EventList.Count);
        }
Exemplo n.º 2
0
        public void AddBus()
        {
            CSPBus       b   = new CSPBus("New bus", 1);
            CSPBusVM     vm  = new CSPBusVM(b);
            AddBusDialog dlg = new AddBusDialog();

            dlg.DataContext = vm;

            if (dlg.ShowDialog() == true)
            {
                md.Buses.Add(b);
                EventLog.AddLog(new SimEvent("A new bus was added: '" + b.Name + "'", EventSeverity.INFO));
            }
        }
Exemplo n.º 3
0
 private void Delete_Click(object sender, RoutedEventArgs e)
 {
     if (MessageBox.Show(
             "Are you sure you want to delete '" + ((ModuleVM)DataContext).Name + "'?",
             "Deleting Module",
             MessageBoxButton.YesNo,
             MessageBoxImage.Warning
             ) == MessageBoxResult.Yes)
     {
         simController.RemoveModule(((ModuleVM)DataContext).md);
         EventLog.AddLog(new SimEvent("Module '" + ((ModuleVM)DataContext).Name + "' was deleted", EventSeverity.INFO));
         DialogResult = true;
         Close();
     }
 }
Exemplo n.º 4
0
        public void AddModule()
        {
            Module m;

            if (Modules.IsEmpty)
            {
                m = new Module("New Module", 0, 0);
            }
            else
            {
                m = new Module("New module", Math.Min(md.Modules.Last().Address + 1, 31), 0);
            }
            ModuleVM        vm  = new ModuleVM(m);
            AddModuleDialog dlg = new AddModuleDialog();

            dlg.DataContext = vm;

            if (dlg.ShowDialog() == true)
            {
                md.Modules.Add(m);
                EventLog.AddLog(new SimEvent("A new module was added: '" + m.Name + "'", EventSeverity.INFO));
            }
        }