protected void ShowShareInfo(Share share, ShareOrigin origin) { if (share == null) { return; } if (origin == ShareOrigin.Local) { ShareProxy = new LocalShares(share); } else if (origin == ShareOrigin.Server) { ShareProxy = new ServerShares(share); } IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); workflowManager.NavigatePush(Consts.WF_STATE_ID_SHARE_INFO, new NavigationContextConfig { NavigationContextDisplayLabel = share.Name }); }
protected void ShowShareInfo(Share share, ShareOrigin origin) { if (share == null) return; if (origin == ShareOrigin.Local) lock (_syncObj) _shareProxy = new LocalShares(share); else if (origin == ShareOrigin.Server) lock (_syncObj) _shareProxy = new ServerShares(share); IWorkflowManager workflowManager = ServiceRegistration.Get<IWorkflowManager>(); workflowManager.NavigatePush(Consts.WF_STATE_ID_SHARE_INFO, new NavigationContextConfig { NavigationContextDisplayLabel = share.Name }); }
protected void UpdateSharesList_NoLock(ItemsList list, List<Share> shareDescriptors, ShareOrigin origin, bool selectFirstItem) { list.Clear(); bool selectShare = selectFirstItem; shareDescriptors.Sort((a, b) => a.Name.CompareTo(b.Name)); foreach (Share share in shareDescriptors) { ListItem shareItem = new ListItem(Consts.KEY_NAME, share.Name); shareItem.AdditionalProperties[Consts.KEY_SHARE] = share; try { string path = origin == ShareOrigin.Local ? LocalShares.GetLocalResourcePathDisplayName(share.BaseResourcePath) : ServerShares.GetServerResourcePathDisplayName(share.BaseResourcePath); if (string.IsNullOrEmpty(path)) // Error case: The path is invalid path = LocalizationHelper.Translate(Consts.RES_INVALID_PATH, share.BaseResourcePath); shareItem.SetLabel(Consts.KEY_PATH, path); Guid? firstResourceProviderId = SharesProxy.GetBaseResourceProviderId(share.BaseResourcePath); if (firstResourceProviderId.HasValue) { ResourceProviderMetadata firstResourceProviderMetadata = origin == ShareOrigin.Local ? LocalShares.GetLocalResourceProviderMetadata(firstResourceProviderId.Value) : ServerShares.GetServerResourceProviderMetadata(firstResourceProviderId.Value); shareItem.AdditionalProperties[Consts.KEY_RESOURCE_PROVIDER_METADATA] = firstResourceProviderMetadata; } string categories = StringUtils.Join(", ", share.MediaCategories); shareItem.SetLabel(Consts.KEY_MEDIA_CATEGORIES, categories); Share shareCopy = share; shareItem.Command = new MethodDelegateCommand(() => ShowShareInfo(shareCopy, origin)); } catch (NotConnectedException) { throw; } catch (Exception e) { ServiceRegistration.Get<ILogger>().Warn("Problems building share item '{0}' (path '{1}')", e, share.Name, share.BaseResourcePath); } if (selectShare) { selectShare = false; shareItem.Selected = true; } shareItem.SelectedProperty.Attach(OnShareItemSelectionChanged); lock (_syncObj) list.Add(shareItem); } list.FireChange(); }
protected void UpdateSharesList_NoLock(ItemsList list, List <Share> shareDescriptors, ShareOrigin origin, bool selectFirstItem) { list.Clear(); bool selectShare = selectFirstItem; shareDescriptors.Sort((a, b) => a.Name.CompareTo(b.Name)); foreach (Share share in shareDescriptors) { ListItem shareItem = new ListItem(Consts.KEY_NAME, share.Name); shareItem.AdditionalProperties[Consts.KEY_SHARE] = share; try { string path = origin == ShareOrigin.Local ? LocalShares.GetLocalResourcePathDisplayName(share.BaseResourcePath) : ServerShares.GetServerResourcePathDisplayName(share.BaseResourcePath); if (string.IsNullOrEmpty(path)) { // Error case: The path is invalid path = LocalizationHelper.Translate(Consts.RES_INVALID_PATH, share.BaseResourcePath); } shareItem.SetLabel(Consts.KEY_PATH, path); Guid?firstResourceProviderId = SharesProxy.GetBaseResourceProviderId(share.BaseResourcePath); if (firstResourceProviderId.HasValue) { ResourceProviderMetadata firstResourceProviderMetadata = origin == ShareOrigin.Local ? LocalShares.GetLocalResourceProviderMetadata(firstResourceProviderId.Value) : ServerShares.GetServerResourceProviderMetadata(firstResourceProviderId.Value); shareItem.AdditionalProperties[Consts.KEY_RESOURCE_PROVIDER_METADATA] = firstResourceProviderMetadata; } string categories = StringUtils.Join(", ", share.MediaCategories); shareItem.SetLabel(Consts.KEY_MEDIA_CATEGORIES, categories); Share shareCopy = share; shareItem.Command = new MethodDelegateCommand(() => ShowShareInfo(shareCopy, origin)); } catch (NotConnectedException) { throw; } catch (Exception e) { ServiceRegistration.Get <ILogger>().Warn("Problems building share item '{0}' (path '{1}')", e, share.Name, share.BaseResourcePath); } if (selectShare) { selectShare = false; shareItem.Selected = true; } shareItem.SelectedProperty.Attach(OnShareItemSelectionChanged); lock (_syncObj) list.Add(shareItem); } list.FireChange(); }