Der Login läuft jetzt mit RestSharp.
Die Akzentfarbe von den Chatgruppen vom Server wird berücksichtigt. Bilder sind im richtigen Seitenverhältnis skaliert. Ein Bild, das man gerade erst verschickt hat und das man öffnen will, bevor es auf dem Server angekommen ist, wird jetzt erst angezeigt, sobald es auf dem Server ist. Die Textbox für eine neue Nachricht wird nur angezeigt, wenn eine Gruppe ausgewählt ist und wenn man das Recht hat Nachrichten an diese Gruppe zu verschicken. Diverse Codeverbesserungen.
This commit is contained in:
@@ -1,52 +1,95 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Threading;
|
||||
using ChatController.Annotations;
|
||||
using ChatController.HauptKlassen;
|
||||
using ChatController.LoginKlassen;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using ChatController.Utilities;
|
||||
using ChatController.Utilities.Extensions;
|
||||
using Cursors = System.Windows.Input.Cursors;
|
||||
using KeyEventArgs = System.Windows.Input.KeyEventArgs;
|
||||
using MessageBox = System.Windows.MessageBox;
|
||||
using Path = System.IO.Path;
|
||||
|
||||
namespace ChatController
|
||||
{
|
||||
public partial class LoginControl
|
||||
public partial class LoginControl : INotifyPropertyChanged
|
||||
{
|
||||
private ChatControlWaitLayer _WaitLayer;
|
||||
|
||||
public string UserName
|
||||
{
|
||||
get => _Benutzername;
|
||||
|
||||
set
|
||||
{
|
||||
if (!Equals(_Benutzername, value))
|
||||
{
|
||||
_Benutzername = value;
|
||||
OnPropertyChanged(nameof(UserName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string Password
|
||||
{
|
||||
get => PasswordBox.Password;
|
||||
|
||||
set => PasswordBox.Password = value;
|
||||
}
|
||||
|
||||
public string ChatCode
|
||||
{
|
||||
get => _ChatCode;
|
||||
|
||||
set
|
||||
{
|
||||
if(!Equals(_ChatCode, value))
|
||||
{
|
||||
_ChatCode = value;
|
||||
OnPropertyChanged(nameof(ChatCode));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string Tenant
|
||||
{
|
||||
get => _Kundennummer;
|
||||
|
||||
set
|
||||
{
|
||||
if(!Equals(_Kundennummer, value))
|
||||
{
|
||||
_Kundennummer = value;
|
||||
OnPropertyChanged(nameof(Tenant));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void LoginDelegate(ChatDatenUebergabe cdu);
|
||||
|
||||
public event LoginDelegate OnLogin;
|
||||
|
||||
private string _newUrl = "https://dict.ownchat.de/api/server/resolve/1/";
|
||||
private string _benutzername = "";
|
||||
private string _passwort = "";
|
||||
private string _chatCode = "";
|
||||
private string _kundennummer = "";
|
||||
private string _authToken = "";
|
||||
private string _version = "1.3";
|
||||
private string _Benutzername = string.Empty;
|
||||
private string _ChatCode = string.Empty;
|
||||
private string _Kundennummer = string.Empty;
|
||||
private readonly string _Version = "1.3";
|
||||
|
||||
public string Version => $"Version: {_Version}";
|
||||
|
||||
public LoginControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
//encrypt verschlüsselte datei
|
||||
DataContext = this;
|
||||
|
||||
LeseDateiFallsVorhanden();
|
||||
|
||||
//var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
|
||||
lblVersion.Content = $"Version: {_version}";
|
||||
|
||||
#if DEBUG
|
||||
TextBoxBenutzerName.Text = "BaeurleC";
|
||||
TextBoxPasswort.Password = "asFdgAE5ERfdsew4!";
|
||||
#endif
|
||||
}
|
||||
|
||||
private void AnmeldenButton_OnClick(object sender, RoutedEventArgs e)
|
||||
@@ -54,35 +97,67 @@ namespace ChatController
|
||||
Anmelden();
|
||||
}
|
||||
|
||||
private void TextBoxPasswort_OnKeyUp(object sender, KeyEventArgs e)
|
||||
private void StartWaiting()
|
||||
{
|
||||
if (e.Key == Key.Return)
|
||||
Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) StartWaitingImmediately);
|
||||
}
|
||||
|
||||
private void StartWaitingImmediately()
|
||||
{
|
||||
if (_WaitLayer == null)
|
||||
{
|
||||
Anmelden();
|
||||
_WaitLayer = new ChatControlWaitLayer();
|
||||
Panel.SetZIndex(_WaitLayer, int.MaxValue);
|
||||
RootGrid.Children.Add(_WaitLayer);
|
||||
_WaitLayer.RefreshUI();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void EndWaiting()
|
||||
{
|
||||
Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate
|
||||
{
|
||||
if (_WaitLayer != null)
|
||||
{
|
||||
RootGrid.Children.Remove(_WaitLayer);
|
||||
_WaitLayer = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void Anmelden()
|
||||
{
|
||||
try
|
||||
{
|
||||
//TODO Abfrage einführen, die prüft, ob eine Verbindung überhaupt hergestellt werden kann | Fehlermeldungen genauer definieren
|
||||
if (!TextBoxKundennummer.Text.Equals("") && !TextBoxChatCode.Text.Equals("") && !TextBoxBenutzerName.Text.Equals("") && !TextBoxPasswort.Password.Equals(""))
|
||||
if (!string.IsNullOrWhiteSpace(_Kundennummer) && !string.IsNullOrWhiteSpace(_ChatCode) && !string.IsNullOrWhiteSpace(_Benutzername) && Password.Length > 0)
|
||||
{
|
||||
Cursor = Cursors.Wait;
|
||||
StartWaiting();
|
||||
|
||||
var _login = new Login(TextBoxKundennummer.Text, TextBoxChatCode.Text, TextBoxBenutzerName.Text, TextBoxPasswort.Password);
|
||||
var login = new Login(_Kundennummer, _ChatCode, _Benutzername, PasswordBox.Password);
|
||||
|
||||
var x = _login.AnmeldevorgangDurchFuehren();
|
||||
|
||||
if (OnLogin != null && x != null)
|
||||
login.DoLoginAsync(chatDatenUebergabe =>
|
||||
{
|
||||
AutosetDaten();
|
||||
this.Dispatch(() =>
|
||||
{
|
||||
EndWaiting();
|
||||
|
||||
OnLogin?.Invoke(x);
|
||||
}
|
||||
if(chatDatenUebergabe != null)
|
||||
{
|
||||
AutosetDaten();
|
||||
|
||||
Cursor = Cursors.Arrow;
|
||||
OnLogin?.Invoke(chatDatenUebergabe);
|
||||
}
|
||||
});
|
||||
},
|
||||
errorMessage =>
|
||||
{
|
||||
this.Dispatch(() =>
|
||||
{
|
||||
EndWaiting();
|
||||
|
||||
MessageBox.Show(errorMessage, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
});
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -92,183 +167,78 @@ namespace ChatController
|
||||
catch (Exception exception)
|
||||
{
|
||||
MessageBox.Show("Fehler: " + exception.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
EndWaiting();
|
||||
Cursor = Cursors.Arrow;
|
||||
}
|
||||
}
|
||||
|
||||
#region Speichern / Laden / Löschen der Datei
|
||||
|
||||
#region wird vorerst nicht gebraucht
|
||||
private void SpeichereDatenInDatei()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!File.Exists(Path.Combine(GetAndCreateUserAppDataPath(), "OwnChatX1253781.txt"))) {
|
||||
using (StreamWriter sw = new StreamWriter(Path.Combine(GetAndCreateUserAppDataPath(), "OwnChatX1253781.txt")))
|
||||
{
|
||||
|
||||
Encoding enc = new UTF8Encoding();
|
||||
//var byt = enc.GetBytes(TextBoxKundennummer.Text);
|
||||
//var bytes = Convert.ToBase64String(byt);
|
||||
|
||||
//var byt2 = enc.GetBytes(TextBoxChatCode.Text);
|
||||
//var bytes2 = Convert.ToBase64String(byt2);
|
||||
|
||||
var byt3 = enc.GetBytes(TextBoxBenutzerName.Text);
|
||||
var bytes3 = Convert.ToBase64String(byt3);
|
||||
|
||||
|
||||
var byt4 = enc.GetBytes(TextBoxPasswort.Password);
|
||||
var bytes4 = Convert.ToBase64String(byt4);
|
||||
|
||||
//var byt5 = enc.GetBytes(Merken.IsChecked.ToString());
|
||||
//var bytes5 = Convert.ToBase64String(byt5);
|
||||
|
||||
|
||||
//sw.WriteLine(bytes);
|
||||
//sw.WriteLine(bytes2);
|
||||
sw.WriteLine(bytes3);
|
||||
sw.WriteLine(bytes4);
|
||||
//sw.WriteLine(bytes5);
|
||||
|
||||
File.SetAttributes(Path.Combine(GetAndCreateUserAppDataPath(), "OwnChatX1253781.txt"), FileAttributes.ReadOnly);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show("Ups, da ist was schief gelaufen: \n" + e.Message, "Fehler", MessageBoxButton.OK);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoescheGespeicherteDatei()
|
||||
private void LoadTenantAndChatCodeFromFile()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (File.Exists(Path.Combine(GetAndCreateUserAppDataPath(), "OwnChatX1253781.txt")))
|
||||
if(File.Exists(Path.Combine(GetAndCreateUserAppDataPath(), Constants.TenantAndChatCodeFileName)))
|
||||
{
|
||||
File.SetAttributes(Path.Combine(GetAndCreateUserAppDataPath(), "OwnChatX1253781.txt"), FileAttributes.Normal);
|
||||
File.Delete(Path.Combine(GetAndCreateUserAppDataPath(), "OwnChatX1253781.txt"));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show("Ups, da ist was schief gelaufen: \n" + e.Message, "Fehler", MessageBoxButton.OK);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void LeseDateiFallsVorhanden()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (File.Exists(Path.Combine(GetAndCreateUserAppDataPath(), "OwnChat.txt")))
|
||||
{
|
||||
List<string> merkdaten = new List<string>();
|
||||
using (StreamReader sr = new StreamReader(Path.Combine(GetAndCreateUserAppDataPath(), "OwnChat.txt"), true))
|
||||
var lines = new List<string>();
|
||||
using(var streamReader = new StreamReader(Path.Combine(GetAndCreateUserAppDataPath(), Constants.TenantAndChatCodeFileName), true))
|
||||
{
|
||||
string line = "";
|
||||
string line;
|
||||
|
||||
while ((line = sr.ReadLine()) != null)
|
||||
while((line = streamReader.ReadLine()) != null)
|
||||
{
|
||||
var encodedTextBytes = Convert.FromBase64String(line);
|
||||
|
||||
string plainText = Encoding.UTF8.GetString(encodedTextBytes);
|
||||
var plainText = Encoding.UTF8.GetString(encodedTextBytes);
|
||||
|
||||
merkdaten.Add(plainText);
|
||||
lines.Add(plainText);
|
||||
}
|
||||
}
|
||||
|
||||
if (merkdaten.Count == 2)
|
||||
if(lines.Count == 2)
|
||||
{
|
||||
TextBoxKundennummer.Text = merkdaten[0];
|
||||
TextBoxChatCode.Text = merkdaten[1];
|
||||
_Kundennummer = lines[0];
|
||||
_ChatCode = lines[1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//if (File.Exists(Path.Combine(GetAndCreateUserAppDataPath(), "OwnChatX1253781.txt"))) {
|
||||
|
||||
// List<string> daten = new List<string>();
|
||||
// using (StreamReader sr = new StreamReader(Path.Combine(GetAndCreateUserAppDataPath(), "OwnChatX1253781.txt"), true))
|
||||
// {
|
||||
// string line = "";
|
||||
|
||||
// while ((line = sr.ReadLine()) != null)
|
||||
// {
|
||||
// var encodedTextBytes = Convert.FromBase64String(line);
|
||||
|
||||
// string plainText = Encoding.UTF8.GetString(encodedTextBytes);
|
||||
|
||||
// daten.Add(plainText);
|
||||
// }
|
||||
// }
|
||||
|
||||
// if(daten.Count == 3) {
|
||||
|
||||
// TextBoxBenutzerName.Text = daten[0];
|
||||
// TextBoxPasswort.Password = daten[1];
|
||||
// // Merken.IsChecked = Convert.ToBoolean(daten[2]);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
catch (Exception e)
|
||||
catch(Exception e)
|
||||
{
|
||||
MessageBox.Show("Ups, da ist was schief gelaufen: \n" + e.Message, "Fehler", MessageBoxButton.OK);
|
||||
MessageBox.Show("Fehler: \n" + e.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void LeseDateiFallsVorhanden()
|
||||
{
|
||||
LoadTenantAndChatCodeFromFile();
|
||||
}
|
||||
|
||||
private void AutosetDaten()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!File.Exists(Path.Combine(GetAndCreateUserAppDataPath(), "ownChat.txt")))
|
||||
if(File.Exists(Path.Combine(GetAndCreateUserAppDataPath(), Constants.TenantAndChatCodeFileName)))
|
||||
{
|
||||
using (
|
||||
StreamWriter sw = new StreamWriter(Path.Combine(GetAndCreateUserAppDataPath(), "ownChat.txt")))
|
||||
{
|
||||
|
||||
Encoding enc = new UTF8Encoding();
|
||||
var byt = enc.GetBytes(TextBoxKundennummer.Text);
|
||||
var bytes = Convert.ToBase64String(byt);
|
||||
|
||||
var byt2 = enc.GetBytes(TextBoxChatCode.Text);
|
||||
var bytes2 = Convert.ToBase64String(byt2);
|
||||
|
||||
sw.WriteLine(bytes);
|
||||
sw.WriteLine(bytes2);
|
||||
|
||||
File.SetAttributes(Path.Combine(GetAndCreateUserAppDataPath(), "ownChat.txt"),
|
||||
FileAttributes.ReadOnly);
|
||||
}
|
||||
File.SetAttributes(Path.Combine(GetAndCreateUserAppDataPath(), Constants.TenantAndChatCodeFileName), FileAttributes.Normal);
|
||||
File.Delete(Path.Combine(GetAndCreateUserAppDataPath(), Constants.TenantAndChatCodeFileName));
|
||||
}
|
||||
else
|
||||
|
||||
using(var streamWriter = new StreamWriter(Path.Combine(GetAndCreateUserAppDataPath(), Constants.TenantAndChatCodeFileName)))
|
||||
{
|
||||
File.SetAttributes(Path.Combine(GetAndCreateUserAppDataPath(), "ownChat.txt"), FileAttributes.Normal);
|
||||
File.Delete(Path.Combine(GetAndCreateUserAppDataPath(), "ownChat.txt"));
|
||||
Encoding utf8Encoding = new UTF8Encoding();
|
||||
var tenantBytes = utf8Encoding.GetBytes(_Kundennummer);
|
||||
var encodedTenant = Convert.ToBase64String(tenantBytes);
|
||||
|
||||
using (
|
||||
StreamWriter sw = new StreamWriter(Path.Combine(GetAndCreateUserAppDataPath(), "ownChat.txt")))
|
||||
{
|
||||
var chatCodeBytes = utf8Encoding.GetBytes(_ChatCode);
|
||||
var encodedChatCode = Convert.ToBase64String(chatCodeBytes);
|
||||
|
||||
Encoding enc = new UTF8Encoding();
|
||||
var byt = enc.GetBytes(TextBoxKundennummer.Text);
|
||||
var bytes = Convert.ToBase64String(byt);
|
||||
streamWriter.WriteLine(encodedTenant);
|
||||
streamWriter.WriteLine(encodedChatCode);
|
||||
|
||||
var byt2 = enc.GetBytes(TextBoxChatCode.Text);
|
||||
var bytes2 = Convert.ToBase64String(byt2);
|
||||
|
||||
sw.WriteLine(bytes);
|
||||
sw.WriteLine(bytes2);
|
||||
|
||||
File.SetAttributes(Path.Combine(GetAndCreateUserAppDataPath(), "ownChat.txt"),
|
||||
FileAttributes.ReadOnly);
|
||||
}
|
||||
File.SetAttributes(Path.Combine(GetAndCreateUserAppDataPath(), Constants.TenantAndChatCodeFileName), FileAttributes.ReadOnly);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show("Ups, da ist was schief gelaufen: \n" + e.Message, "Fehler", MessageBoxButton.OK);
|
||||
MessageBox.Show("Fehler: \n" + e.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,19 +246,20 @@ namespace ChatController
|
||||
{
|
||||
try
|
||||
{
|
||||
string localAppData = Environment.GetFolderPath(
|
||||
Environment.SpecialFolder.LocalApplicationData);
|
||||
string companyFilePath
|
||||
= Path.Combine(localAppData, "beyondSoft");
|
||||
var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
||||
var companyFilePath = Path.Combine(localAppData, "beyondSoft");
|
||||
|
||||
if (!Directory.Exists(companyFilePath))
|
||||
{
|
||||
Directory.CreateDirectory(companyFilePath);
|
||||
}
|
||||
|
||||
string bewoFilePath
|
||||
= Path.Combine(companyFilePath, "OwnChat");
|
||||
var bewoFilePath = Path.Combine(companyFilePath, "OwnChat");
|
||||
|
||||
if (!Directory.Exists(bewoFilePath))
|
||||
{
|
||||
Directory.CreateDirectory(bewoFilePath);
|
||||
}
|
||||
|
||||
return bewoFilePath;
|
||||
}
|
||||
@@ -301,157 +272,17 @@ namespace ChatController
|
||||
return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
//Neue Region zum VErschlüsseln und entschlüsseln der Daten
|
||||
#region Verschlüsseln/Entschlüsseln via Link // wird ersmal nicht mehr gebraucht
|
||||
|
||||
//TODO Kann erst nach erfolgreichem Login verschlüsselt werden
|
||||
|
||||
private bool Verschluss()
|
||||
{
|
||||
try
|
||||
{
|
||||
string URl = _newUrl + "api/ownchat/user/encryptcredentials";
|
||||
|
||||
string postdaten = "";
|
||||
|
||||
Dictionary<string, string> postparameter = new Dictionary<string, string>();
|
||||
|
||||
postparameter.Add("username", _benutzername);
|
||||
postparameter.Add("password", _passwort);
|
||||
|
||||
//neu | hinzufügen laut document
|
||||
postparameter.Add("chatcode", _chatCode);
|
||||
|
||||
int i = 0;
|
||||
foreach (var key in postparameter.Keys)
|
||||
{
|
||||
//hier noch chatcode übergeben
|
||||
postdaten += HttpUtility.UrlEncode(key) + "=" + HttpUtility.UrlEncode(postparameter[key]) + "&";
|
||||
|
||||
}
|
||||
|
||||
WebRequest requesten = WebRequest.Create(URl);
|
||||
|
||||
requesten.Method = "POST";
|
||||
requesten.ContentType = "application/x-www-form-urlencoded";
|
||||
requesten.Headers["Token"] = _authToken;
|
||||
requesten.Headers["CustomerID"] = _kundennummer;
|
||||
|
||||
byte[] daten = Encoding.ASCII.GetBytes(postdaten);
|
||||
|
||||
requesten.ContentLength = daten.Length;
|
||||
|
||||
try
|
||||
{
|
||||
Stream requestStream = requesten.GetRequestStream();
|
||||
|
||||
requestStream.Write(daten, 0, daten.Length);
|
||||
|
||||
requestStream.Close();
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show("Es konnte keine Verbindung aufgebaut werden.", "Fehler", MessageBoxButton.OK);
|
||||
return false;
|
||||
}
|
||||
|
||||
//response bereich | Verarbeiten
|
||||
HttpWebResponse myHttpWebResponse = (HttpWebResponse)requesten.GetResponse();
|
||||
|
||||
Stream responseStream = myHttpWebResponse.GetResponseStream();
|
||||
|
||||
StreamReader myStreamReader = new StreamReader(responseStream, Encoding.Default);
|
||||
|
||||
var pageContent = myStreamReader.ReadToEnd();
|
||||
|
||||
|
||||
//Bereich zum Verarbeiten der Erhaltenen Daten
|
||||
var definiti = new { encryped = ""};
|
||||
|
||||
var jsonDatentyp = JsonConvert.DeserializeAnonymousType(pageContent, definiti);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show("Beim Verschlüsseln ist was schief gelaufen. \n" + e.Message,"Fehler",MessageBoxButton.OK);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private byte[] mediaDatei;
|
||||
|
||||
|
||||
//TODO Entschluss weiter ausprogrammieren
|
||||
private bool Entschluss()
|
||||
{
|
||||
try
|
||||
{
|
||||
string URl = _newUrl + "api/ownchat/user/decryptcredentials";
|
||||
|
||||
|
||||
WebRequest requesten = WebRequest.Create(URl);
|
||||
|
||||
requesten.Method = "POST";
|
||||
requesten.ContentType = "application/x-www-form-urlencoded";
|
||||
requesten.Headers["CustomerID"] = _kundennummer;
|
||||
|
||||
byte[] daten = mediaDatei;
|
||||
|
||||
requesten.ContentLength = daten.Length;
|
||||
|
||||
try
|
||||
{
|
||||
Stream requestStream = requesten.GetRequestStream();
|
||||
|
||||
requestStream.Write(daten, 0, daten.Length);
|
||||
|
||||
requestStream.Close();
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show("Es konnte keine Verbindung aufgebaut werden.", "Fehler", MessageBoxButton.OK);
|
||||
return false;
|
||||
}
|
||||
|
||||
//erhalte response
|
||||
HttpWebResponse myHttpWebResponse = (HttpWebResponse)requesten.GetResponse();
|
||||
|
||||
Stream responseStream = myHttpWebResponse.GetResponseStream();
|
||||
|
||||
StreamReader myStreamReader = new StreamReader(responseStream, Encoding.Default);
|
||||
|
||||
var pageContent = myStreamReader.ReadToEnd();
|
||||
|
||||
//Bereich zum Verarbeiten der Erhaltenen Daten
|
||||
var definiti = new { encrypted = "" };
|
||||
|
||||
var jsonDatentyp = JsonConvert.DeserializeAnonymousType(pageContent, definiti);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show("Beim Entschlüsseln ist was schief gelaufen. \n" + e.Message, "Fehler", MessageBoxButton.OK);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
public void Login()
|
||||
{
|
||||
Anmelden();
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user