/// <summary> /// Начало валидации /// </summary> public void BeginValidation(object parameter = null) { if (parameter is Rekod.Behaviors.CommandEventParameter) { Rekod.Behaviors.CommandEventParameter commEventPar = parameter as Rekod.Behaviors.CommandEventParameter; if (commEventPar.CommandParameter is BindingGroup) { BindingGroup bindGroup = commEventPar.CommandParameter as BindingGroup; bindGroup.BeginEdit(); } } }
/// <summary> /// Обработать ошибки валидации /// </summary> public void ErrorValidation(object parameter = null) { if (parameter is Rekod.Behaviors.CommandEventParameter) { Rekod.Behaviors.CommandEventParameter commEventPar = parameter as Rekod.Behaviors.CommandEventParameter; ValidationErrorEventArgs e = commEventPar.EventArgs as ValidationErrorEventArgs; if (e != null && e.Action == ValidationErrorEventAction.Added) { System.Windows.MessageBox.Show(e.Error.ErrorContent.ToString()); } } }
/// <summary> /// Начало валидации /// </summary> public void BeginValidation(object parameter = null) { if (parameter is Rekod.Behaviors.CommandEventParameter) { Rekod.Behaviors.CommandEventParameter commEventPar = parameter as Rekod.Behaviors.CommandEventParameter; var control = commEventPar.CommandParameter as FrameworkElement; if (control != null) { var bindings = CosmeticDataRepositoryVM.FindBindingGroups(control); foreach (var binding in bindings) { binding.BeginEdit(); } } } }
//public static Type GetTypeFromFullName(string fullClassName) //{ // AssemblyPartCollection parts = System.Deployment.Current.Parts; // foreach (var part in parts) // { // Uri resUri = new Uri(part.Source, UriKind.Relative); // Stream resStream = Application.GetResourceStream(resUri).Stream; // Assembly resAssembly = part.Load(resStream); // Type tryType = resAssembly.GetType(fullClassName, false); // if (tryType != null) // return tryType; // } // return null; //} /// <summary> /// Executes the command /// </summary> public void Execute(Object sender = null, Object eventargs = null) { CommandEventParameter commEventPar = new CommandEventParameter() { CommandParameter = this.CommandParameter, EventArgs = eventargs, EventSender = sender, ExtraParameter = ExtraParameter }; if (Action != null) { Action(commEventPar); } else if (Command != null) { Command.Execute(commEventPar); } }
/// <summary> /// Возможно ли удалить растровый слой /// </summary> /// <param name="newrastrlayerproxy">Слой для которого осуществляется проверка</param> /// <returns></returns> public bool CanDeleteLayer(object commandeventpar = null) { bool result = false; if (commandeventpar is Rekod.Behaviors.CommandEventParameter) { Rekod.Behaviors.CommandEventParameter commPar = commandeventpar as Rekod.Behaviors.CommandEventParameter; commandeventpar = commPar.CommandParameter; } if (commandeventpar is IEnumerable) { ICollection coll = commandeventpar as ICollection; if (coll == null || coll.Count == 0) { result = false; } else { result = true; } } return(result); }