Exemplo n.º 1
0
        internal async Task <NoParam> SavePictureInGalleryAsync(string fileName, byte[] image)
        {
            NoParam res = new NoParam();

            try
            {
                using (MemoryStream memoryStream = new MemoryStream(image))
                {
                    IRandomAccessStream imageStream = memoryStream.AsRandomAccessStream();

                    StorageFile destinationFile = await KnownFolders.SavedPictures.CreateFileAsync(fileName, CreationCollisionOption.ReplaceExisting).AsTask().ConfigureAwait(false);

                    using (var destinationStream = (await destinationFile.OpenAsync(FileAccessMode.ReadWrite).AsTask().ConfigureAwait(false)).GetOutputStreamAt(0))
                    {
                        await RandomAccessStream.CopyAndCloseAsync(imageStream, destinationStream).AsTask().ConfigureAwait(false);
                    }
                }


                res.Success = true;
            }
            catch (Exception ex)
            {
                res.Error = ex;
            }

            return(res);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Performs the action on the control by calling BeginInvoke, if it is required to do so
 /// </summary>
 /// <param name="control"></param>
 /// <param name="action"></param>
 public static void PerformControlOperation(Control control, NoParam action)
 {
     if (control.InvokeRequired)
         control.BeginInvoke(new InvokeDelegate(TryCatchInvoker), new Invoke(action, null));
     else
         TryCatchInvoker(new Invoke(action, null));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Performs the action on the control by calling BeginInvoke, if it is required to do so
 /// </summary>
 /// <param name="control"></param>
 /// <param name="action"></param>
 public static void PerformControlOperation(Control control, NoParam action)
 {
     if (control.InvokeRequired)
     {
         control.BeginInvoke(new InvokeDelegate(TryCatchInvoker), new Invoke(action, null));
     }
     else
     {
         TryCatchInvoker(new Invoke(action, null));
     }
 }
Exemplo n.º 4
0
        private void ResfreshMessages()
        {
            var mainParam      = new NoParam();
            var globalContains = new ContainsParam(containsQuery.Text);

            mainParam.AddChild(globalContains);

            SearchParametrs globalMinLevel;

            try
            {
                globalMinLevel = new HasMinimumLevelParam(Convert.ToInt32(minLevelQuery.Text));
            }
            catch (System.FormatException e)
            {
                globalMinLevel = new NoParam();
            }
            globalContains.AddChild(globalMinLevel);



            foreach (DataGridViewRow row in ClientView.Rows)
            {
                if (row.Cells["Search"].Value == null || (bool)row.Cells["Search"].Value == false)
                {
                    continue;
                }



                SearchParametrs childHasGuid;
                childHasGuid = new lib.HasGuidParam(new Guid(row.Cells["Guid"].Value as string));
                globalMinLevel.AddChild(childHasGuid);

                var childContains = new lib.ContainsParam(Convert.ToString(row.Cells["Contains"].Value));
                childHasGuid.AddChild(childContains);

                SearchParametrs childMinLevel;
                try
                {
                    childMinLevel = new lib.HasMinimumLevelParam(Convert.ToInt32(row.Cells["MinLevel"].Value));
                }
                catch (FormatException e)
                {
                    childMinLevel = new NoParam();
                }
                childContains.AddChild(childMinLevel);
            }
            messages = history.Receive(mainParam).ToList();
            MessagesView.DataSource = messages;
        }
Exemplo n.º 5
0
        /// <summary>
        /// FF: Will Replace Existing File
        /// </summary>
        /// <param name="fileNameWithExtension"></param>
        /// <param name=""></param>
        internal async Task <NoParam> WriteTextToFileAsync(string fileNameWithExtension, string data)
        {
            var res = new NoParam();

            try
            {
                Windows.Storage.StorageFolder localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;

                StorageFile file = await localFolder.CreateFileAsync(fileNameWithExtension,
                                                                     CreationCollisionOption.ReplaceExisting).AsTask().ConfigureAwait(false);

                await FileIO.WriteTextAsync(file, data).AsTask().ConfigureAwait(false);

                res.Success = true;
            }
            catch (Exception ex)
            {
                res.Error = ex;
            }
            return(res);
        }
 public void AddItemAsync(InventoryItemBase item, NoParam success)
 {
     AddItem(item);
     success();
 }
 public void MoveItemsAsync(UUID agentID, List<InventoryItemBase> items, NoParam success)
 {
     throw new NotImplementedException();
 }
 public void AddItemAsync(InventoryItemBase item, NoParam success)
 {
     throw new NotImplementedException();
 }
 public MoveInventoryItemStore(List<InventoryItemBase> items, NoParam success)
 {
     Items = items;
     Complete = success;
 }
 public void MoveItemsAsync(UUID agentID, List<InventoryItemBase> items, NoParam success)
 {
     _moveInventoryItemQueue.Add(agentID, new MoveInventoryItemStore(items, success));
 }
 public void MoveItemsAsync(UUID agentID, List <InventoryItemBase> items, NoParam success)
 {
     throw new NotImplementedException();
 }
 public void AddItemAsync(InventoryItemBase item, NoParam success)
 {
     throw new NotImplementedException();
 }
 public void MoveItemsAsync(UUID agentID, List <InventoryItemBase> items, NoParam success)
 {
 }
 /// <summary>
 ///     Called to queue a change to a prim
 ///     to use in place of old taint mechanism so changes do have a time sequence
 /// </summary>
 public void AddSimulationChange(NoParam del)
 {
     SimulationChangesQueue.Enqueue(del);
 }
Exemplo n.º 15
0
 private int CollectTime(NoParam del)
 {
     int time = Util.EnvironmentTickCount();
     del();
     return Util.EnvironmentTickCountSubtract(time);
 }
Exemplo n.º 16
0
 public AddInventoryItemStore(InventoryItemBase item, NoParam success)
 {
     Item = item;
     Complete = success;
 }
Exemplo n.º 17
0
        public void AddItemAsync(InventoryItemBase item, NoParam success)
        {
            if (UUID.Zero == item.Folder)
            {
                InventoryFolderBase f = GetFolderForType(item.Owner, (InventoryType)item.InvType, (AssetType)item.AssetType);
                if (f != null)
                    item.Folder = f.ID;
                else
                {
                    f = GetRootFolder(item.Owner);
                    if (f != null)
                        item.Folder = f.ID;
                    else
                    {
                        MainConsole.Instance.WarnFormat(
                            "[LLClientInventory]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified",
                            item.Owner, item.Name);
                        return;
                    }
                }
            }

            if (!_tempItemCache.ContainsKey(item.ID))
                _tempItemCache.Add(item.ID, item);
            _addInventoryItemQueue.Add(item.Owner, new AddInventoryItemStore(item, success));
        }
Exemplo n.º 18
0
 public void MoveItemsAsync(UUID agentID, List<InventoryItemBase> items, NoParam success)
 {
 }
 public void AddItemAsync(InventoryItemBase item, NoParam success)
 {
     AddItem(item);
     success();
 }