Пример #1
0
        /// <summary>
        /// Called when there is something new in the server for the current secret
        /// Here we have two options:
        ///  - If the item starts with  '/api/CURRENT_SECRET/' it means that this is
        ///    really a file that should be downloaded, then we start the async download
        ///  - If the item doesn't start with the mentioned text, then is just some text to display.
        ///
        /// In both cases we add the filename or the string to the history.
        /// </summary>
        /// <param name='item'>
        /// Item: The new item, that contains the information of the new staff.
        /// </param>
        public void Paste(DataItem item)
        {
            if (item.Direction == DataItemDirection.Out && !string.IsNullOrEmpty(_uploadingFileName))
            {
                item.Data = _localUri;
            }

            CrossCopyApp.Srv.CurrentSecret.DataItems.Insert(0, item);
            Task.Factory.StartNew(() => {
                CrossCopyApp.Save(Application.Context);
            });

            if (item.Direction == DataItemDirection.In)
            {
                AddIncomingItemToHistory(item, false);
            }
            else if (!string.IsNullOrEmpty(_uploadingFileName))
            {
                _uploadingFileName = string.Empty;
                _localUri          = string.Empty;
            }
            else
            {
                AddOutgoingItemToHistory(item);
            }
        }
Пример #2
0
 protected override void OnPause()
 {
     base.OnPause();
     Task.Factory.StartNew(() => {
         CrossCopyApp.Save(Application.Context);
     });
 }