コード例 #1
0
        /// <summary>
        /// Update core data associated with the SDK MNode object
        /// </summary>
        /// <param name="megaNode">Node to update</param>
        /// <param name="externalUpdate">Indicates if is an update external to the app. For example from an `onNodesUpdate`</param>
        public override void Update(MNode megaNode, bool externalUpdate = false)
        {
            base.Update(megaNode, externalUpdate);
            SetFolderInfo();

            if (megaNode.isInShare())
            {
                return;
            }

            OnPropertyChanged(nameof(this.IsOutShare), nameof(this.SharingText));

            if (megaNode.isOutShare())
            {
                if (this.ContactsList == null)
                {
                    this.ContactsList = new ContactsListOutgoingSharedFolderViewModel(megaNode);
                    this.GetContactsList();
                }
            }
            else
            {
                if (this.ContactsList != null)
                {
                    OnUiThread(() => this.ContactsList.ItemCollection.Clear());
                }
            }

            this.DefaultImagePathData = megaNode.isOutShare() ?
                                        ResourceService.VisualResources.GetString("VR_OutgoingSharedFolderPathData") :
                                        ResourceService.VisualResources.GetString("VR_FolderTypePath_default");

            if (!megaNode.getName().ToLower().Equals("camera uploads"))
            {
                return;
            }
            this.DefaultImagePathData = ResourceService.VisualResources.GetString("VR_FolderTypePath_photo");
        }
コード例 #2
0
        public void onNodesUpdate(MegaSDK api, MNodeList nodes)
        {
            // Exit methods when node list is incorrect
            if (nodes == null || nodes.size() < 1)
            {
                return;
            }

            // Retrieve the listsize for performance reasons and store local
            int listSize = nodes.size();

            for (int i = 0; i < listSize; i++)
            {
                try
                {
                    // Get the specific node that has an update. If null exit the method
                    // and process no notification
                    MNode megaNode = nodes.get(i);
                    if (megaNode == null)
                    {
                        return;
                    }

                    // Incoming shared folder
                    if (megaNode.isInShare())
                    {
                        if (megaNode.isRemoved()) // REMOVED Scenario
                        {
                            OnInSharedFolderRemoved(megaNode);
                        }
                        else // ADDED/UPDATED scenarios
                        {
                            OnInSharedFolderAdded(megaNode);
                        }
                    }
                    // Outgoing shared folder - ADDED/UPDATED scenarios
                    else if (megaNode.isOutShare())
                    {
                        OnOutSharedFolderAdded(megaNode);
                    }
                    else
                    {
                        // Outgoing shared folder - REMOVED Scenario
                        if (megaNode.hasChanged((int)MNodeChangeType.CHANGE_TYPE_OUTSHARE))
                        {
                            OnOutSharedFolderRemoved(megaNode);
                        }

                        // Normal node
                        if (megaNode.isRemoved()) // REMOVED Scenario
                        {
                            OnNodeRemoved(megaNode);
                        }
                        else // ADDED/UPDATED scenarions
                        {
                            OnNodeAdded(megaNode);
                        }
                    }
                }
                catch (Exception) { /* Dummy catch, suppress possible exception */ }
            }
        }