public DiskPersistenceLocation(IConfigSectionNode node) : base(node) { DiskPath = node.AttrByName(CONFIG_PATH_ATTR).Value; if (DiskPath.IsNullOrWhiteSpace()) { throw new GDIDException(StringConsts.ARGUMENT_ERROR + "DiskPersistenceLocation(path=null|empty)"); } }
public void Delete(string potName, DiskPath path) { PotDirectory potDirectory = PotDirectory.FromPotName(potName); if (!potDirectory.IsValid) { throw new Exception($"There is no pot with name '{potName}'."); } BlackListFile blackListFile = potDirectory.OpenBlackListFile("bl"); blackListFile.Remove(path); blackListFile.Save(); }
//[Microsoft.Practices.Unity.Dependency] //public ShellViewModel Shell { get; set; } /// <summary> /// Конструктор /// </summary> public ConstructorViewModel(IEventAggregator aggregator, IWindowManager windowManager) { _aggregator = aggregator; _windowManager = windowManager; Properties = new ObservableCollection <WebPageBaseViewModel>(); _rootPanel = new RootPanel(Properties); Properties.Add(_rootPanel); _diskPath = new DiskPath(); _diskPath.Add("SaveProject", new PathDialog("json (*.json)|*.json") { Description = "Сохранить проект" }) .Add("LoadProject", new PathDialog("json (*.json)|*.json") { DefaultPathName = "defaultProjectDir", Description = "Загрузить проект", OpenDialog = true }) .Add("BuildTables", new PathDialog() { IsFolder = true, Description = "Расположение таблицы", Cache = true }) .Add("LoadDocument", new PathDialog("resx(*.docx) | *.docx") { Description = "Загрузить ТЗ", OpenDialog = true }) .Add("BuildProcedures", new PathDialog() { IsFolder = true, Description = "Расположение процедур", Cache = true }) .Add("ViewPage", new PathDialog("resx(*.aspx) | *.aspx") { Description = "Расположение страницы View", Cache = true }) .Add("EditPage", new PathDialog("resx(*.aspx) | *.aspx") { Description = "Расположение страницы Edit", Cache = true }); DisplayName = "Конструктор страницы"; }
public override string Validate() { if (DiskPath.IsNullOrWhiteSpace()) { return("Path is null"); } if (DiskPath.Length > MAX_DISK_PATH_LENGTH) { return("`{0}` is too long".Args(DiskPath.TakeFirstChars(30))); } if (!Directory.Exists(DiskPath)) { return("Path `{0}` does not exist".Args(DiskPath)); } return(null); }
protected override bool IsValid(PropertyValidatorContext context) { DiskPath diskPath = GetDiskPath(context.PropertyValue); return(diskPath.IsEmpty || diskPath.IsValid); }