public override void OnReceive(Context context, Intent intent) { if (RsClient.hubConnection == null || RsClient.hubConnection.State != HubConnectionState.Connected) { RsClient.BuildOrReBuldHub(); RsClient.StartAsync(); } }
protected override void OnResume() { if (RsClient.hubConnection == null || RsClient.hubConnection.State != HubConnectionState.Connected) { RsClient.BuildOrReBuldHub(); RsClient.StartAsync(); } base.OnResume(); }
async protected override void OnLoad(EventArgs e) { #region ico ico = new NotifyIcon(); ico.Icon = (Icon)resources.GetObject("$this.Icon"); ico.Visible = true; ico.DoubleClick += delegate(object sender, EventArgs args) { Show(); ShowInTaskbar = true; WindowState = FormWindowState.Normal; }; var menuStrip = new ContextMenuStrip(); menuStrip.Items.Add("Выход", null, delegate { NoCancel = false; Close(); }); ico.ContextMenuStrip = menuStrip; #endregion #region RsClient tb_log.Text = "Connection.."; RsClient.OnDestroy += () => { }; RsClient.OnLog += log => tb_log.Text += log + Environment.NewLine; RsClient.OnClearLog += () => tb_log.Text = string.Empty; RsClient.BuildOrReBuldHub(); await RsClient.StartAsync(); #endregion base.OnLoad(e); }
async static Task Main(string[] args) { RsClient.OnDestroy += () => Console.ForegroundColor = ConsoleColor.Red; RsClient.OnLog += log => Console.WriteLine(log); RsClient.OnClearLog += () => { if (Environment.OSVersion.Platform == PlatformID.Win32NT) { Console.Clear(); } }; Console.WriteLine("Connection.."); RsClient.BuildOrReBuldHub(); await RsClient.StartAsync(); do { Console.ReadLine(); await Task.Delay(40); }while (Environment.OSVersion.Platform == PlatformID.Unix); }