Esempio n. 1
0
        /// <summary>
        /// Prepare multiple offline files to share with other app.
        /// </summary>
        /// <returns>Boolean value indicating if all went well or not.</returns>
        public async Task <bool> MultipleShare()
        {
            int count = ChildNodes.Count(n => n.IsMultiSelected);

            if (count < 1)
            {
                return(false);
            }

            List <StorageFile> storageItems = new List <StorageFile>(count);

            foreach (var node in ChildNodes.Where(n => n.IsMultiSelected))
            {
                if (node == null || node.IsFolder)
                {
                    continue;
                }

                StorageFile selectedNode = await StorageFile.GetFileFromPathAsync(node.NodePath);

                storageItems.Add(selectedNode);
            }

            if (storageItems == null || storageItems.Count < 1)
            {
                return(false);
            }

            DialogService.ShowShareMediaTask(storageItems);

            this.IsMultiSelectActive = false;

            return(true);
        }
Esempio n. 2
0
 public override void CollectDataFromChildren()
 {
     if (ChildNodes.Count() > 0)
     {
         UnionKindOpt = ParseEnum <UnionKind>((ChildNodes.First <ISqlNode>() as SqlKeyNode).Text);
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Prepare multiple offline files to share with other app.
        /// </summary>
        /// <returns>Boolean value indicating if all went well or not.</returns>
        public async Task <bool> MultipleShare()
        {
            try
            {
                int count = ChildNodes.Count(n => n.IsMultiSelected);
                if (count < 1)
                {
                    LogService.Log(MLogLevel.LOG_LEVEL_INFO, "No items selected for share.");
                    return(false);
                }

                List <StorageFile> storageItems = new List <StorageFile>(count);
                if (storageItems == null)
                {
                    throw new ArgumentNullException("storageItems", "Error creating the selected items list for share.");
                }

                foreach (var node in ChildNodes.Where(n => n.IsMultiSelected))
                {
                    if (node == null || node.IsFolder)
                    {
                        continue;
                    }

                    StorageFile selectedNode = await StorageFile.GetFileFromPathAsync(node.NodePath);

                    storageItems.Add(selectedNode);
                }

                if (storageItems.Count < 1)
                {
                    LogService.Log(MLogLevel.LOG_LEVEL_INFO, "No items selected for share.");
                    return(false);
                }

                DialogService.ShowShareMediaTask(storageItems);

                this.IsMultiSelectActive = false;

                return(true);
            }
            catch (Exception e)
            {
                LogService.Log(MLogLevel.LOG_LEVEL_ERROR, "Failed to share items from MEGA.", e);

                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    new CustomMessageDialog(
                        AppMessages.AM_ShareFromMegaFailed_Title.ToUpper(),
                        AppMessages.AM_ShareFromMegaFailed_Message,
                        App.AppInformation,
                        MessageDialogButtons.Ok).ShowDialog();
                });

                return(false);
            }
        }
Esempio n. 4
0
File: Array.cs Progetto: baban/lp
 protected override object DoEvaluate(ScriptThread thread)
 {
     Object.LpObject[] items = null;
     thread.CurrentNode = this;
     if (ChildNodes.Count() > 0)
     {
         items = (Object.LpObject[])ChildNodes.First().Evaluate(thread);
     }
     thread.CurrentNode = Parent;
     return((items == null) ? Object.LpArray.initialize() : Object.LpArray.initialize(items));
 }
Esempio n. 5
0
        protected override object DoEvaluate(ScriptThread thread)
        {
            thread.CurrentNode = this;
            string result = "";

            if (ChildNodes.Count() > 0)
            {
                result = ChildNodes.First().Evaluate(thread).ToString();
            }
            thread.CurrentNode = Parent;
            return("[" + result + "]");
        }
Esempio n. 6
0
        private void Node_CheckedChanged(object sender, EventArgs e)
        {
            if (_ignoreCheckedChangedEvents)
            {
                return;
            }
            int checkedCount   = ChildNodes.Count(node => node.CheckState == CheckState.Checked);
            int uncheckedCount = ChildNodes.Count(node => node.CheckState == CheckState.Unchecked);

            checkBoxSelected.CheckState = checkedCount == ChildNodes.Count ? CheckState.Checked
                                : (uncheckedCount == ChildNodes.Count ? CheckState.Unchecked : CheckState.Indeterminate);
        }
Esempio n. 7
0
 protected override object DoEvaluate(ScriptThread thread)
 {
     thread.CurrentNode = this;
     Object.LpObject result = null;
     if (ChildNodes.Count() > 0)
     {
         result           = Object.LpBlock.initialize(Body);
         result.arguments = null;
     }
     else
     {
         result = Object.LpBlock.initialize();
     }
     thread.CurrentNode = Parent;
     return(result);
 }
Esempio n. 8
0
 protected override object DoEvaluate(ScriptThread thread)
 {
     thread.CurrentNode = this;
     Object.LpObject result;
     if (ChildNodes.Count() > 0)
     {
         var assoc = ChildNodes.First();
         var pairs = (Dictionary <Object.LpObject, Object.LpObject>)assoc.Evaluate(thread);
         result = Object.LpHash.initialize(pairs);
     }
     else
     {
         result = Object.LpHash.initialize();
     }
     thread.CurrentNode = Parent;
     return(result);
 }
Esempio n. 9
0
        public async Task <bool> MultipleRemoveItems()
        {
            int count = ChildNodes.Count(n => n.IsMultiSelected);

            if (count < 1)
            {
                return(false);
            }

            if (this.CurrentDisplayMode == DriveDisplayMode.RubbishBin ||
                (this.CurrentDisplayMode == DriveDisplayMode.MultiSelect &&
                 this.PreviousDisplayMode == DriveDisplayMode.RubbishBin))
            {
                var customMessageDialog = new CustomMessageDialog(
                    AppMessages.MultiSelectRemoveQuestion_Title,
                    String.Format(AppMessages.MultiSelectRemoveQuestion, count),
                    App.AppInformation,
                    MessageDialogButtons.OkCancel,
                    MessageDialogImage.RubbishBin);

                customMessageDialog.OkOrYesButtonTapped += (sender, args) =>
                {
                    Deployment.Current.Dispatcher.BeginInvoke(() => ProgressService.SetProgressIndicator(true, ProgressMessages.RemoveNode));
                    RemoveOrRubbish(count);
                };

                return(await customMessageDialog.ShowDialogAsync() == MessageDialogResult.OkYes);
            }
            else
            {
                var customMessageDialog = new CustomMessageDialog(
                    AppMessages.MultiMoveToRubbishBinQuestion_Title,
                    String.Format(AppMessages.MultiMoveToRubbishBinQuestion, count),
                    App.AppInformation,
                    MessageDialogButtons.OkCancel,
                    MessageDialogImage.RubbishBin);

                customMessageDialog.OkOrYesButtonTapped += (sender, args) =>
                {
                    Deployment.Current.Dispatcher.BeginInvoke(() => ProgressService.SetProgressIndicator(true, ProgressMessages.NodeToTrash));
                    RemoveOrRubbish(count);
                };

                return(await customMessageDialog.ShowDialogAsync() == MessageDialogResult.OkYes);
            }
        }
        protected override IEnumerable <Element> OnGetElements(EntityToken parentEntityToken, TreeNodeDynamicContext dynamicContext)
        {
            foreach (var kvp in GetFunctionResult())
            {
                Element element = new Element(new ElementHandle(
                                                  dynamicContext.ElementProviderName,
                                                  new TreeFunctionElementGeneratorEntityToken(this.Id.ToString(), this.Tree.TreeId, EntityTokenSerializer.Serialize(parentEntityToken), kvp.Key),
                                                  dynamicContext.Piggybag.PreparePiggybag(this.ParentNode, parentEntityToken)
                                                  ));

                element.VisualData = new ElementVisualizedData
                {
                    Label       = kvp.Value,
                    ToolTip     = kvp.Value,
                    HasChildren = ChildNodes.Count() > 0,
                    Icon        = Core.ResourceSystem.ResourceHandle.BuildIconFromDefaultProvider("folder"),
                    OpenedIcon  = Core.ResourceSystem.ResourceHandle.BuildIconFromDefaultProvider("folder")
                };

                yield return(element);
            }
        }
Esempio n. 11
0
        public bool SelectMultipleItemsForMove()
        {
            int count = ChildNodes.Count(n => n.IsMultiSelected);

            if (count < 1)
            {
                return(false);
            }

            SelectedNodes.Clear();

            foreach (var node in ChildNodes.Where(n => n.IsMultiSelected))
            {
                node.DisplayMode = NodeDisplayMode.SelectedForCopyOrMove;
                SelectedNodes.Add(node);
            }

            this.IsMultiSelectActive = false;
            this.PreviousDisplayMode = this.CurrentDisplayMode;
            this.CurrentDisplayMode  = DriveDisplayMode.CopyOrMoveItem;

            return(true);
        }