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); }
/// <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)); }
/// <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)); } }
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; }
/// <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 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); }
private int CollectTime(NoParam del) { int time = Util.EnvironmentTickCount(); del(); return Util.EnvironmentTickCountSubtract(time); }
public AddInventoryItemStore(InventoryItemBase item, NoParam success) { Item = item; Complete = success; }
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)); }
public void MoveItemsAsync(UUID agentID, List<InventoryItemBase> items, NoParam success) { }