Exemple #1
0
 // Currently not used; the shares edit workflow is started from the shares info screen calling EditCurrentShare.
 public void EditSelectedShare()
 {
     try
     {
         Share share = GetSelectedLocalShares().FirstOrDefault();
         if (share != null)
         {
             lock (_syncObj)
                 _shareProxy = new LocalShares(share);
         }
         else
         {
             share = GetSelectedServerShares().FirstOrDefault();
             if (share == null)
             {
                 // Should never happen
                 return;
             }
             lock (_syncObj)
                 _shareProxy = new ServerShares(share);
         }
         IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>();
         workflowManager.NavigatePush(Consts.WF_STATE_ID_SHARE_EDIT_CHOOSE_RESOURCE_PROVIDER);
     }
     catch (NotConnectedException)
     {
         DisconnectedError();
     }
     catch (Exception e)
     {
         ErrorEditShare(e);
     }
 }
Exemple #2
0
        public void NavigateBackToOverview()
        {
            lock (_syncObj)
                _shareProxy = null;
            IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>();

            workflowManager.NavigatePopToState(Consts.WF_STATE_ID_SHARES_OVERVIEW, false);
        }
Exemple #3
0
 protected void ClearData()
 {
     lock (_syncObj)
     {
         _shareProxy       = null;
         _localSharesList  = null;
         _serverSharesList = null;
         _systemsList      = null;
     }
 }
        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();
        }
        private void UpdateProviderSelected()
        {
            bool anySelected = false;

            foreach (ListItem systemItem in _systemsList)
            {
                SharesProxy sharesProxy = ((SharesProxy)systemItem.AdditionalProperties[Consts.KEY_SHARES_PROXY]);
                if (sharesProxy.IsResourceProviderSelected)
                {
                    ShareProxy  = sharesProxy;
                    anySelected = true;
                    break;
                }
            }
            IsResourceProviderSelected = anySelected;
        }
Exemple #6
0
 void OnSystemSelectionChanged(AbstractProperty prop, object oldVal)
 {
     foreach (ListItem systemItem in _systemsList)
     {
         if (systemItem.Selected)
         {
             lock (_syncObj)
                 _shareProxy = (SharesProxy)systemItem.AdditionalProperties[Consts.KEY_SHARES_PROXY];
             IsSystemSelected = true;
             return;
         }
     }
     lock (_syncObj)
         _shareProxy = null;
     IsSystemSelected = false;
 }
Exemple #7
0
        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 ClearData()
 {
   lock (_syncObj)
   {
     _shareProxy = null;
     _localSharesList = null;
     _serverSharesList = null;
     _systemsList = null;
   }
 }
 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 });
 }
 public void NavigateBackToOverview()
 {
   lock (_syncObj)
     _shareProxy = null;
   IWorkflowManager workflowManager = ServiceRegistration.Get<IWorkflowManager>();
   workflowManager.NavigatePopToState(Consts.WF_STATE_ID_SHARES_OVERVIEW, false);
 }
 // Currently not used; the shares edit workflow is started from the shares info screen calling EditCurrentShare.
 public void EditSelectedShare()
 {
   try
   {
     Share share = GetSelectedLocalShares().FirstOrDefault();
     if (share != null)
       lock (_syncObj)
         _shareProxy = new LocalShares(share);
     else
     {
       share = GetSelectedServerShares().FirstOrDefault();
       if (share == null)
         // Should never happen
         return;
       lock (_syncObj)
         _shareProxy = new ServerShares(share);
     }
     IWorkflowManager workflowManager = ServiceRegistration.Get<IWorkflowManager>();
     workflowManager.NavigatePush(Consts.WF_STATE_ID_SHARE_EDIT_CHOOSE_RESOURCE_PROVIDER);
   }
   catch (NotConnectedException)
   {
     DisconnectedError();
   }
   catch (Exception e)
   {
     ErrorEditShare(e);
   }
 }
 void OnSystemSelectionChanged(AbstractProperty prop, object oldVal)
 {
   foreach (ListItem systemItem in _systemsList)
     if (systemItem.Selected)
     {
       lock (_syncObj)
         _shareProxy = (SharesProxy) systemItem.AdditionalProperties[Consts.KEY_SHARES_PROXY];
       IsSystemSelected = true;
       return;
     }
   lock (_syncObj)
     _shareProxy = null;
   IsSystemSelected = false;
 }
 public void Dispose()
 {
   _shareProxy = null;
   _serverSharesList = null;
   _localSharesList = null;
 }
Exemple #14
0
 public ExpansionHelper(TreeItem directoryItem, SharesProxy parent)
 {
     _parent        = parent;
     _directoryItem = directoryItem;
     _isExpandedProperty.Attach(OnExpandedChanged);
 }
Exemple #15
0
 public ExpansionHelper(TreeItem directoryItem, SharesProxy parent)
 {
   _parent = parent;
   _directoryItem = directoryItem;
   _isExpandedProperty.Attach(OnExpandedChanged);
 }
Exemple #16
0
 public void Dispose()
 {
     _shareProxy       = null;
     _serverSharesList = null;
     _localSharesList  = null;
 }