private async void checkData() { this.showProgress("Checking the login data ..."); #if false spglb.reinit(this); Boolean inited = await spglb.myClient.init(); this.showProgress(""); if (!inited) { lblResult.Text = DateTime.Now.ToString() + " could not connect with server." + Environment.NewLine + spglb.myClient.initError; } else { lblResult.Text = DateTime.Now.ToString() + " connected with server."; } #else HMS.Auth.Login hmsLogin = null; HMS.SP.SPEndpoints.SPEndpoints spEP = null; if (spOnlineLayout.IsVisible == true) { hmsLogin = new HMS.Auth.LoginSPO(spOnlineEntries["server"].Text, spOnlineEntries["user"].Text, spOnlineEntries["password"].Text); spEP = new HMS.SP.SPEndpoints.SPOnline(); } else if (sp2016Layout.IsVisible == true) { hmsLogin = new HMS.Auth.LoginNTLM(sp2016Entries["server"].Text, sp2016Entries["domain"].Text, sp2016Entries["user"].Text, sp2016Entries["password"].Text); spEP = new HMS.SP.SPEndpoints.SPOnline(); } else if (sp2010Layout.IsVisible == true) { hmsLogin = new HMS.Auth.LoginNTLM(sp2010Entries["server"].Text, sp2010Entries["domain"].Text, sp2010Entries["user"].Text, sp2010Entries["password"].Text); spEP = new HMS.SP.SPEndpoints.SP2010(); } if (hmsLogin != null) { hmsLogin.showProgress = showProgress; hmsLogin.setPlatform(this.platform); string ret = await hmsLogin.getJSON(spEP.Root); Boolean inited = hmsLogin.inited; this.showProgress(""); if (!inited) { lblResult.Text = DateTime.Now.ToString() + " could not connect with server." + Environment.NewLine + hmsLogin.initError; } else { lblResult.Text = DateTime.Now.ToString() + " connected with server."; } } else { lblResult.Text = DateTime.Now.ToString() + " no server set."; } #endif }
private void update() { lbl.Text = "loading .."; string ret = ""; Task.Run(async() => { HMS.Auth.Login hmsLogin = new HMS.Auth.LoginNTLM("http://192.168.30.109/NTLM", "winxmap", "authtest", "hello@123"); HMS.Auth.haHttpClient.hmsClient = hmsClient; hmsLogin.setPlatform(this.platform); ret = await hmsLogin.getJSON("data.json"); }).Wait(); lbl.Text = ret; }