private void Reload() { context.ItemsSource = WindowsHost .GetList() .OrderBy(it => it.Domain) .Select(it => new ListViewItemViewModel { Id = it.Domain, Title = it.Domain.ToUpper(), Tooltip = it.Domain, SubTitle = it.IpAddress, SubTooltip = it.IpAddress, Icons = new List <IconButton> { new IconButton { Icon = "delete-btn", Context = it, Command = new DelegateCommand <HostRecord>(record => { if (MessageBoxResult.Yes == MessageBox.Show(Data.Language.Hardcoded.GetValue("Are you sure you want to delete this item?"), Data.Language.Hardcoded.GetValue("Confirm"), MessageBoxButton.YesNo, MessageBoxImage.Asterisk)) { WindowsHost.Delete(record.Domain); this.Redirect(new HostPage()); } }) } } }); DataContext = context; }
public override void Delete(Guid id) { base.Delete(id); var find = LocalCache.GetValueOrDefault(id); if (find != null) { LocalCache.Remove(id); if (!AppSettings.IsOnlineServer) { WindowsHost.Delete(find.FullName); } } }
public bool Delete(Domain Domain) { try { var records = WindowsHost.GetList().Where(it => it.Domain.EndsWith(Domain.DomainName)); foreach (var item in records) { WindowsHost.Delete(item.Domain); var domainid = IDGenerator.GetDomainId(item.Domain); this.domainstore.Delete(domainid); } var id = IDGenerator.GetDomainId(Domain.DomainName); this.domainstore.Delete(id); return(true); } catch (Exception) { return(false); } }