public async void OnConnectBtnClicked(object sender, EventArgs e) { var host = viewModel.CurretSelectHost; if (host == null) { await DisplayAlert( Resx.TextResource.Common_AlertTitle, Resx.TextResource.Hosts_PleaseAddHost, Resx.TextResource.Common_OK); return; } try { File.WriteAllText(App.Instance.ConfigPath, viewModel.CurretSelectHost.PrepareConfig(viewModel)); App.Instance.Start(); viewModel.IsConnectBtnEnabled = false; viewModel.SetHostGoingToRun(host.HostName); } catch (Exception ex) { Console.WriteLine(ex.Message + "\n" + ex.StackTrace); } }
public async void OnConnectBtnClicked(object sender, EventArgs e) { var host = viewModel.CurretSelectHost; if (host == null) { await DisplayAlert( Resx.TextResource.Common_AlertTitle, Resx.TextResource.Hosts_PleaseAddHost, Resx.TextResource.Common_OK); return; } if (host.EnablePipeline && host.LoadBalance.Count > 0) { var hasInvalid = host.LoadBalance.Any(h => { var n = viewModel.FindHostByName(h); return(n == null || !n.EnablePipeline); }); if (hasInvalid) { await DisplayAlert( Resx.TextResource.Common_AlertTitle, Resx.TextResource.Hosts_LoadBalanceNodeError, Resx.TextResource.Common_OK); return; } } try { File.WriteAllText(App.Instance.ConfigPath, host.PrepareConfig(viewModel)); App.Instance.Start(viewModel.DataStore.Settings); viewModel.IsConnectBtnEnabled = false; viewModel.SetHostGoingToRun(host.HostName); } catch (Exception ex) { Console.WriteLine(ex.Message + "\n" + ex.StackTrace); } }