public void GetTimeInput(AcceptDelegate onAccept, Action onCancel) { this.onAccept = onAccept; this.onCancel = onCancel; timeString = ""; timeNum = 0; timeInput.Show(); }
/// <summary> /// Visits all included view models under the specified view model. /// </summary> private static void visit(object viewModel, Action <INotifyPropertyChanged> visitPropertyChangedNode, Action <INotifyCollectionChanged> visitCollectionChangedNode, AcceptDelegate visitProperty) { Contract.Requires(viewModel != null); if (viewModel is INotifyPropertyChanged pc) { visitPropertyChangedNode?.Invoke(pc); } if (viewModel is INotifyCollectionChanged cc) { visitCollectionChangedNode?.Invoke(cc); } if (viewModel is INotifyPropertyChanged container) { foreach (var propertyInfo in GetIncludedProperties(container)) { var value = new Lazy <object>(() => propertyInfo.GetValue(viewModel)); if (visitProperty != null && IncludeProperty(viewModel, propertyInfo)) { visitProperty(viewModel, propertyInfo, value.Value); } if (IncludeDeep(viewModel, propertyInfo)) { visit(value.Value, visitPropertyChangedNode, visitCollectionChangedNode, visitProperty); } } } if (viewModel is INotifyCollectionChanged collection) { foreach (var item in GetIncludedItems(collection)) { visitProperty?.Invoke(viewModel, null, item); if (IncludeDeep(collection, item)) { visit(item, visitPropertyChangedNode, visitCollectionChangedNode, visitProperty); } } } }
private bool StoreChangesRequest(AcceptDelegate handler) { if (!ArgsValid()) { return(false); } new AlertDialog.Builder(this) .SetPositiveButton(Resource.String.button_yes, (sender, args) => { handler(true); }) .SetNegativeButton(Resource.String.button_no, (sender, args) => { handler(false); }) .SetMessage(Resource.String.arg_assist_apply_args) .SetTitle(Resource.String.alert_title_question) .Show(); return(true); }
/// <summary> /// Main async accept method /// </summary> private void _listen() { while (!Interrupt) { // Begin listening AcceptDelegate acceptDelegate = new AcceptDelegate(Accept); IAsyncResult result = acceptDelegate.BeginInvoke(AsyncRes, null); while (!result.AsyncWaitHandle.WaitOne(AcceptCheckMs)) // Keep alive and check to broke { if (Interrupt) // In case of interrupt { if (Connected) { Disconnect(false); } Close(); return; } } } }
/// <summary> /// Method for handling connection from async call /// </summary> /// <param name="result">Some stuff</param> private void AsyncRes(IAsyncResult result) { Socket client = null; try { AsyncResult res = (AsyncResult)result; AcceptDelegate caller = (AcceptDelegate)res.AsyncDelegate; // Get client' socket client = caller.EndInvoke(res); // Get data for QueryEvent byte[] data = new byte[ReceiveBufferSize]; int size = client.Receive(data); IPEndPoint clientEP = client.RemoteEndPoint as IPEndPoint; // Msg(String.Format("Received {0} byte(s) from ip: {1}.", size, clientEP.Address)); if (OnConnect != null) { OnConnect(clientEP, data.Take(size).ToArray()); } else { client.Disconnect(false); client.Close(); } } catch (Exception) { Msg("Server was closed"); if (OnClose != null) { OnClose(); } return; } }
/// <summary> /// Visits all included properties and collection items under the specified view model. /// </summary> public static void VisitProperties(object viewModel, AcceptDelegate visitNode) { visit(viewModel, null, null, visitNode); }
/// <summary> /// Main async accept method /// </summary> private void _listen() { while (!Interrupt) { // Begin listening AcceptDelegate acceptDelegate = new AcceptDelegate(Accept); IAsyncResult result = acceptDelegate.BeginInvoke(AsyncRes, null); while (!result.AsyncWaitHandle.WaitOne(AcceptCheckMs)) // Keep alive and check to broke { if (Interrupt) // In case of interrupt { if (Connected) Disconnect(false); Close(); return; } } } }
public void Listen(int backlog, AcceptDelegate on_accept) { sock.Listen(backlog); accept_event += on_accept; }
public SockSessServer() { accept_event = null; }