public AlarmMessagesViewModel(MainUnitViewModel main) { _main = main; InitializeMessageList(); _main.SdCardPositionsReceived += Receiver_SdCardMessagesReceived; _main.SdCardPositionsReceived += Receiver_SdCardPositionsReceived; }
/// <summary> /// adds a new mainunit to the system /// </summary> private void AddMainUnit() { if (!LibraryData.SystemIsOpen) { LibraryData.CreateEmptySystem(); } var t = new UcEscNum(LibraryData.FuturamaSys.MainUnits.Select(n => n.Id).ToList()); if (t.ShowDialog() == false) { return; } var mu = LibraryData.AddEsc(t.Result); if (mu == null) { return; } var newunit = new MainUnitViewModel(mu, this); TabCollection.Add(newunit); OnSystemChanged(new SystemChangedEventArgs() { NewMainUnit = newunit }); }
/// <summary> /// Removes a slave from the system and reorders unit numbers and cardnumbers /// </summary> private void RemoveMainUnit(MainUnitViewModel m) { if (MessageBox.Show(Main._mainMSGDelUnitConfirmation, Main._mainMSGDelUnitTitle, MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.OK) { RemoveUnit(m); } }
public void RemoveUnit(MainUnitViewModel mainUnit) { OnSystemChanged(new SystemChangedEventArgs() { OldMainUnit = mainUnit }); TabCollection.Remove((mainUnit)); LibraryData.FuturamaSys.MainUnits.Remove(mainUnit.DataModel); }
public ExtensionCardViewModel(ExtensionCardModel card, MainUnitViewModel mainUnitViewModel) : base(card) { MainUnitViewModel = mainUnitViewModel; //DrawLines(); //if (card.Flows == null || card.Flows.Count != 5) card.Flows = GenFlows(); //FlowsB = card.Flows.Select(flowModel => new FlowViewModel(flowModel, this)).ToList(); //if (BlockUnits != null) return; //BlockUnits = new List<OverViewData>(); //foreach (var t in FlowsB) //{ // BlockUnits.AddRange(t.GetOverView); //} }
private void AddMainUnit(int id) { if (!LibraryData.SystemIsOpen) { LibraryData.CreateEmptySystem(); } var esc = LibraryData.AddEsc(id); if (esc == null) { return; } var escview = new MainUnitViewModel(esc, this); if (!TabCollection.Contains(escview)) { TabCollection.Add(escview); } }
/// <summary> /// Checks timestamps /// </summary> /// <returns>true in case timestamp does compare</returns> private async Task <List <MainUnitViewModel> > VerifyIntegratyAsync() { var list = new List <MainUnitViewModel>(); foreach (var tab in TabCollection.OfType <MainUnitViewModel>() .Where(model => model.ConnectType != ConnectType.None)) { MainUnitViewModel tab1 = tab; var q = await Task.Run(() => tab1.TimestampIsEqual()); if (q) { continue; //checksum O.K. } list.Add(tab); } return(list); }
public CardViewModel(CardBaseModel card, MainUnitViewModel mainUnitViewModel) : base(card) { MainUnitViewModel = mainUnitViewModel; _card = (CardModel)card; //if (card.Flows == null || card.Flows.Count != 4) card.Flows = GenFlows(mainUnitViewModel.DataModel, Id); //FlowsB = card.Flows.Select(flowModel => new FlowViewModel(flowModel, this)).ToList(); //if (BlockUnits == null) //{ // BlockUnits = new List<OverViewData>(); // foreach (var t in FlowsB) // { // BlockUnits.AddRange(t.GetOverView); // } //} //BlockUnits.Add(new BlAuxiliary(this)); }