public virtual void SaveAgentInfo() { try { #region 验证重复 if (string.IsNullOrWhiteSpace(SelectedAgent.vchar_AGname)) { MessageBoxService.ShowMessage("商业伙伴名称不能为空", "提示信息", MessageButton.OK, MessageIcon.Error); return; } if (string.IsNullOrWhiteSpace(SelectedAgent.vchar_AGcontect)) { MessageBoxService.ShowMessage("联系方式不能为空", "提示信息", MessageButton.OK, MessageIcon.Error); return; } if (string.IsNullOrWhiteSpace(SelectedAgent.vchar_AGLinkMan)) { MessageBoxService.ShowMessage("联系人不能为空", "提示信息", MessageButton.OK, MessageIcon.Error); return; } if (string.IsNullOrWhiteSpace(SelectedAgent.vchar_AGcode)) { MessageBoxService.ShowMessage("商业伙伴代码不能为空", "提示信息", MessageButton.OK, MessageIcon.Error); return; } string sqlStr = string.Empty; if (SelectedAgent.bit_synOpen) { if (string.IsNullOrWhiteSpace(SelectedAgent.vchar_synVerify) || string.IsNullOrWhiteSpace(SelectedAgent.vchar_synStopKeyWord)) { MessageBoxService.ShowMessage("检查点同步信息不可为空", "提示信息", MessageButton.OK, MessageIcon.Error); return; } sqlStr = $"SELECT [vchar_AGcode],[vchar_synVerify] FROM [dbo].[tb_Agent] WHERE [vchar_AGcode]='{SelectedAgent.vchar_AGcode}' OR [vchar_synVerify]='{SelectedAgent.vchar_synVerify}'"; IList <Agent> agents = (SQLHelper.GetObject <Agent>(sqlStr)).ToList(); if (agents.Count != 0) { Agent agent = agents.FirstOrDefault(); if (SelectedAgent.vchar_AGcode == agent.vchar_AGcode) { MessageBoxService.ShowMessage("与其他商业伙伴代码重复,请更换", "提示信息", MessageButton.OK, MessageIcon.Error); return; } if (SelectedAgent.vchar_synVerify == agent.vchar_synVerify) { MessageBoxService.ShowMessage("与其他商业伙伴同步接口校验码重复,请更换", "提示信息", MessageButton.OK, MessageIcon.Error); return; } } } if (SelectedAgent.bit_synQuery) { if (string.IsNullOrWhiteSpace(SelectedAgent.vchar_QueryVerify)) { MessageBoxService.ShowMessage("检查点查询信息不可为空", "提示信息", MessageButton.OK, MessageIcon.Error); return; } sqlStr = $"SELECT [vchar_QueryVerify] FROM [dbo].[tb_Agent] WHERE [vchar_QueryVerify]='{SelectedAgent.vchar_QueryVerify}'"; IList <Agent> agents = (SQLHelper.GetObject <Agent>(sqlStr)).ToList(); if (agents.Count != 0) { Agent agent = agents.FirstOrDefault(); if (SelectedAgent.vchar_QueryVerify == agent.vchar_QueryVerify) { MessageBoxService.ShowMessage("与其他商业伙伴查询接口校验码重复,请更换", "提示信息", MessageButton.OK, MessageIcon.Error); return; } } } if (SelectedAgent.bit_synPush) { if (string.IsNullOrWhiteSpace(SelectedAgent.vchar_PushUser) || string.IsNullOrWhiteSpace(SelectedAgent.vchar_PushVerify)) { MessageBoxService.ShowMessage("检查点推送信息不可为空", "提示信息", MessageButton.OK, MessageIcon.Error); return; } sqlStr = $"SELECT [vchar_PushUser],[vchar_PushVerify] FROM [dbo].[tb_Agent] WHERE [vchar_PushUser]='{SelectedAgent.vchar_PushUser}' OR [vchar_PushVerify]='{SelectedAgent.vchar_PushVerify}'"; IList <Agent> agents = (SQLHelper.GetObject <Agent>(sqlStr)).ToList(); if (agents.Count != 0) { Agent agent = agents.FirstOrDefault(); if (SelectedAgent.vchar_PushUser == agent.vchar_PushUser) { MessageBoxService.ShowMessage("与其他商业伙伴推送接口用户重复,请更换", "提示信息", MessageButton.OK, MessageIcon.Error); return; } if (SelectedAgent.vchar_PushVerify == agent.vchar_PushVerify) { MessageBoxService.ShowMessage("与其他商业伙伴推送接口校验码重复,请更换", "提示信息", MessageButton.OK, MessageIcon.Error); return; } } } #endregion #region 插入数据 SplashScreenService.ShowSplashScreen(); if (SelectedAgent.int_AGid == 0) { if (SelectedAgent.int_AGtype == "检查点提供方") { sqlStr = $"INSERT INTO tb_Agent (vchar_AGcode, vchar_AGname, vchar_AGLinkMan, vchar_AGcontect, int_AGtype, bit_synOpen, vchar_synVerify,vchar_synStopKeyWord,int_synSpacing)VALUES ('{SelectedAgent.vchar_AGcode}', N'{SelectedAgent.vchar_AGname}', N'{SelectedAgent.vchar_AGLinkMan}', '{SelectedAgent.vchar_AGcontect}', 0, {(SelectedAgent.bit_synOpen ? 1 : 0)}, '{SelectedAgent.vchar_synVerify}', N'{SelectedAgent.vchar_synStopKeyWord}',{SelectedAgent.int_synSpacing}) "; } else if (SelectedAgent.int_AGtype == "检查点查询方") { sqlStr = $"INSERT INTO tb_Agent(vchar_AGcode, vchar_AGname, vchar_AGLinkMan, vchar_AGcontect, int_AGtype, bit_synQuery, vchar_QueryVerify)VALUES ('{SelectedAgent.vchar_AGcode}', N'{SelectedAgent.vchar_AGname}',N'{SelectedAgent.vchar_AGLinkMan}', '{SelectedAgent.vchar_AGcontect}', 1, {(SelectedAgent.bit_synQuery ? 1 : 0)}, '{SelectedAgent.vchar_QueryVerify}') "; } else if (SelectedAgent.int_AGtype == "检查点推送接收方") { sqlStr = $"INSERT INTO tb_Agent(vchar_AGcode, vchar_AGname, vchar_AGLinkMan, vchar_AGcontect, int_AGtype,bit_synPush, vchar_PushUser, vchar_PushVerify) VALUES ('{SelectedAgent.vchar_AGcode}', N'{SelectedAgent.vchar_AGname}', N'{SelectedAgent.vchar_AGLinkMan}', '{SelectedAgent.vchar_AGcontect}', 2, {(SelectedAgent.bit_synPush ? 1 : 0)}, '{SelectedAgent.vchar_PushUser}', '{SelectedAgent.vchar_PushVerify}') "; } if (SQLHelper.UpDateSQL(sqlStr)) { MessageBoxService.ShowMessage("保存成功", "提示信息", MessageButton.OK, MessageIcon.Information); } else { MessageBoxService.ShowMessage("保存失败", "提示信息", MessageButton.OK, MessageIcon.Error); } Agents.Add(SelectedAgent); } else { if (SelectedAgent.int_AGtype == "检查点提供方") { sqlStr = $"UPDATE tb_Agent SET vchar_AGcode = '{SelectedAgent.vchar_AGcode}', vchar_AGname = N'{SelectedAgent.vchar_AGname}', vchar_AGLinkMan = N'{SelectedAgent.vchar_AGLinkMan}', vchar_AGcontect = '{SelectedAgent.vchar_AGcontect}',int_AGtype = 0, bit_synOpen = {(SelectedAgent.bit_synOpen ? 1 : 0)}, vchar_synVerify = '{SelectedAgent.vchar_synVerify}', vchar_synStopKeyWord = N'{SelectedAgent.vchar_synStopKeyWord}', bit_synQuery = 0,vchar_QueryVerify = NULL, bit_synPush = 0, vchar_PushUser = NULL, vchar_PushVerify = NULL,int_synSpacing= {SelectedAgent.int_synSpacing} WHERE [int_AGid]={SelectedAgent.int_AGid}"; } else if (SelectedAgent.int_AGtype == "检查点查询方") { sqlStr = $"UPDATE tb_Agent SET vchar_AGcode = '{SelectedAgent.vchar_AGcode}', vchar_AGname = N'{SelectedAgent.vchar_AGname}', vchar_AGLinkMan = N'{SelectedAgent.vchar_AGLinkMan}', vchar_AGcontect = '{SelectedAgent.vchar_AGcontect}', int_AGtype = 1, bit_synOpen = 0, vchar_synVerify = NULL, vchar_synStopKeyWord = NULL, bit_synQuery = {(SelectedAgent.bit_synQuery ? 1 : 0)}, vchar_QueryVerify = '{SelectedAgent.vchar_QueryVerify}', bit_synPush = 0, vchar_PushUser = NULL, vchar_PushVerify = NULL WHERE [int_AGid]={SelectedAgent.int_AGid}"; } else if (SelectedAgent.int_AGtype == "检查点推送接收方") { sqlStr = $"UPDATE tb_Agent SET vchar_AGcode ='{SelectedAgent.vchar_AGcode}', vchar_AGname = N'{SelectedAgent.vchar_AGname}', vchar_AGLinkMan = N'{SelectedAgent.vchar_AGLinkMan}', vchar_AGcontect ='{SelectedAgent.vchar_AGcontect}',int_AGtype =2, bit_synOpen = 0, vchar_synVerify = NULL, vchar_synStopKeyWord = NULL, bit_synQuery = 0, vchar_QueryVerify = NULL, bit_synPush = {(SelectedAgent.bit_synPush ? 1 : 0)}, vchar_PushUser = '******', vchar_PushVerify = '{SelectedAgent.vchar_PushVerify}' WHERE [int_AGid]={SelectedAgent.int_AGid}"; } if (SQLHelper.UpDateSQL(sqlStr)) { MessageBoxService.ShowMessage("保存成功", "提示信息", MessageButton.OK, MessageIcon.Information); } else { MessageBoxService.ShowMessage("保存失败", "提示信息", MessageButton.OK, MessageIcon.Error); } var item = Agents.FirstOrDefault(a => a.int_AGid == SelectedAgent.int_AGid); if (item != null) { item = SelectedAgent; } } SplashScreenService.HideSplashScreen(); #endregion } catch (Exception ex) { SplashScreenService.HideSplashScreen(); MessageBoxService.ShowMessage($"保存失败:{ex.Message}", "提示信息", MessageButton.OK, MessageIcon.Error); } }
public override void Delete(QuoteInfo projectionEntity) { MessageBoxService.ShowMessage("To ensure data integrity, the Opportunities module doesn't allow records to be deleted. Record deletion is supported by the Employees module.", "Delete Opportunity", MessageButton.OK); }
private void UpdateAndSave() { string LastMessage; try { if (_erpconnect != null) { _erpconnect.SERWER = _serwer; _erpconnect.BAZA = _katalogbazy; _erpconnect.UZYTKOWNIK = _uzytkownik; _erpconnect.HASLO = _haslo; _erpconnect.KARTIDGRUPA = IdGrKart; _erpconnect.KARTIDRODZ = IdGrKartRodz; _erpconnect.KONTRAHIDGRUPA = IdGrKontrah; if (KartRodz) { _erpconnect.KARTRODZ = 1; } else { _erpconnect.KARTRODZ = 0; } if (KartGrupa) { _erpconnect.KARTGRUPA = 1; } else { _erpconnect.KARTGRUPA = 0; } if (KartAll) { _erpconnect.KARTWSZYSTKO = 1; } else { _erpconnect.KARTWSZYSTKO = 0; } if (KontrahAll) { _erpconnect.KONTRAHWSZYSTKO = 1; } else { _erpconnect.KONTRAHWSZYSTKO = 0; } if (KontrahGrupa) { _erpconnect.KONTRAHGRUPA = 1; } else { _erpconnect.KONTRAHGRUPA = 0; } if (KartCenniki) { _erpconnect.KARTCENNIKI = 1; } else { _erpconnect.KARTCENNIKI = 0; } if (DockDirect) { _erpconnect.DOKBEZPOSR = 1; } else { _erpconnect.DOKBEZPOSR = 0; } if (DokDoWyst != null) { _erpconnect.ID_DEFDOK = DokDoWyst.Id; } context.IHP_ERPCONNECTOR.Attach(_erpconnect); context.Entry(_erpconnect).State = EntityState.Modified; context.SaveChanges(); MessageBoxService.ShowMessage("Dane Zapisane"); } } catch (DbEntityValidationException ex) { // Retrieve the error messages as a list of strings. var errorMessages = ex.EntityValidationErrors .SelectMany(x => x.ValidationErrors) .Select(x => x.ErrorMessage); // Join the list to a single string. var fullErrorMessage = string.Join("; ", errorMessages); // Combine the original exception message with the new one. var exceptionMessage = string.Concat(ex.Message, " The validation errors are: ", fullErrorMessage); MessageBox.Show("Wystąpiły błędy przy zapisaniu danych!!!" + System.Environment.NewLine + exceptionMessage); LogManager.WriteLogMessage(LogManager.LogType.Error, exceptionMessage.ToString()); // Throw a new DbEntityValidationException with the improved exception message. throw new DbEntityValidationException(exceptionMessage, ex.EntityValidationErrors); } }
public MainViewModel() { Items = new ObservableCollection <ButtonViewModel>() { new ButtonViewModel() { Content = "A", Command = new DelegateCommand(() => { MessageBoxService.ShowMessage("A"); }), IsLeft = true, }, new ButtonViewModel() { Content = "B", Command = new DelegateCommand(() => { MessageBoxService.ShowMessage("B"); }), IsLeft = true, }, new ButtonViewModel() { Content = "C", Command = new DelegateCommand(() => { MessageBoxService.ShowMessage("C"); }), IsLeft = true, }, new ButtonViewModel() { Content = "X", Command = new DelegateCommand(() => { MessageBoxService.ShowMessage("X"); }), }, new ButtonViewModel() { Content = "Y", Command = new DelegateCommand(() => { MessageBoxService.ShowMessage("Y"); }), }, new ButtonViewModel() { Content = "Z", Command = new DelegateCommand(() => { MessageBoxService.ShowMessage("Z"); }), }, new ButtonViewModel() { Content = "Clear", Command = new DelegateCommand(() => { this.Items.Clear(); Items = new ObservableCollection <ButtonViewModel>(Items); }), }, new ButtonViewModel() { Content = "Add", Command = new DelegateCommand(() => { Items.Add(new ButtonViewModel() { Content = "New", IsLeft = this.Items.Count % 2 == 0 }); Items = new ObservableCollection <ButtonViewModel>(Items); }), }, }; }
void ShowProductEditForm() { MessageBoxService.ShowMessage(@"You can easily create custom edit forms using the 40+ controls that ship as part of the DevExpress Data Editors Library. To see what you can build, activate the Employees module.", "Edit Opportunities", MessageButton.OK, MessageIcon.Asterisk, MessageResult.OK); }
public override void Delete() { MessageBoxService.ShowMessage("To ensure data integrity, the Products module doesn't allow records to be deleted. Record deletion is supported by the Employees module.", "Delete Product", MessageButton.OK); }
private void ShowError(Exception ex) { MessageBoxService.ShowMessage(messageBoxText: ex.Message, caption: "Error", button: MessageButton.OK, icon: MessageIcon.Error); _logger.Error(ex.Message, ex); }
/// <summary> /// Approves an entity. /// Since CollectionViewModelBase is a POCO view model, an the instance of this class will also expose the ApproveCommand property that can be used as a binding source in views. /// </summary> /// <param name="projectionEntity">An entity to approve.</param> public void Approve(VARIATION entity) { string errorMessage = string.Empty; if (entity == null) { errorMessage = "Nothing within variation to approve"; } else if (loadPROJECT == null) { errorMessage = "Project doesn't exists"; } else if (loadBASELINE == null) { errorMessage = "Live baseline doesn't exists"; } else if (loadPROGRESS == null) { errorMessage = "Live progress doesn't exists"; } if (errorMessage != string.Empty) { MessageBoxService.ShowMessage(errorMessage); return; } IBluePrintsEntitiesUnitOfWork unitOfWork = bluePrintsUnitOfWorkFactory.CreateUnitOfWork(); BASELINE LiveBASELINE = loadBASELINE; IEnumerable <VARIATION_ITEM> editVARIATION_ITEMS = unitOfWork.VARIATION_ITEMS.Where(x => x.GUID_VARIATION == entity.GUID).ToArray().AsEnumerable(); IEnumerable <BASELINE_ITEM> addBASELINE_ITEMS = unitOfWork.BASELINE_ITEMS.Where(x => x.GUID_VARIATION == entity.GUID && x.GUID_BASELINE == null).ToArray().AsEnumerable(); IQueryable <BASELINE_ITEM> editBASELINE_ITEMS = loaderCollection.GetCollection <BASELINE_ITEM>(); IEnumerable <PROGRESS_ITEM> livePROGRESS_ITEMS = loaderCollection.GetCollection <PROGRESS_ITEM>(); BASELINE newBASELINE = new BASELINE(); DataUtils.ShallowCopy(newBASELINE, LiveBASELINE); newBASELINE.GUID = Guid.Empty; newBASELINE.REVISION = ((char)(LiveBASELINE.REVISION.Last() + 1)).ToString(); //not saving new baseline as live yet because editBASELINE_ITEMS still depends on the current live baseline for copying BASELINE_ITEMS newBASELINE.STATUS = BaselineStatus.Superseded; CollectionViewModel <BASELINE, BASELINE, Guid, IBluePrintsEntitiesUnitOfWork> BASELINECollectionViewModel = (CollectionViewModel <BASELINE, BASELINE, Guid, IBluePrintsEntitiesUnitOfWork>)loaderCollection.GetViewModel <BASELINE>(); CollectionViewModel <BASELINE_ITEM, BASELINE_ITEM, Guid, IBluePrintsEntitiesUnitOfWork> BASELINE_ITEMCollectionViewModel = (CollectionViewModel <BASELINE_ITEM, BASELINE_ITEM, Guid, IBluePrintsEntitiesUnitOfWork>)loaderCollection.GetViewModel <BASELINE_ITEM>(); BASELINECollectionViewModel.Save(newBASELINE); entity.APPROVED = DateTime.Now; entity.GUID_ORIBASELINE = LiveBASELINE.GUID; entity.GUID_BASELINE = newBASELINE.GUID; MainViewModel.Save(entity); ObservableCollection <BASELINE_ITEM> newBASELINE_ITEMS = new ObservableCollection <BASELINE_ITEM>(); foreach (BASELINE_ITEM editBASELINE_ITEM in editBASELINE_ITEMS) { BASELINE_ITEM copyBASELINE_ITEM = new BASELINE_ITEM(); DataUtils.ShallowCopy(copyBASELINE_ITEM, editBASELINE_ITEM); VARIATION_ITEM editVARIATION_ITEM = editVARIATION_ITEMS.FirstOrDefault(x => x.GUID_ORIBASEITEM == editBASELINE_ITEM.GUID_ORIGINAL); if (editVARIATION_ITEM != null) { if (editVARIATION_ITEM.ACTION == VariationAction.Cancel) { decimal progressItemEARNED_UNITS = livePROGRESS_ITEMS.Where(x => x.GUID_ORIBASEITEM == editBASELINE_ITEM.GUID_ORIGINAL).Sum(y => y.EARNED_UNITS); if (progressItemEARNED_UNITS == 0) { copyBASELINE_ITEM.DC_HOURS = -1 * copyBASELINE_ITEM.ESTIMATED_HOURS; } else { copyBASELINE_ITEM.DC_HOURS = -1 * (copyBASELINE_ITEM.TOTAL_HOURS - progressItemEARNED_UNITS); } } else if (editVARIATION_ITEM.ACTION == VariationAction.Append) { copyBASELINE_ITEM.DC_HOURS += editVARIATION_ITEM.VARIATION_UNITS; } if (editVARIATION_ITEM.ACTION != VariationAction.NoAction) { copyBASELINE_ITEM.GUID_VARIATION = entity.GUID; } } copyBASELINE_ITEM.GUID = Guid.Empty; copyBASELINE_ITEM.GUID_BASELINE = newBASELINE.GUID; newBASELINE_ITEMS.Add(copyBASELINE_ITEM); } foreach (BASELINE_ITEM addBASELINE_ITEM in addBASELINE_ITEMS) { BASELINE_ITEM newBASELINE_ITEM = new BASELINE_ITEM(); DataUtils.ShallowCopy(newBASELINE_ITEM, addBASELINE_ITEM); newBASELINE_ITEM.GUID = Guid.Empty; newBASELINE_ITEM.GUID_BASELINE = newBASELINE.GUID; newBASELINE_ITEM.INTERNAL_NUM = BluePrintDataUtils.BASELINEITEM_Generate_InternalNumber(this.loadPROJECT, newBASELINE_ITEM, newBASELINE_ITEMS, addBASELINE_ITEM.AREA, addBASELINE_ITEM.DISCIPLINE, addBASELINE_ITEM.DOCTYPE); VARIATION_ITEM editVARIATION_ITEM = editVARIATION_ITEMS.First(x => x.GUID_ORIBASEITEM == newBASELINE_ITEM.GUID_ORIGINAL); newBASELINE_ITEM.DC_HOURS = editVARIATION_ITEM.VARIATION_UNITS; newBASELINE_ITEM.GUID_VARIATION = entity.GUID; newBASELINE_ITEMS.Add(newBASELINE_ITEM); } foreach (BASELINE_ITEM newBASELINE_ITEM in newBASELINE_ITEMS) { BASELINE_ITEMCollectionViewModel.Save(newBASELINE_ITEM); } LiveBASELINE.STATUS = BaselineStatus.Superseded; BASELINECollectionViewModel.Save(LiveBASELINE); newBASELINE.STATUS = BaselineStatus.Live; BASELINECollectionViewModel.Save(newBASELINE); }
/// <summary> /// Creates a new dialog window that allows the user to find an item. /// </summary> /// <param name="itemType">The type of item is bound to the the tab the user is on (i.e searching from the movie tab returns a movie).</param> public void FindItem(InventoryItemType itemType) { // Try to resolve FindItemViewModel. if (!(App.ServiceProvider.GetService(typeof(FindItemViewModel)) is FindItemViewModel viewModel)) { return; } // Create a new button that finds the item. UICommand findItemCommand = new UICommand() { Caption = "Search", IsDefault = true, // Only allow the user to find an item if there are no errors in the data entry. Command = new DelegateCommand( () => { }, () => !string.IsNullOrWhiteSpace(viewModel.Title) && !string.IsNullOrWhiteSpace(viewModel.Platform) ) }; // Create a new button that cancels and closes the dialog window for finding an item. UICommand cancelCommand = new UICommand() { Caption = "Cancel", IsCancel = true, }; // Display the dialog window. UICommand result = FindItemDialogService?.ShowDialog( dialogCommands: new[] { findItemCommand, cancelCommand }, title: "Find an Item", viewModel: viewModel ); // Check if the user executed the find command (clicked the find button). if (result != findItemCommand) { return; } // Switch based on the tab the user is on. switch (itemType) { case InventoryItemType.Book: // Return the first item that has the requested title and platform of the inventory item. FocusedItemModel = BookModels.FirstOrDefault(x => string.Equals(x.Title, viewModel.Title, StringComparison.InvariantCultureIgnoreCase) && string.Equals(x.Platform, viewModel.Platform, StringComparison.InvariantCultureIgnoreCase)); break; case InventoryItemType.Movie: FocusedItemModel = MovieModels.FirstOrDefault(x => string.Equals(x.Title, viewModel.Title, StringComparison.InvariantCultureIgnoreCase) && string.Equals(x.Platform, viewModel.Platform, StringComparison.InvariantCultureIgnoreCase)); break; case InventoryItemType.VideoGame: FocusedItemModel = VideoGameModels.FirstOrDefault(x => string.Equals(x.Title, viewModel.Title, StringComparison.InvariantCultureIgnoreCase) && string.Equals(x.Platform, viewModel.Platform, StringComparison.InvariantCultureIgnoreCase)); break; // Throw an exception if our item type does not match any of the models. default: throw new ArgumentOutOfRangeException(); } // If a model was not found, display a new message box indicating so to the user. if (FocusedItemModel == null) { MessageBoxService?.ShowMessage($"Could not find \"{viewModel.Title}\" on \"{viewModel.Platform}\""); } }
private void ReadConfigFromFile() { OpenFileDialog dlg = new OpenFileDialog(); dlg.DefaultExt = ".conf"; dlg.Filter = "Config files (*.conf)|*.conf|All files (*.*)|*.*"; Nullable <bool> result = dlg.ShowDialog(); if (result == true) { { // TODO: fix serialization DeviceConfig tmp = DeSerializeObject <DeviceConfig>(dlg.FileName); if (tmp != null && (tmp.FirmwareVersion & 0xFFF0) != (Config.FirmwareVersion & 0xFFF0)) { MessageBoxService mbs = new MessageBoxService(); mbs.ShowMessage("Config file is broken or was created in other version of configurator!\r\n" + "Configuration loading will be canceled", "Error"); return; } while (tmp.PinConfig.Count > 30) { tmp.PinConfig.RemoveAt(0); } while (tmp.AxisConfig.Count > 8) { tmp.AxisConfig.RemoveAt(0); } for (int i = 0; i < 8; i++) { while (tmp.AxisConfig[i].CurveShape.Count > 11) { tmp.AxisConfig[i].CurveShape.RemoveAt(0); } } while (tmp.ShiftModificatorConfig.Count > 5) { tmp.ShiftModificatorConfig.RemoveAt(0); } while (tmp.ButtonConfig.Count > 128) { tmp.ButtonConfig.RemoveAt(0); } while (tmp.AxisToButtonsConfig.Count > 8) { tmp.AxisToButtonsConfig.RemoveAt(0); } for (int i = 0; i < 8; i++) { while (tmp.AxisToButtonsConfig[i].Points.Count > 13) { tmp.AxisToButtonsConfig[i].Points.RemoveAt(0); } } while (tmp.ShiftRegistersConfig.Count > 4) { tmp.ShiftRegistersConfig.RemoveAt(0); } tmp.DeviceName = tmp.DeviceName.TrimEnd('\0'); Config = tmp; } PinsVM.Config = Config; AxesVM.Config = Config; ButtonsVM.Config = Config; PinsVM.Update(Config); ButtonsVM.Update(Config); AxesVM.Update(Config); AxesToButtonsVM.Update(Config); ShiftRegistersVM.Update(Config); } }