static System.Threading.Tasks.Task Delay(int milliseconds) { var tcs = new System.Threading.Tasks.TaskCompletionSource <object>(); new System.Threading.Timer(_ => tcs.SetResult(null)).Change(milliseconds, -1); return(tcs.Task); }
internal void EnqueueSend(Message message, IPEndPoint endpoint, System.Threading.Tasks.TaskCompletionSource <SendQueryEventArgs> tcs = null) { lock (locker) { if (message.TransactionId == null) { if (message is ResponseMessage) { throw new ArgumentException("Message must have a transaction id"); } do { message.TransactionId = TransactionId.NextId(); } while (MessageFactory.IsRegistered(message.TransactionId)); } // We need to be able to cancel a query message if we time out waiting for a response if (message is QueryMessage) { MessageFactory.RegisterSend((QueryMessage)message); } sendQueue.Enqueue(new SendDetails(endpoint, message, tcs)); } }
public LoginContext(System.Threading.Tasks.TaskCompletionSource <Responses.LoginResponse> taskCompletionSource, Errors.APIErrorResponseException ex, Commands.ReqRes.APICommand command, Func <string, Responses.LoginResponse> func) { this.TaskCompletionSource = taskCompletionSource; this.Exception = ex; this.Command = command; this.ResponseCreator = func; }
public System.Threading.Tasks.Task <SendQueryEventArgs> SendAsync(Message message, Node node) { var tcs = new System.Threading.Tasks.TaskCompletionSource <SendQueryEventArgs> (); EnqueueSend(message, node, tcs); return(tcs.Task); }
public static System.Threading.Tasks.Task <T> FromResult <T>(T value) { var tcs = new System.Threading.Tasks.TaskCompletionSource <T>(); tcs.SetResult(value); return(tcs.Task); }
// GET IMAGE FROM WEB URL ASYNC // ============================================================================= public static async System.Threading.Tasks.Task <Image> GetImageAsync(string url) { var tcs = new System.Threading.Tasks.TaskCompletionSource <Image>(); Image webImage = null; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = "GET"; await System.Threading.Tasks.Task.Factory.FromAsync <WebResponse>(request.BeginGetResponse, request.EndGetResponse, null) .ContinueWith(task => { var webResponse = (HttpWebResponse)task.Result; System.IO.Stream responseStream = webResponse.GetResponseStream(); /* * if (webResponse.ContentEncoding.ToLower().Contains("gzip")) * responseStream = new GZipStream(responseStream, CompressionMode.Decompress); * else if (webResponse.ContentEncoding.ToLower().Contains("deflate")) * responseStream = new DeflateStream(responseStream, CompressionMode.Decompress); */ if (responseStream != null) { webImage = Image.FromStream(responseStream); } tcs.TrySetResult(webImage); webResponse.Close(); responseStream.Close(); }); return(tcs.Task.Result); }
public static void TransferCompletionToTask <T>(System.Threading.Tasks.TaskCompletionSource <T> tcs, System.ComponentModel.AsyncCompletedEventArgs e, Func <T> getResult, Action unregisterHandler) { if (e.UserState != tcs) { return; } try { unregisterHandler(); } finally { if (e.Cancelled) { tcs.TrySetCanceled(); } else if (e.Error != null) { tcs.TrySetException(e.Error); } else { tcs.TrySetResult(getResult()); } } }
public SendDetails(IPEndPoint destination, Message message, System.Threading.Tasks.TaskCompletionSource <SendQueryEventArgs> tcs) { CompletionSource = tcs; Destination = destination; Message = message; SentAt = DateTime.MinValue; }
global::System.Threading.Tasks.Task <object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try { { if (grain == null) { throw new System.ArgumentNullException("grain"); } switch (interfaceId) { case -1413064308: // ISystemObserver switch (methodId) { case -2130055570: ((ISystemObserver)grain).HighTemperature((Double)arguments[0]); return(System.Threading.Tasks.Task.FromResult((object)true)); default: throw new NotImplementedException("interfaceId=" + interfaceId + ",methodId=" + methodId); } default: throw new System.InvalidCastException("interfaceId=" + interfaceId); } } } catch (Exception ex) { { var t = new System.Threading.Tasks.TaskCompletionSource <object>(); t.SetException(ex); return(t.Task); } } }
global::System.Threading.Tasks.Task <object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try { if (grain == null) { throw new System.ArgumentNullException("grain"); } switch (interfaceId) { case -525402465: // IHelloGrain switch (methodId) { default: throw new NotImplementedException("interfaceId=" + interfaceId + ",methodId=" + methodId); } case 1928988877: // IGrainWithIntegerKey switch (methodId) { default: throw new NotImplementedException("interfaceId=" + interfaceId + ",methodId=" + methodId); } default: throw new System.InvalidCastException("interfaceId=" + interfaceId); } } catch (Exception ex) { var t = new System.Threading.Tasks.TaskCompletionSource <object>(); t.SetException(ex); return(t.Task); } }
global::System.Threading.Tasks.Task <object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try { { if (grain == null) { throw new System.ArgumentNullException("grain"); } switch (interfaceId) { case 148814687: // IDecodeGrain switch (methodId) { case 1114664117: return(((IDecodeGrain)grain).Decode((String)arguments[0]).ContinueWith(t => { if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) { throw t.Exception; } return (object)null; })); default: throw new NotImplementedException("interfaceId=" + interfaceId + ",methodId=" + methodId); } default: throw new System.InvalidCastException("interfaceId=" + interfaceId); } } } catch (Exception ex) { { var t = new System.Threading.Tasks.TaskCompletionSource <object>(); t.SetException(ex); return(t.Task); } } }
} // End Sub OpenBrowser private static System.Threading.Tasks.Task <int> RunProcessAsync(System.Diagnostics.ProcessStartInfo startInfo) { System.Threading.Tasks.TaskCompletionSource <int> tcs = new System.Threading.Tasks.TaskCompletionSource <int>(); System.Diagnostics.Process process = new System.Diagnostics.Process { StartInfo = startInfo, EnableRaisingEvents = true }; process.Exited += delegate(object sender, System.EventArgs args) { tcs.SetResult(process.ExitCode); process.Dispose(); }; try { process.Start(); } catch (System.Exception ex) { tcs.SetException(ex); } return(tcs.Task); } // End Task RunProcessAsync
public static System.Threading.Tasks.Task LoginAsync(string username, string password) { var tcs = new System.Threading.Tasks.TaskCompletionSource <PTPrincipal>(); PTIdentity.GetPTIdentity(username, password, (o, e) => { if (e.Error == null && e.Object != null) { SetPrincipal(e.Object); tcs.SetResult(null); } else { Logout(); if (e.Error != null) { tcs.SetException(e.Error.InnerException); } else { tcs.SetCanceled(); } } }); return(tcs.Task); }
global::System.Threading.Tasks.Task <object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try { if (grain == null) { throw new System.ArgumentNullException("grain"); } switch (interfaceId) { case -974803324: // IMyGrain1 switch (methodId) { case -1732333552: return(((IMyGrain1)grain).SayHello().ContinueWith(t => { if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) { throw t.Exception; } return (object)t.Result; })); default: throw new NotImplementedException("interfaceId=" + interfaceId + ",methodId=" + methodId); } default: throw new System.InvalidCastException("interfaceId=" + interfaceId); } } catch (Exception ex) { var t = new System.Threading.Tasks.TaskCompletionSource <object>(); t.SetException(ex); return(t.Task); } }
public System.Threading.Tasks.Task <HttpWebHelperAsyncResult> ExecuteTaskAsync(IHttpWebRequest httpWebRequest, Stream requestBody, object state) { var tcs = new System.Threading.Tasks.TaskCompletionSource <HttpWebHelperAsyncResult>(state); try { ExecuteAsync(httpWebRequest, requestBody, ar => { var asyncResult = (HttpWebHelperAsyncResult)ar; if (asyncResult.IsCancelled) { tcs.TrySetCanceled(); } if (asyncResult.Exception != null) { tcs.TrySetException(asyncResult.Exception); } else { tcs.TrySetResult(asyncResult); } }, state); } catch (Exception ex) { tcs.TrySetException(ex); } return(tcs.Task); }
public System.Threading.Tasks.Task <FluentHttpAsyncResult> ExecuteTaskAsync(object state) { var tcs = new System.Threading.Tasks.TaskCompletionSource <FluentHttpAsyncResult>(state); try { ExecuteAsync(ar => { if (ar.IsCancelled) { tcs.TrySetCanceled(); } if (ar.Exception != null) { tcs.TrySetException(ar.Exception); } else { tcs.TrySetResult(ar); } }, state); } catch (Exception ex) { tcs.TrySetException(ex); } return(tcs.Task); }
global::System.Threading.Tasks.Task <object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try { { if (grain == null) { throw new System.ArgumentNullException("grain"); } switch (interfaceId) { case 1167282281: // IMessageObserver switch (methodId) { case -679320403: ((IMessageObserver)grain).Send((Microsoft.AspNet.SignalR.Messaging.Message[])arguments[0]); return(System.Threading.Tasks.Task.FromResult((object)true)); default: throw new NotImplementedException("interfaceId=" + interfaceId + ",methodId=" + methodId); } default: throw new System.InvalidCastException("interfaceId=" + interfaceId); } } } catch (Exception ex) { { var t = new System.Threading.Tasks.TaskCompletionSource <object>(); t.SetException(ex); return(t.Task); } } }
public static System.Threading.Tasks.Task <T> ExecuteTaskAsync <T>(this RestClient @this, RestRequest request) where T : new() { if (@this == null) { throw new NullReferenceException(); } var tcs = new System.Threading.Tasks.TaskCompletionSource <T>(); @this.ExecuteAsync <T>(request, (response) => { string rr = response.Content; if (response.StatusCode != System.Net.HttpStatusCode.OK) { tcs = null; } else { tcs.TrySetResult(response.Data); } }); return(tcs.Task); }
static TaskUtils() { var src = new System.Threading.Tasks.TaskCompletionSource <Object>(); src.SetResult(null); CompletedTask = src.Task; }
public void Resume() { #if DEBUG System.Console.WriteLine($"{{ {System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName}.{System.Reflection.MethodBase.GetCurrentMethod().Name} }}"); #endif this._pauseCompletionSource = new System.Threading.Tasks.TaskCompletionSource <System.Object>(); this._resumeCompletionSource.SetResult(null); }
static StackObject *Ctor_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *__ret = ILIntepreter.Minus(__esp, 0); var result_of_this_method = new System.Threading.Tasks.TaskCompletionSource <Google.Protobuf.Adapt_IMessage.Adaptor>(); return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
public FTPResponse() { this.p_Content = new System.Collections.Generic.List <string>(); this.p_CompletedTask = new System.Threading.Tasks.TaskCompletionSource <FTPResponse>(); this.p_Code = -1; this.p_FirstLine = System.String.Empty; this.p_LastLine = System.String.Empty; this.p_IsComplete = false; this.p_IsMultiline = false; }
global::System.Threading.Tasks.Task <object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try { if (grain == null) { throw new System.ArgumentNullException("grain"); } switch (interfaceId) { case 364124001: // IEmployee switch (methodId) { case 312402437: return(((IEmployee)grain).GetLevel().ContinueWith(t => { if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) { throw t.Exception; } return (object)t.Result; })); case -1461035780: return(((IEmployee)grain).Promote((Int32)arguments[0]).ContinueWith(t => { if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) { throw t.Exception; } return (object)null; })); case 940043127: return(((IEmployee)grain).GetManager().ContinueWith(t => { if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) { throw t.Exception; } return (object)t.Result; })); case -159913581: return(((IEmployee)grain).SetManager((IManager)arguments[0]).ContinueWith(t => { if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) { throw t.Exception; } return (object)null; })); default: throw new NotImplementedException("interfaceId=" + interfaceId + ",methodId=" + methodId); } default: throw new System.InvalidCastException("interfaceId=" + interfaceId); } } catch (Exception ex) { var t = new System.Threading.Tasks.TaskCompletionSource <object>(); t.SetException(ex); return(t.Task); } }
global::System.Threading.Tasks.Task <object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try { { if (grain == null) { throw new System.ArgumentNullException("grain"); } switch (interfaceId) { case 1021785371: // ISystemGrain switch (methodId) { case 997261292: return(((ISystemGrain)grain).SetTemperature((TemperatureReading)arguments[0]).ContinueWith(t => { if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) { throw t.Exception; } return (object)null; })); case 98774684: return(((ISystemGrain)grain).GetTemperature().ContinueWith(t => { if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) { throw t.Exception; } return (object)t.Result; })); case 987286981: return(((ISystemGrain)grain).Subscribe((ISystemObserver)arguments[0]).ContinueWith(t => { if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) { throw t.Exception; } return (object)null; })); case -1645784438: return(((ISystemGrain)grain).Unsubscribe((ISystemObserver)arguments[0]).ContinueWith(t => { if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) { throw t.Exception; } return (object)null; })); default: throw new NotImplementedException("interfaceId=" + interfaceId + ",methodId=" + methodId); } default: throw new System.InvalidCastException("interfaceId=" + interfaceId); } } } catch (Exception ex) { { var t = new System.Threading.Tasks.TaskCompletionSource <object>(); t.SetException(ex); return(t.Task); } } }
global::System.Threading.Tasks.Task <object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try { if (grain == null) { throw new System.ArgumentNullException("grain"); } switch (interfaceId) { case 704364051: // IDeviceGrain switch (methodId) { case 184075932: return(((IDeviceGrain)grain).UpdatePosition((Double)arguments[0], (Double)arguments[1]).ContinueWith(t => { if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) { throw t.Exception; } return (object)null; })); case -2035798409: return(((IDeviceGrain)grain).GetSurroundingDevices().ContinueWith(t => { if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) { throw t.Exception; } return (object)t.Result; })); case 1748567639: return(((IDeviceGrain)grain).UpdatePositionAndGetSurroundingDevices((Double)arguments[0], (Double)arguments[1]).ContinueWith(t => { if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) { throw t.Exception; } return (object)t.Result; })); default: throw new NotImplementedException("interfaceId=" + interfaceId + ",methodId=" + methodId); } case -1097320095: // IGrainWithGuidKey switch (methodId) { default: throw new NotImplementedException("interfaceId=" + interfaceId + ",methodId=" + methodId); } default: throw new System.InvalidCastException("interfaceId=" + interfaceId); } } catch (Exception ex) { var t = new System.Threading.Tasks.TaskCompletionSource <object>(); t.SetException(ex); return(t.Task); } }
global::System.Threading.Tasks.Task <object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try { if (grain == null) { throw new System.ArgumentNullException("grain"); } switch (interfaceId) { case 1788928010: // IDeviceGrain switch (methodId) { case -1555867497: return(((IDeviceGrain)grain).JoinSystem((System.String)arguments[0]).ContinueWith(t => { if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) { throw t.Exception; } return (object)null; })); case -1788431855: return(((IDeviceGrain)grain).SetTemperature((System.Double)arguments[0]).ContinueWith(t => { if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) { throw t.Exception; } return (object)null; })); case 98774684: return(((IDeviceGrain)grain).GetTemperature().ContinueWith(t => { if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) { throw t.Exception; } return (object)t.Result; })); default: throw new NotImplementedException("interfaceId=" + interfaceId + ",methodId=" + methodId); } case -1277021679: // IGrainWithStringKey switch (methodId) { default: throw new NotImplementedException("interfaceId=" + interfaceId + ",methodId=" + methodId); } default: throw new System.InvalidCastException("interfaceId=" + interfaceId); } } catch (Exception ex) { var t = new System.Threading.Tasks.TaskCompletionSource <object>(); t.SetException(ex); return(t.Task); } }
global::System.Threading.Tasks.Task <object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try { if (grain == null) { throw new System.ArgumentNullException("grain"); } switch (interfaceId) { case 1313245371: // IHelloGrain switch (methodId) { case -61059369: return(((IHelloGrain)grain).ReadSomething().ContinueWith(t => { if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) { throw t.Exception; } return (object)t.Result; })); case 59235890: return(((IHelloGrain)grain).WriteSomething((String)arguments[0]).ContinueWith(t => { if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) { throw t.Exception; } return (object)null; })); case -454132849: return(((IHelloGrain)grain).GetState().ContinueWith(t => { if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) { throw t.Exception; } return (object)t.Result; })); default: throw new NotImplementedException("interfaceId=" + interfaceId + ",methodId=" + methodId); } case -1277021679: // IGrainWithStringKey switch (methodId) { default: throw new NotImplementedException("interfaceId=" + interfaceId + ",methodId=" + methodId); } default: throw new System.InvalidCastException("interfaceId=" + interfaceId); } } catch (Exception ex) { var t = new System.Threading.Tasks.TaskCompletionSource <object>(); t.SetException(ex); return(t.Task); } }
global::System.Threading.Tasks.Task <object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try { if (grain == null) { throw new System.ArgumentNullException("grain"); } switch (interfaceId) { case 1530413783: // IManager switch (methodId) { case -1701259070: return(((IManager)grain).AsEmployee().ContinueWith(t => { if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) { throw t.Exception; } return (object)t.Result; })); case -675836216: return(((IManager)grain).GetDirectReports().ContinueWith(t => { if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) { throw t.Exception; } return (object)t.Result; })); case -1731443267: return(((IManager)grain).AddDirectReport((IEmployee)arguments[0]).ContinueWith(t => { if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) { throw t.Exception; } return (object)null; })); case -459995068: return(((IManager)grain).Order((String)arguments[0]).ContinueWith(t => { if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) { throw t.Exception; } return (object)null; })); default: throw new NotImplementedException("interfaceId=" + interfaceId + ",methodId=" + methodId); } default: throw new System.InvalidCastException("interfaceId=" + interfaceId); } } catch (Exception ex) { var t = new System.Threading.Tasks.TaskCompletionSource <object>(); t.SetException(ex); return(t.Task); } }
global::System.Threading.Tasks.Task <object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try { { if (grain == null) { throw new System.ArgumentNullException("grain"); } switch (interfaceId) { case 679704130: // ITeacher switch (methodId) { case 2085948699: return(((ITeacher)grain).SetName((String)arguments[0], (String)arguments[1]).ContinueWith(t => { if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) { throw t.Exception; } return (object)null; })); case -1168913303: return(((ITeacher)grain).GetInfo().ContinueWith(t => { if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) { throw t.Exception; } return (object)t.Result; })); case 91621796: return(((ITeacher)grain).GetFullName().ContinueWith(t => { if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) { throw t.Exception; } return (object)t.Result; })); default: throw new NotImplementedException("interfaceId=" + interfaceId + ",methodId=" + methodId); } case -1097320095: // IGrainWithGuidKey switch (methodId) { default: throw new NotImplementedException("interfaceId=" + interfaceId + ",methodId=" + methodId); } default: throw new System.InvalidCastException("interfaceId=" + interfaceId); } } } catch (Exception ex) { { var t = new System.Threading.Tasks.TaskCompletionSource <object>(); t.SetException(ex); return(t.Task); } } }
global::System.Threading.Tasks.Task <object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try { if (grain == null) { throw new System.ArgumentNullException("grain"); } switch (interfaceId) { case 372486725: // IBeaconGrain switch (methodId) { case -289883699: return(((IBeaconGrain)grain).UpdateDevicePosition((Guid)arguments[0], (Double)arguments[1], (Double)arguments[2]).ContinueWith(t => { if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) { throw t.Exception; } return (object)null; })); case -1453378005: return(((IBeaconGrain)grain).Leave((Guid)arguments[0]).ContinueWith(t => { if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) { throw t.Exception; } return (object)null; })); case -1285976066: return(((IBeaconGrain)grain).GetDevices().ContinueWith(t => { if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) { throw t.Exception; } return (object)t.Result; })); default: throw new NotImplementedException("interfaceId=" + interfaceId + ",methodId=" + methodId); } case -1097320095: // IGrainWithGuidKey switch (methodId) { default: throw new NotImplementedException("interfaceId=" + interfaceId + ",methodId=" + methodId); } default: throw new System.InvalidCastException("interfaceId=" + interfaceId); } } catch (Exception ex) { var t = new System.Threading.Tasks.TaskCompletionSource <object>(); t.SetException(ex); return(t.Task); } }
public static System.Threading.Tasks.Task LoginAsync(string username, string password) { var tcs = new System.Threading.Tasks.TaskCompletionSource<PTPrincipal>(); PTIdentity.GetPTIdentity(username, password, (o, e) => { if (e.Error == null && e.Object != null) { SetPrincipal(e.Object); tcs.SetResult(null); } else { Logout(); if (e.Error != null) tcs.SetException(e.Error.InnerException); else tcs.SetCanceled(); } }); return tcs.Task; }
global::System.Threading.Tasks.Task<object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try { if (grain == null) throw new System.ArgumentNullException("grain"); switch (interfaceId) { case 562364977: // IChirperPublisher switch (methodId) { case 1973211050: return ((IChirperPublisher)grain).GetUserId().ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); case 208463624: return ((IChirperPublisher)grain).GetUserAlias().ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); case 438764651: return ((IChirperPublisher)grain).GetPublishedMessages((Int32)arguments[0], (Int32)arguments[1]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); case 1631913776: return ((IChirperPublisher)grain).AddFollower((String)arguments[0], (Int64)arguments[1], (IChirperSubscriber)arguments[2]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); case -370855882: return ((IChirperPublisher)grain).RemoveFollower((String)arguments[0], (IChirperSubscriber)arguments[1]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); } default: throw new System.InvalidCastException("interfaceId="+interfaceId); } } catch(Exception ex) { var t = new System.Threading.Tasks.TaskCompletionSource<object>(); t.SetException(ex); return t.Task; } }
global::System.Threading.Tasks.Task<object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try { if (grain == null) throw new System.ArgumentNullException("grain"); switch (interfaceId) { case -930412412: // IChirperSubscriber switch (methodId) { case -1105116289: return ((IChirperSubscriber)grain).NewChirp((ChirperMessage)arguments[0]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); } default: throw new System.InvalidCastException("interfaceId="+interfaceId); } } catch(Exception ex) { var t = new System.Threading.Tasks.TaskCompletionSource<object>(); t.SetException(ex); return t.Task; } }
global::System.Threading.Tasks.Task<object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try { if (grain == null) throw new System.ArgumentNullException("grain"); switch (interfaceId) { case 523268002: // IClient switch (methodId) { case 1975541297: return ((IClient)grain).Run().ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); case -2060440583: return ((IClient)grain).Pong((IDestination)arguments[0], (Message)arguments[1]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); case 1682027821: return ((IClient)grain).Initialize((IDestination)arguments[0], (System.Int64)arguments[1]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); case -1238941369: return ((IClient)grain).Subscribe((IClientObserver)arguments[0]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); }case -1277021679: // IGrainWithStringKey switch (methodId) { default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); } default: throw new System.InvalidCastException("interfaceId="+interfaceId); } } catch(Exception ex) { var t = new System.Threading.Tasks.TaskCompletionSource<object>(); t.SetException(ex); return t.Task; } }
global::System.Threading.Tasks.Task<object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try { if (grain == null) throw new System.ArgumentNullException("grain"); switch (interfaceId) { case -1277882208: // IHello switch (methodId) { case 1136607985: return ((IHello)grain).GetCustomers().ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); } default: throw new System.InvalidCastException("interfaceId="+interfaceId); } } catch(Exception ex) { var t = new System.Threading.Tasks.TaskCompletionSource<object>(); t.SetException(ex); return t.Task; } }
/// <summary> /// Delete this photo album. /// </summary> /// <returns>A Task<Boolean>that can be used to monitor progress on this call.</returns> public System.Threading.Tasks.Task<Boolean> DeleteAsync() { var tcs = new System.Threading.Tasks.TaskCompletionSource<Boolean>(); DeleteInternal((bcr) => { if (bcr.Error != BuddyServiceClient.BuddyError.None) { tcs.TrySetException(new BuddyServiceException(bcr.Error)); } else { tcs.TrySetResult(bcr.Result); } }); return tcs.Task; }
global::System.Threading.Tasks.Task<object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try { if (grain == null) throw new System.ArgumentNullException("grain"); switch (interfaceId) { case 389679522: // IPowerLineObserver switch (methodId) { case 1671039887: ((IPowerLineObserver)grain).OverConsumption((Int32)arguments[0]); return System.Threading.Tasks.Task.FromResult((object)true); default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); } default: throw new System.InvalidCastException("interfaceId="+interfaceId); } } catch(Exception ex) { var t = new System.Threading.Tasks.TaskCompletionSource<object>(); t.SetException(ex); return t.Task; } }
global::System.Threading.Tasks.Task<object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try { if (grain == null) throw new System.ArgumentNullException("grain"); switch (interfaceId) { case 1700701008: // ICalculatorActor switch (methodId) { case 567326490: return ((ICalculatorActor)grain).Set((Decimal)arguments[0]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); case 1818975443: return ((ICalculatorActor)grain).Add((Decimal)arguments[0]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); case 1048698314: return ((ICalculatorActor)grain).Multiply((Decimal)arguments[0]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); case -1887213722: return ((ICalculatorActor)grain).Divide((Decimal)arguments[0]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); case 974166974: return ((ICalculatorActor)grain).Reset().ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); case -940922787: return ((ICalculatorActor)grain).Get().ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); }case -1097320095: // IGrainWithGuidKey switch (methodId) { default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); } default: throw new System.InvalidCastException("interfaceId="+interfaceId); } } catch(Exception ex) { var t = new System.Threading.Tasks.TaskCompletionSource<object>(); t.SetException(ex); return t.Task; } }
global::System.Threading.Tasks.Task<object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try { if (grain == null) throw new System.ArgumentNullException("grain"); switch (interfaceId) { case -2105953344: // IDeviceGrain switch (methodId) { case 1567424079: return ((IDeviceGrain)grain).GetColor().ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); case -1860597175: return ((IDeviceGrain)grain).SetColor((String)arguments[0]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); }case -1277021679: // IGrainWithStringKey switch (methodId) { default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); } default: throw new System.InvalidCastException("interfaceId="+interfaceId); } } catch(Exception ex) { var t = new System.Threading.Tasks.TaskCompletionSource<object>(); t.SetException(ex); return t.Task; } }
global::System.Threading.Tasks.Task<object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try { if (grain == null) throw new System.ArgumentNullException("grain"); switch (interfaceId) { case -1804278580: // IChirperAccount switch (methodId) { case 957692321: return ((IChirperAccount)grain).SetUserDetails((ChirperUserInfo)arguments[0]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); case 752357790: return ((IChirperAccount)grain).FollowUserId((Int64)arguments[0]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); case -601623755: return ((IChirperAccount)grain).UnfollowUserId((Int64)arguments[0]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); case -1960464744: return ((IChirperAccount)grain).GetFollowingList().ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); case -491886212: return ((IChirperAccount)grain).GetFollowersList().ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); case -68598853: return ((IChirperAccount)grain).PublishMessage((String)arguments[0]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); case 913298032: return ((IChirperAccount)grain).GetReceivedMessages((Int32)arguments[0], (Int32)arguments[1]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); case 913319715: return ((IChirperAccount)grain).ViewerConnect((IChirperViewer)arguments[0]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); case 1708978275: return ((IChirperAccount)grain).ViewerDisconnect((IChirperViewer)arguments[0]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); case 1973211050: return ((IChirperAccount)grain).GetUserId().ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); case 208463624: return ((IChirperAccount)grain).GetUserAlias().ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); case 438764651: return ((IChirperAccount)grain).GetPublishedMessages((Int32)arguments[0], (Int32)arguments[1]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); case 1631913776: return ((IChirperAccount)grain).AddFollower((String)arguments[0], (Int64)arguments[1], (IChirperSubscriber)arguments[2]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); case -370855882: return ((IChirperAccount)grain).RemoveFollower((String)arguments[0], (IChirperSubscriber)arguments[1]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); case -1105116289: return ((IChirperAccount)grain).NewChirp((ChirperMessage)arguments[0]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); }case 562364977: // IChirperPublisher switch (methodId) { case 1973211050: return ((IChirperPublisher)grain).GetUserId().ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); case 208463624: return ((IChirperPublisher)grain).GetUserAlias().ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); case 438764651: return ((IChirperPublisher)grain).GetPublishedMessages((Int32)arguments[0], (Int32)arguments[1]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); case 1631913776: return ((IChirperPublisher)grain).AddFollower((String)arguments[0], (Int64)arguments[1], (IChirperSubscriber)arguments[2]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); case -370855882: return ((IChirperPublisher)grain).RemoveFollower((String)arguments[0], (IChirperSubscriber)arguments[1]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); }case -930412412: // IChirperSubscriber switch (methodId) { case -1105116289: return ((IChirperSubscriber)grain).NewChirp((ChirperMessage)arguments[0]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); } default: throw new System.InvalidCastException("interfaceId="+interfaceId); } } catch(Exception ex) { var t = new System.Threading.Tasks.TaskCompletionSource<object>(); t.SetException(ex); return t.Task; } }
public async override System.Threading.Tasks.Task<Uri> GetInitialUrlAsync() { // just return if no replacement requested if (string.IsNullOrEmpty(replacementUrlFormat)) return await base.GetInitialUrlAsync(); // get base class Uri System.Diagnostics.Debug.WriteLine("GetUriFromTaskUri: replacementUrlFormat:" + replacementUrlFormat); Uri uri = await base.GetInitialUrlAsync(); System.Diagnostics.Debug.WriteLine("GetUriFromTaskUri: base.uri:" + uri); // need to extract state query string from base Uri because its scope isn't public. string baseUrl = uri.OriginalString; int stateIndex = baseUrl.LastIndexOf("&state="); string requestState = baseUrl.Substring(stateIndex + "&state=".Length); // verify that the base Url is same as our supposedly identical procedure. If not, there must be a code change in a new version of base class. string redoUrl = string.Format( "{0}?client_id={1}&redirect_uri={2}&response_type={3}&scope={4}&state={5}", AuthorizeUrl.AbsoluteUri, Uri.EscapeDataString(ClientId), Uri.EscapeDataString(RedirectUrl.AbsoluteUri), AccessTokenUrl == null ? "token" : "code", Uri.EscapeDataString(Scope), Uri.EscapeDataString(requestState)); if (baseUrl != redoUrl) throw new ArgumentException("GetInitialUrlAsync: Url comparison failure: base: " + baseUrl + " redo:" + redoUrl); // format replacement Uri uri = new Uri(string.Format( replacementUrlFormat, AuthorizeUrl.AbsoluteUri, Uri.EscapeDataString(ClientId), Uri.EscapeDataString(RedirectUrl.AbsoluteUri), AccessTokenUrl == null ? "token" : "code", Uri.EscapeDataString(Scope), Uri.EscapeDataString(requestState))); System.Diagnostics.Debug.WriteLine("GetUriFromTaskUri: replacement uri:" + uri); System.Threading.Tasks.TaskCompletionSource<Uri> tcs = new System.Threading.Tasks.TaskCompletionSource<Uri>(); tcs.SetResult(uri); return uri; }
public System.Threading.Tasks.Task<IResponse> GetResponseAsync(System.Threading.CancellationToken cancellationToken) { System.Threading.Tasks.TaskCompletionSource<IResponse> tcs = new System.Threading.Tasks.TaskCompletionSource<IResponse>(); tcs.SetResult(new ResponseImpl(xrequest.GetResponseAsync(cancellationToken))); return tcs.Task; }
global::System.Threading.Tasks.Task<object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try { if (grain == null) throw new System.ArgumentNullException("grain"); switch (interfaceId) { case 1126410990: // IClientObserver switch (methodId) { case -1778340467: ((IClientObserver)grain).Done((System.Int64)arguments[0], (System.Int64)arguments[1]); return System.Threading.Tasks.Task.FromResult((object)true); default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); } default: throw new System.InvalidCastException("interfaceId="+interfaceId); } } catch(Exception ex) { var t = new System.Threading.Tasks.TaskCompletionSource<object>(); t.SetException(ex); return t.Task; } }
/// <summary> /// Task.Delayが.NET 4だと搭載されていないので擬似関数作成 /// </summary> /// <param name="milliseconds"></param> private void Delay(int milliseconds) { var tcs = new System.Threading.Tasks.TaskCompletionSource<object>(); new System.Threading.Timer(_ => tcs.SetResult(null)).Change(milliseconds, -1); tcs.Task.Wait(); }
global::System.Threading.Tasks.Task<object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try { if (grain == null) throw new System.ArgumentNullException("grain"); switch (interfaceId) { case -874440916: // IChirperViewer switch (methodId) { case -343496927: ((IChirperViewer)grain).NewChirpArrived((ChirperMessage)arguments[0]); return System.Threading.Tasks.Task.FromResult((object)true); case 489541775: ((IChirperViewer)grain).SubscriptionAdded((ChirperUserInfo)arguments[0]); return System.Threading.Tasks.Task.FromResult((object)true); case 1797324738: ((IChirperViewer)grain).SubscriptionRemoved((ChirperUserInfo)arguments[0]); return System.Threading.Tasks.Task.FromResult((object)true); default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); } default: throw new System.InvalidCastException("interfaceId="+interfaceId); } } catch(Exception ex) { var t = new System.Threading.Tasks.TaskCompletionSource<object>(); t.SetException(ex); return t.Task; } }
global::System.Threading.Tasks.Task<object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try { if (grain == null) throw new System.ArgumentNullException("grain"); switch (interfaceId) { case -627797884: // IPerson switch (methodId) { case -1544510960: return ((IPerson)grain).Register((PersonalAttributes)arguments[0]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); case -516276551: return ((IPerson)grain).Marry((Guid)arguments[0], (String)arguments[1]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); case 513673718: return ((IPerson)grain).GetFirstName().ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); case 160660420: return ((IPerson)grain).GetLastName().ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); case 1616597481: return ((IPerson)grain).GetIsMarried().ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); }case 1928988877: // IGrainWithIntegerKey switch (methodId) { default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); } default: throw new System.InvalidCastException("interfaceId="+interfaceId); } } catch(Exception ex) { var t = new System.Threading.Tasks.TaskCompletionSource<object>(); t.SetException(ex); return t.Task; } }
global::System.Threading.Tasks.Task<object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try {{ if (grain == null) throw new System.ArgumentNullException("grain"); switch (interfaceId) { case 1150057381: // IPubSubManager switch (methodId) { case -203526534: return ((IPubSubManager)grain).Register((IPubSubGrain)arguments[0]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); case -2125469177: return ((IPubSubManager)grain).Unregister((IPubSubGrain)arguments[0]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); } default: throw new System.InvalidCastException("interfaceId="+interfaceId); } }} catch(Exception ex) {{ var t = new System.Threading.Tasks.TaskCompletionSource<object>(); t.SetException(ex); return t.Task; }} }
/// <summary> /// Add a new picture to this album. Note that this method internally does two web-service calls, and the IAsyncResult object /// returned is only valid for the first one. /// </summary> /// <param name="photoStream">A stream containing the photo's contents..</param> /// <param name="comment">An optional comment for this picture.</param> /// <param name="latitude">An optional latitude for the picture.</param> /// <param name="longitude">An optional longitude for the picture.</param> /// <param name="appTag">An optional application tag.</param> /// <param name="watermarkmessage">An optional message to watermark the image with.</param> /// <returns>A Task<Picture>that can be used to monitor progress on this call.</returns> public System.Threading.Tasks.Task<Picture> AddPictureWithWatermarkAsync(Stream photoStream, string comment = "", double latitude = 0, double longitude = 0, string appTag = "", string watermarkmessage = "") { var tcs = new System.Threading.Tasks.TaskCompletionSource<Picture>(); AddPictureWithWatermarkInternal(photoStream, comment, latitude, longitude, appTag, watermarkmessage, (bcr) => { if (bcr.Error != BuddyServiceClient.BuddyError.None) { tcs.TrySetException(new BuddyServiceException(bcr.Error)); } else { tcs.TrySetResult(bcr.Result); } }); return tcs.Task; }
global::System.Threading.Tasks.Task<object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try { if (grain == null) throw new System.ArgumentNullException("grain"); switch (interfaceId) { case 1895808213: // ITransferTransaction switch (methodId) { case 518927232: return ((ITransferTransaction)grain).Initialize((Guid)arguments[0], (Guid)arguments[1], (Decimal)arguments[2]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); case 901321164: return ((ITransferTransaction)grain).ConfirmAccountValidatePassed().ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); case 1613436135: return ((ITransferTransaction)grain).ConfirmTransferOutPreparation().ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); case 108736162: return ((ITransferTransaction)grain).ConfirmTransferInPreparation().ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); case -1176500040: return ((ITransferTransaction)grain).ConfirmTransferOut().ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); case 1990501567: return ((ITransferTransaction)grain).ConfirmTransferIn().ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); case 751141822: return ((ITransferTransaction)grain).Cancel((TransactionFaileReason)arguments[0]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); case -1251605435: return ((ITransferTransaction)grain).GetStatus().ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); case 1419660080: return ((ITransferTransaction)grain).GetTransferTransactionInfo().ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); }case -1097320095: // IGrainWithGuidKey switch (methodId) { default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); } default: throw new System.InvalidCastException("interfaceId="+interfaceId); } } catch(Exception ex) { var t = new System.Threading.Tasks.TaskCompletionSource<object>(); t.SetException(ex); return t.Task; } }
global::System.Threading.Tasks.Task<object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try { if (grain == null) throw new System.ArgumentNullException("grain"); switch (interfaceId) { case 2060187244: // ITransferTransactionProcessManager switch (methodId) { case 1500745786: return ((ITransferTransactionProcessManager)grain).ProcessTransferTransaction((Guid)arguments[0], (Guid)arguments[1], (Decimal)arguments[2]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); }case 1928988877: // IGrainWithIntegerKey switch (methodId) { default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); } default: throw new System.InvalidCastException("interfaceId="+interfaceId); } } catch(Exception ex) { var t = new System.Threading.Tasks.TaskCompletionSource<object>(); t.SetException(ex); return t.Task; } }
/// <summary> /// webBrowser コンポーネントにHTMLを出力して /// DocumentComplate になるのを非同期で待ち合わせる /// </summary> /// <param name="html"></param> /// <returns></returns> System.Threading.Tasks.Task WebBrowserNavigate(string url) { if (browserWaitTimer == null) { browserWaitTimer = new Timer(); browserWaitTimer.Tick += browserWaitTimer_Tick; browserWaitTimer.Enabled = true; } var obj = waitObject; if (obj != null) { obj.SetCanceled(); } waitObject = new System.Threading.Tasks.TaskCompletionSource<string>(); timerCount = 0; this.webBrowser1.Navigate(url); browserWaitTimer.Enabled = true; return waitObject.Task; }
global::System.Threading.Tasks.Task<object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try { if (grain == null) throw new System.ArgumentNullException("grain"); switch (interfaceId) { case 1662910789: // IDestination switch (methodId) { case 1491328371: return ((IDestination)grain).Ping((IClient)arguments[0], (Message)arguments[1]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); }case -1277021679: // IGrainWithStringKey switch (methodId) { default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); } default: throw new System.InvalidCastException("interfaceId="+interfaceId); } } catch(Exception ex) { var t = new System.Threading.Tasks.TaskCompletionSource<object>(); t.SetException(ex); return t.Task; } }
private System.Threading.Tasks.Task FadeToBlackAsync() { CallFadeOut.Visibility = Visibility.Visible; var tcs = new System.Threading.Tasks.TaskCompletionSource<object>(); EventHandler<object> completed = null; completed = (o, e) => { FadeToBlack.Completed -= completed; tcs.SetResult(null); }; FadeToBlack.Completed += completed; FadeToBlack.Begin(); return tcs.Task; }
global::System.Threading.Tasks.Task<object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try { if (grain == null) throw new System.ArgumentNullException("grain"); switch (interfaceId) { case 2040282744: // IBuilding switch (methodId) { case 1047791444: return ((IBuilding)grain).SetPowerForApartment((Int64)arguments[0], (Int32)arguments[1]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); case -449473587: return ((IBuilding)grain).GetCurrentPower().ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); case -1266728070: return ((IBuilding)grain).GetPowerByApartments().ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); } default: throw new System.InvalidCastException("interfaceId="+interfaceId); } } catch(Exception ex) { var t = new System.Threading.Tasks.TaskCompletionSource<object>(); t.SetException(ex); return t.Task; } }
global::System.Threading.Tasks.Task<object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try {{ if (grain == null) throw new System.ArgumentNullException("grain"); switch (interfaceId) { case 403532564: // IPubSubGrain switch (methodId) { case 1418215476: return ((IPubSubGrain)grain).Publish((Microsoft.AspNet.SignalR.Messaging.Message[])arguments[0]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); case -1032958586: return ((IPubSubGrain)grain).Subscribe((IMessageObserver)arguments[0]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); case -1026708032: return ((IPubSubGrain)grain).Unsubscribe((IMessageObserver)arguments[0]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); case 1140013191: return ((IPubSubGrain)grain).Notify((Microsoft.AspNet.SignalR.Messaging.Message[])arguments[0]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); case -316297706: return ((IPubSubGrain)grain).TopologyChange((IPubSubGrain[])arguments[0]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); } default: throw new System.InvalidCastException("interfaceId="+interfaceId); } }} catch(Exception ex) {{ var t = new System.Threading.Tasks.TaskCompletionSource<object>(); t.SetException(ex); return t.Task; }} }
global::System.Threading.Tasks.Task<object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try { if (grain == null) throw new System.ArgumentNullException("grain"); switch (interfaceId) { case 1529258251: // IPowerLine switch (methodId) { case -1348462830: return ((IPowerLine)grain).SetPowerCurrent((Int32)arguments[0]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); case -449473587: return ((IPowerLine)grain).GetCurrentPower().ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); case 1042716812: return ((IPowerLine)grain).SubscribeForPowerNotifications((IPowerLineObserver)arguments[0]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); } default: throw new System.InvalidCastException("interfaceId="+interfaceId); } } catch(Exception ex) { var t = new System.Threading.Tasks.TaskCompletionSource<object>(); t.SetException(ex); return t.Task; } }
global::System.Threading.Tasks.Task<object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try {{ if (grain == null) throw new System.ArgumentNullException("grain"); switch (interfaceId) { case 1167282281: // IMessageObserver switch (methodId) { case -679320403: ((IMessageObserver)grain).Send((Microsoft.AspNet.SignalR.Messaging.Message[])arguments[0]); return System.Threading.Tasks.Task.FromResult((object)true); default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); } default: throw new System.InvalidCastException("interfaceId="+interfaceId); } }} catch(Exception ex) {{ var t = new System.Threading.Tasks.TaskCompletionSource<object>(); t.SetException(ex); return t.Task; }} }
global::System.Threading.Tasks.Task<object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try { if (grain == null) throw new System.ArgumentNullException("grain"); switch (interfaceId) { case -912346303: // IBankAccount switch (methodId) { case -1993006295: return ((IBankAccount)grain).Initialize((Guid)arguments[0]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); case 1980500241: return ((IBankAccount)grain).Validate().ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); case 1417003246: return ((IBankAccount)grain).AddTransactionPreparation((Guid)arguments[0], (TransactionType)arguments[1], (PreparationType)arguments[2], (Decimal)arguments[3]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); case -576022763: return ((IBankAccount)grain).CommitTransactionPreparation((Guid)arguments[0]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); case -1730429136: return ((IBankAccount)grain).CancelTransactionPreparation((Guid)arguments[0]).ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }); case 698066810: return ((IBankAccount)grain).GetBalance().ContinueWith(t => {if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }); default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); }case -1097320095: // IGrainWithGuidKey switch (methodId) { default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); } default: throw new System.InvalidCastException("interfaceId="+interfaceId); } } catch(Exception ex) { var t = new System.Threading.Tasks.TaskCompletionSource<object>(); t.SetException(ex); return t.Task; } }
public System.Threading.Tasks.Task<HttpWebHelperAsyncResult> ExecuteTaskAsync(IHttpWebRequest httpWebRequest, Stream requestBody, object state) { var tcs = new System.Threading.Tasks.TaskCompletionSource<HttpWebHelperAsyncResult>(state); try { ExecuteAsync(httpWebRequest, requestBody, ar => { var asyncResult = (HttpWebHelperAsyncResult)ar; if (asyncResult.IsCancelled) tcs.TrySetCanceled(); if (asyncResult.Exception != null) tcs.TrySetException(asyncResult.Exception); else tcs.TrySetResult(asyncResult); }, state); } catch (Exception ex) { tcs.TrySetException(ex); } return tcs.Task; }
global::System.Threading.Tasks.Task<object> global::Orleans.CodeGeneration.IGrainMethodInvoker.Invoke(global::Orleans.Runtime.IAddressable grain, int interfaceId, int methodId, object[] arguments) { try { if (grain == null) throw new System.ArgumentNullException("grain"); switch (interfaceId) { case -1731488188: // IMyGrainInterface switch (methodId) { default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); }case -1277021679: // IGrainWithStringKey switch (methodId) { default: throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId); } default: throw new System.InvalidCastException("interfaceId="+interfaceId); } } catch(Exception ex) { var t = new System.Threading.Tasks.TaskCompletionSource<object>(); t.SetException(ex); return t.Task; } }