diff --git a/PWAPPv2/Config/Config.xml b/Config/Config.xml
similarity index 100%
rename from PWAPPv2/Config/Config.xml
rename to Config/Config.xml
diff --git a/Config/PracticeConfig.xml b/Config/PracticeConfig.xml
new file mode 100644
index 0000000..2296f93
--- /dev/null
+++ b/Config/PracticeConfig.xml
@@ -0,0 +1,10 @@
+
+
+ 10.0.1.107
+ root
+
+ testdoctor
+ testdoctor
+ 210
+ 12345678
+
\ No newline at end of file
diff --git a/Config/UniversalConfig.txt b/Config/UniversalConfig.txt
new file mode 100644
index 0000000..78fa985
--- /dev/null
+++ b/Config/UniversalConfig.txt
@@ -0,0 +1,5 @@
+
+
+ http://apipatientweb.azurewebsites.net/
+ https://localhost:44354/api/PWAppVersion
+
\ No newline at end of file
diff --git a/PWAPPv2.sln b/PWAPPv2.sln
index 9ee99ea..addf15c 100644
--- a/PWAPPv2.sln
+++ b/PWAPPv2.sln
@@ -1,10 +1,12 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.33529.622
+# Visual Studio Version 17
+VisualStudioVersion = 17.8.34330.188
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PWAPPv2", "PWAPPv2\PWAPPv2.csproj", "{45E26AF8-41D7-4308-A2C8-D55A0350DB47}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PWAppUpdaterForm", "PWAppUpdater2\PWAppUpdaterForm.csproj", "{093798DD-2EDD-4519-AAC6-9DFF0DE3C15A}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -15,6 +17,10 @@ Global
{45E26AF8-41D7-4308-A2C8-D55A0350DB47}.Debug|Any CPU.Build.0 = Debug|Any CPU
{45E26AF8-41D7-4308-A2C8-D55A0350DB47}.Release|Any CPU.ActiveCfg = Release|Any CPU
{45E26AF8-41D7-4308-A2C8-D55A0350DB47}.Release|Any CPU.Build.0 = Release|Any CPU
+ {093798DD-2EDD-4519-AAC6-9DFF0DE3C15A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {093798DD-2EDD-4519-AAC6-9DFF0DE3C15A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {093798DD-2EDD-4519-AAC6-9DFF0DE3C15A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {093798DD-2EDD-4519-AAC6-9DFF0DE3C15A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/PWAPPv2/App.xaml.cs b/PWAPPv2/App.xaml.cs
index 1f66738..7e80dca 100644
--- a/PWAPPv2/App.xaml.cs
+++ b/PWAPPv2/App.xaml.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Data;
-using System.Linq;
-using System.Threading.Tasks;
-using System.Windows;
+using System.Windows;
namespace PWAPPv2
{
@@ -16,7 +10,7 @@ namespace PWAPPv2
public static string[] Args;
void app_Startup(object sender, StartupEventArgs e)
{
- if(e.Args.Length > 0)
+ if (e.Args.Length > 0)
{
Args = e.Args;
}
diff --git a/PWAPPv2/MainWindow.xaml b/PWAPPv2/MainWindow.xaml
index 57a5183..937d118 100644
--- a/PWAPPv2/MainWindow.xaml
+++ b/PWAPPv2/MainWindow.xaml
@@ -69,7 +69,7 @@
-
+
@@ -81,7 +81,7 @@
-
+
@@ -94,8 +94,8 @@
-
-
+
+
diff --git a/PWAPPv2/MainWindow.xaml.cs b/PWAPPv2/MainWindow.xaml.cs
index 2e7c7ce..7ad0596 100644
--- a/PWAPPv2/MainWindow.xaml.cs
+++ b/PWAPPv2/MainWindow.xaml.cs
@@ -1,19 +1,10 @@
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Diagnostics;
+using System.IO;
using System.Windows;
using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
-using System.IO;
-using Microsoft.Win32;
+using System.Windows.Forms;
/**
* TODO:
@@ -27,21 +18,32 @@ namespace PWAPPv2
///
public partial class MainWindow : Window
{
- static Source.APIConfig apiconfig = new Source.APIConfig();
+ static Source.APIConfig apiconfig;// = new Source.APIConfig();
static Source.Database.DatabaseConfig DataConfig;
static Source.API.APIConnection apiConnection;
Source.DataObjects.APICredentials apiCreds;
+ Source.API.PWApiConnection pwapiConnection;
+
Source.DataObjects.ComboBoxData TypeBox;
Source.DataObjects.ComboBoxData ToBox;
Source.DataObjects.ComboBoxData FromBox;
+ Source.Config.Configuration practiceConfig;
+ Source.Config.Configuration universalConfig;
+
+
string[] args;
Source.Patient patient;
- List images;
+ List attachments;
+
+
+ //string ConfigPath = "C:\\PWAPP\\Config\\Config.xml";
+
+ string ConfigPath;
public MainWindow()
{
@@ -49,30 +51,91 @@ namespace PWAPPv2
{
args = App.Args;
}
- catch(Exception)
+ catch (Exception)
{ }
+ ConfigPath = "C:\\PWAPP\\Config\\";
+ try
+ {
+ //ConfigPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
+ //ConfigPath = Path.Combine(ConfigPath, "PWAPP\\Config\\");
- images = new List();
- apiconfig.LoadConfig("./Config/Config.xml");
- DataConfig = new Source.Database.DatabaseConfig("./Config/Config.xml");
- Source.Database.DatabaseConnection dbcon = new Source.Database.DatabaseConnection(DataConfig);
- apiCreds = new Source.DataObjects.APICredentials(apiconfig);
+ practiceConfig = new Source.Config.Configuration("C:\\PWAPP\\Config\\PracticeConfig.xml");
+ universalConfig = new Source.Config.Configuration("C:\\PWAPP\\App\\Config\\UniversalConfig.xml");
+ }
+ catch
+ (Exception ex)
+ {
+ System.Windows.MessageBox.Show("An error has occured in the configurations files.\n(" + ex.Message + ")");
+ }
- apiConnection = new Source.API.APIConnection("http://apipatientweb.azurewebsites.net/",
- apiCreds);
+ pwapiConnection = new Source.API.PWApiConnection(practiceConfig, universalConfig);
- InitializeComponent();
+ try
+ {
+ if (pwapiConnection.CheckForUpdate() == true)
+ {
+ string message = "An update is available! Would you like to install it?";
+ string title = "Update available!";
+ MessageBoxButtons buttons = MessageBoxButtons.YesNo;
+ DialogResult result = System.Windows.Forms.MessageBox.Show(message, title, buttons);
+ if (result == System.Windows.Forms.DialogResult.Yes)
+ {
+ //System.Windows.MessageBox.Show("HAHA NO UPDATE FOR YOU!");
+ Process p = new Process();
+ p.StartInfo.FileName = "C:\\PWAPP\\Updater\\PWAppUpdaterForm.exe";
+ p.StartInfo.WindowStyle = ProcessWindowStyle.Maximized;
+ p.StartInfo.UseShellExecute = false;
+ p.StartInfo.RedirectStandardOutput = true;
+ p.StartInfo.RedirectStandardError = true;
+ try
+ {
+ p.StartInfo.Arguments = args[0];
+ }
+ catch { }
+ if (System.Environment.OSVersion.Version.Major >= 6)
+ {
+ p.StartInfo.Verb = "runas";
+ }
+ p.Start();
+ Environment.Exit(0);
+ }
+ }
+ }
+ catch (Exception)
+ {
+ System.Windows.MessageBox.Show("An error has occured while checking for updates");
+ }
- PopulateComboBoxes();
+ try
+ {
+ attachments = new List();
- patient = new Source.Patient();
+ Source.Database.DatabaseConnection dbcon = new Source.Database.DatabaseConnection(practiceConfig);
- patient.BuildFromDatabase(dbcon, args[0]);
+ apiconfig = new Source.APIConfig(practiceConfig, universalConfig);
+ apiCreds = new Source.DataObjects.APICredentials(apiconfig);
+ apiConnection = new Source.API.APIConnection(universalConfig.Get("PWBaseURI"), apiCreds);
- this.DataContext = new Source.PatientGUIAdapter(patient);
+ InitializeComponent();
+ PopulateComboBoxes();
+
+ patient = new Source.Patient();
+
+ patient.BuildFromDatabase(dbcon, args[0]);
+
+ this.DataContext = new Source.PatientGUIAdapter(patient);
+ }
+ catch (NullReferenceException)
+ {
+
+ }
+ catch (Exception e)
+ {
+ System.Windows.MessageBox.Show(e.Message);
+ }
}
private void PopulateComboBoxes()
@@ -84,20 +147,21 @@ namespace PWAPPv2
private void PopulateReferTypesBox()
{
- string ReferTypeString = apiConnection.SendPostRequestAsync("api/PWReferralTypes");
+ //string ReferTypeString = apiConnection.SendPostRequestAsync("api/PWReferralTypes");
+ string ReferTypeString = pwapiConnection.GetReferalTypes();
TypeBox = new Source.DataObjects.ReferralTypeBox(boxReferType, ReferTypeString);
}
private void PopulateReferToBox()
{
- string ReferToString = apiConnection.SendPostRequestAsync("api/PWReferTo");
+ string ReferToString = pwapiConnection.GetReferTo(); //apiConnection.SendPostRequestAsync("api/PWReferTo");
ToBox = new Source.DataObjects.ReferToBox(boxReferTo, ReferToString);
}
private void PopulateReferFromBox()
{
- string ReferFromString = apiConnection.SendPostRequestAsync("api/PWReferFrom");
+ string ReferFromString = pwapiConnection.GetReferFrom(); //apiConnection.SendPostRequestAsync("api/PWReferFrom");
FromBox = new Source.DataObjects.ReferFromBox(boxReferFrom, ReferFromString);
}
@@ -122,15 +186,15 @@ namespace PWAPPv2
{
TypeBox.GetSelectedID();
}
- catch(Source.DataObjects.ReferralTypeDefaultException)
+ catch (Source.DataObjects.ReferralTypeDefaultException)
{
}
- catch(Source.DataObjects.InvalidReferralTypeException)
+ catch (Source.DataObjects.InvalidReferralTypeException)
{
}
- catch(NullReferenceException)
+ catch (NullReferenceException)
{
}
@@ -141,12 +205,13 @@ namespace PWAPPv2
{
this.Close();
}
-
+
//OK Button
private void Button_Click_1(object sender, RoutedEventArgs e)
{
Source.DataObjects.Referral referral;
- if(images.Count == 0)
+
+ if (attachments.Count == 0)
{
referral = new Source.DataObjects.Referral(apiCreds, patient,
(Source.DataObjects.ReferralTypeBox)TypeBox,
@@ -163,27 +228,28 @@ namespace PWAPPv2
fieldRemakrs, contact, true);
}
+
try
{
string referralString = referral.ToJsonString();
- string result = apiConnection.SendPostRequestAsync("api/PWMakeReferral", referralString);
- if(images.Count > 0)
+ string result = pwapiConnection.SendReferral(referralString);
+
+
+ if (attachments.Count > 0)
{
- foreach(Source.DataObjects.PWImage im in images)
+ foreach (Source.DataObjects.Attachment attachment in attachments)
{
- Source.DataObjects.Attachment att = new Source.DataObjects.Attachment(apiCreds, im, result);
- string json = att.ToJsonString();
- apiConnection.SendPostRequestAsync("api/PWAttachment", json);
+ attachment.Token = result;
+ string json = attachment.ToJsonString();
+ apiConnection.SendPostWithCredsInHeader("api/PWAttachment", json);
}
- MessageBox.Show("Referral added successfully!");
- }
- else
- {
- MessageBox.Show(result);
}
+
+ System.Windows.MessageBox.Show("Referral added successfully!");
+
this.Close();
}
- catch(Source.DataObjects.Referral.InvalidReferalDataException)
+ catch (Source.DataObjects.Referral.InvalidReferalDataException)
{
}
@@ -192,23 +258,43 @@ namespace PWAPPv2
//AddImage Button
private void Button_Click_2(object sender, RoutedEventArgs e)
{
- OpenFileDialog openFileDialog = new OpenFileDialog();
+ System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog();
openFileDialog.Multiselect = true;
- openFileDialog.Filter = "Image files (*.jpg,*.jpeg)|*.jpg;*.jpeg";
+ openFileDialog.Filter = "Attachment files (*.jpg,*.jpeg,*.pdf)|*.jpg;*.jpeg;*.pdf";
openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
- if(openFileDialog.ShowDialog() == true)
+ if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
foreach (string filename in openFileDialog.FileNames)
{
- try
+ if (Path.GetExtension(filename) == ".jpg" || Path.GetExtension(filename) == ".jpeg")
{
- images.Add(new Source.DataObjects.PWImage(filename));
+ try
+ {
+ attachments.Add(new Source.DataObjects.Attachment(apiCreds, new Source.DataObjects.PWImage(filename)));
+ }
+ catch (NullReferenceException)
+ {
+
+ attachments = new List
+ {
+ new Source.DataObjects.Attachment(apiCreds, new Source.DataObjects.PWImage(filename))
+ };
+ }
}
- catch(NullReferenceException)
+ if (Path.GetExtension(filename) == ".pdf")
{
- images = new List();
- images.Add(new Source.DataObjects.PWImage(filename));
+ try
+ {
+ attachments.Add(new Source.DataObjects.Attachment(apiCreds, new Source.DataObjects.PWPdf(filename)));
+ }
+ catch (NullReferenceException)
+ {
+ attachments = new List()
+ {
+ new Source.DataObjects.Attachment(apiCreds, new Source.DataObjects.PWPdf(filename))
+ };
+ }
}
}
@@ -217,12 +303,20 @@ namespace PWAPPv2
try
{
ImageList.Items.Clear();
- foreach (Source.DataObjects.PWImage image in images)
+
+ foreach (var attachment in attachments)
{
- ImageList.Items.Add(CreateImageGridItem(image));
+ if (attachment.image == null)
+ {
+ ImageList.Items.Add(CreateImageGridItem(new Source.DataObjects.PWImage("C:\\PWAPP\\App\\App\\pdf.jpg")));
+ }
+ else
+ {
+ ImageList.Items.Add(CreateImageGridItem(attachment.image));
+ }
}
}
- catch(NullReferenceException)
+ catch (NullReferenceException)
{ }
}
@@ -230,17 +324,26 @@ namespace PWAPPv2
private void Button_Click_3(object sender, RoutedEventArgs e)
{
int index = ImageList.SelectedIndex;
- if(index == -1)
+ if (index == -1)
{
return;
}
- images.RemoveAt(index);
+
+ attachments.RemoveAt(index);
try
{
ImageList.Items.Clear();
- foreach (Source.DataObjects.PWImage image in images)
+
+ foreach (var attachment in attachments)
{
- ImageList.Items.Add(CreateImageGridItem(image));
+ if (attachment.image == null)
+ {
+ ImageList.Items.Add(CreateImageGridItem(new Source.DataObjects.PWImage("C:\\PWAPP\\App\\App\\pdf.jpg")));
+ }
+ else
+ {
+ ImageList.Items.Add(CreateImageGridItem(attachment.image));
+ }
}
}
catch (NullReferenceException)
@@ -251,10 +354,9 @@ namespace PWAPPv2
{
Grid imageGrid = new Grid();
imageGrid.Width = 477;
- imageGrid.HorizontalAlignment = HorizontalAlignment.Left;
+ imageGrid.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
imageGrid.VerticalAlignment = VerticalAlignment.Top;
imageGrid.ShowGridLines = true;
- imageGrid.Background = new SolidColorBrush(Colors.LightSteelBlue);
ColumnDefinition imageColumn = new ColumnDefinition();
imageColumn.Width = new GridLength(50);
diff --git a/PWAPPv2/PWAPPv2.csproj b/PWAPPv2/PWAPPv2.csproj
index 5f2858b..49e5953 100644
--- a/PWAPPv2/PWAPPv2.csproj
+++ b/PWAPPv2/PWAPPv2.csproj
@@ -210,10 +210,11 @@
MSBuild:Compile
Designer
-
+
+
@@ -223,6 +224,7 @@
+
@@ -269,9 +271,6 @@
-
-
-
diff --git a/PWAPPv2/Properties/AssemblyInfo.cs b/PWAPPv2/Properties/AssemblyInfo.cs
index aef6f17..2318293 100644
--- a/PWAPPv2/Properties/AssemblyInfo.cs
+++ b/PWAPPv2/Properties/AssemblyInfo.cs
@@ -1,6 +1,4 @@
using System.Reflection;
-using System.Resources;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
diff --git a/PWAPPv2/PwImage.cs b/PWAPPv2/PwImage.cs
deleted file mode 100644
index 6b5f444..0000000
--- a/PWAPPv2/PwImage.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace PWAPPv2
-{
- internal class PwImage
- {
- }
-}
\ No newline at end of file
diff --git a/PWAPPv2/Source/API/APIConfig.cs b/PWAPPv2/Source/API/APIConfig.cs
index 6d6eb52..4d99093 100644
--- a/PWAPPv2/Source/API/APIConfig.cs
+++ b/PWAPPv2/Source/API/APIConfig.cs
@@ -1,19 +1,35 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using PWAPPv2.Source.Config;
+using System;
using System.Xml;
namespace PWAPPv2.Source
{
- class APIConfig
+ public class APIConfig
{
public string PWUserID;
public string PWPassword;
public string PWPracticeID;
public string PWApiID;
+ public string PWBaseURI;
+ public string PWUpdateURI;
+ public string PWAppVersion;
+
+ public APIConfig() { }
+
+ public APIConfig(Config.Configuration practiceConfig, Config.Configuration universalConfig)
+ {
+ PWUserID = practiceConfig.Get("pwuserid");
+ PWPassword = practiceConfig.Get("pwpassword");
+ PWPracticeID = practiceConfig.Get("pwpracticeid");
+ PWApiID = practiceConfig.Get("pwapiid");
+
+ PWBaseURI = universalConfig.Get("PWBaseURI");
+ PWUpdateURI = universalConfig.Get("PWUpdateURI");
+ PWAppVersion = universalConfig.Get("PWAppVersion");
+
+ }
+
public void LoadConfig(string path)
{
XmlDocument cfgDoc = new XmlDocument();
@@ -21,12 +37,12 @@ namespace PWAPPv2.Source
{
cfgDoc.Load(path);
}
- catch(XmlException)
+ catch (XmlException)
{
Console.WriteLine("An error has occured parsing the config file.");
return;
}
- catch(System.IO.FileNotFoundException)
+ catch (System.IO.FileNotFoundException)
{
Console.WriteLine("Config file could not be found!");
return;
diff --git a/PWAPPv2/Source/API/APIConnection.cs b/PWAPPv2/Source/API/APIConnection.cs
index 2efb4e5..a7ad092 100644
--- a/PWAPPv2/Source/API/APIConnection.cs
+++ b/PWAPPv2/Source/API/APIConnection.cs
@@ -1,50 +1,46 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using Microsoft.Identity.Client.Platforms.Features.DesktopOs.Kerberos;
+using System;
+using System.Diagnostics;
+using System.IO;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
-using System.IO;
-using Newtonsoft.Json;
+using System.Text;
namespace PWAPPv2.Source.API
{
- class APIConnection
+ public class APIConnection
{
private static string BaseURL;
public DataObjects.APICredentials Credentials;
- private static bool ResponseReady = false;
- private static string Response = "";
+
+ HttpClient Client;
public APIConnection(string baseUrl, DataObjects.APICredentials credentials)
{
Credentials = credentials;
BaseURL = baseUrl;
+
+ Client = new HttpClient();
+ Client.BaseAddress = new Uri(BaseURL);
+ Client.DefaultRequestHeaders.Accept.Add(
+ new MediaTypeWithQualityHeaderValue("application/json"));
+ Client.DefaultRequestHeaders.Add("UserID", Credentials.UserID);
+ Client.DefaultRequestHeaders.Add("Password", Credentials.Password);
+ Client.DefaultRequestHeaders.Add("PracticeID", Credentials.PracticeId);
+ Client.DefaultRequestHeaders.Add("ApiID", Credentials.APIid);
+
}
- public string GetResponse()
- {
- while (!ResponseReady) ;
- return Response;
- }
+ ///
+ /// Dont use. Doesn't work, sillyhead.
+ ///
+ ///
public static async void APIGet(string Call)
{
- //WebRequest request = WebRequest.Create(BaseURL + Call);
- //request.Method = "GET";
- //request.ContentType = "application/json; charset=utf-8";
- //var response = (HttpWebResponse)request.GetResponse();
- //string text;
- //using (var sr = new StreamReader(response.GetResponseStream()))
- //{
- // text = sr.ReadToEnd();
- //}
- //return text;
-
using (var client = new HttpClient())
{
client.BaseAddress = new Uri(BaseURL);
@@ -56,66 +52,16 @@ namespace PWAPPv2.Source.API
}
}
- public string APIPost()
- {
- string text;
- try
- {
- HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://apipatientweb.azurewebsites.net/api/PWReferralTypes");
- request.Method = "POST";
- request.ContentType = "application/json; charset=\"utf-8\"";
- request.Accept = "application/json";
-
- string postData = Source.API.APIRequestBuilder.BuildJsonBodyRequest(Credentials);
-
- ASCIIEncoding encoding = new ASCIIEncoding();
- byte[] data = encoding.GetBytes(postData);
- request.ContentLength = data.Length;
- Stream newStream = request.GetRequestStream();
- newStream.Write(data, 0, data.Length);
- newStream.Close();
-
- var response = (HttpWebResponse)request.GetResponse();
-
- using (var sr = new StreamReader(response.GetResponseStream()))
- {
- text = sr.ReadToEnd();
- }
- }
- catch(WebException wex)
- {
- text = new StreamReader(wex.Response.GetResponseStream()).ReadToEnd();
- }
- return text;
- }
-
+ ///
+ /// Send a post requst without data. Essentially an advanced get since I was a retard when I wrote the original API.
+ ///
+ ///
+ ///
public string SendPostRequestAsync(string apiUri)
{
- HttpClient client = new HttpClient();
- client.BaseAddress = new Uri(BaseURL);
- client.DefaultRequestHeaders.Accept.Add(
- new MediaTypeWithQualityHeaderValue("application/json"));
-
StringContent contetnt = new StringContent(Credentials.ToJsonString(), Encoding.UTF8, "application/json");
- var response = client.PostAsync(apiUri, contetnt).Result;
-
- if(response.IsSuccessStatusCode)
- {
- return response.Content.ReadAsStringAsync().Result;
- }
- return "";
- }
- public string SendPostRequestAsync(string apiUri, string PostData)
- {
- HttpClient client = new HttpClient();
- client.BaseAddress = new Uri(BaseURL);
- client.DefaultRequestHeaders.Accept.Add(
- new MediaTypeWithQualityHeaderValue("application/json"));
-
- StringContent contetnt = new StringContent(PostData, Encoding.UTF8, "application/json");
-
- var response = client.PostAsync(apiUri, contetnt).Result;
+ var response = Client.PostAsync(apiUri, contetnt).Result;
if (response.IsSuccessStatusCode)
{
@@ -124,5 +70,63 @@ namespace PWAPPv2.Source.API
return "";
}
+ ///
+ /// Send a post request with data
+ ///
+ ///
+ ///
+ ///
+ public string SendPostRequestAsync(string apiUri, string PostData)
+ {
+ StringContent contetnt = new StringContent(PostData, Encoding.UTF8, "application/json");
+
+ var response = Client.PostAsync(apiUri, contetnt).Result;
+
+ if (response.IsSuccessStatusCode)
+ {
+ return response.Content.ReadAsStringAsync().Result;
+ }
+ return "";
+ }
+
+ ///
+ /// Send a post request with the API credengials in the header of the request.
+ ///
+ ///
+ ///
+ ///
+ ///
+ public string SendPostWithCredsInHeader(string apiUri, string PostData)
+ {
+
+
+ StringContent content = new StringContent(PostData, Encoding.UTF8, "application/json");
+ string conts = content.ToString();
+
+ var response = Client.PostAsync(apiUri, content).Result;
+
+ //Client.DefaultRequestHeaders.Remove("UserID");
+ //Client.DefaultRequestHeaders.Remove("Password");
+ //Client.DefaultRequestHeaders.Remove("PraticeID");
+ //Client.DefaultRequestHeaders.Remove("ApiID");
+
+ if (response.IsSuccessStatusCode)
+ {
+
+ return response.Content.ReadAsStringAsync().Result;
+ }
+ throw new RequestFailedExcpetion(response.StatusCode.ToString());
+
+ }
+
+ }
+
+ public class RequestFailedExcpetion : Exception
+ {
+ public string RequestError;
+ public RequestFailedExcpetion(string errorCode)
+ {
+ RequestError = "Server responded with error code: " + errorCode;
+ }
}
}
diff --git a/PWAPPv2/Source/API/APIRequestBuilder.cs b/PWAPPv2/Source/API/APIRequestBuilder.cs
index 48da6aa..692c885 100644
--- a/PWAPPv2/Source/API/APIRequestBuilder.cs
+++ b/PWAPPv2/Source/API/APIRequestBuilder.cs
@@ -1,11 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Xml;
-using System.Xml.Serialization;
-using Newtonsoft.Json;
+using Newtonsoft.Json;
+using System;
namespace PWAPPv2.Source.API
{
diff --git a/PWAPPv2/Source/API/PWApiConnection.cs b/PWAPPv2/Source/API/PWApiConnection.cs
new file mode 100644
index 0000000..18bd815
--- /dev/null
+++ b/PWAPPv2/Source/API/PWApiConnection.cs
@@ -0,0 +1,81 @@
+using PWAPPv2.Source.DataObjects;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PWAPPv2.Source.API
+{
+ public class PWApiConnection
+ {
+ private APIConnection BaseConnection;
+ private APIConnection UpdateConnection;
+
+ private APIConnection AttachementConnection;
+ private APIConnection ReferralConnection;
+ private APIConnection ReferToConnection;
+ private APIConnection ReferFromConnection;
+ private APIConnection ReferTypesConnection;
+
+ private APICredentials Credentials;
+ private string AppVersion;
+
+ public PWApiConnection(Source.Config.Configuration practiceConfig, Source.Config.Configuration universalConfig)
+ {
+ Credentials = new APICredentials(practiceConfig);
+ BaseConnection = new APIConnection(universalConfig.Get("PWBaseURI"), Credentials);
+ UpdateConnection = new APIConnection(universalConfig.Get("PWUpdateURI"), Credentials);
+ AttachementConnection = new APIConnection(universalConfig.Get("PWAttachmentURI"), Credentials);
+ ReferralConnection = new APIConnection(universalConfig.Get("PWReferralURI"), Credentials);
+ ReferToConnection = new APIConnection(universalConfig.Get("PWReferToURI"), Credentials);
+ ReferFromConnection = new APIConnection(universalConfig.Get("PWReferFromURI"), Credentials);
+ ReferTypesConnection = new APIConnection(universalConfig.Get("PWReferTypesURI"), Credentials);
+
+ AppVersion = universalConfig.Get("PWAppVersion");
+
+ }
+
+ public string PostToApi(string uri, string data)
+ {
+ return BaseConnection.SendPostRequestAsync(uri, data);
+ }
+
+ public string GetFromApi(string uri)
+ {
+ return BaseConnection.SendPostRequestAsync(uri);
+ }
+
+ public bool CheckForUpdate()
+ {
+ string currentVersion = UpdateConnection.SendPostWithCredsInHeader("", "");
+ currentVersion = currentVersion.Replace("\"", "");
+ if(currentVersion != AppVersion)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ public string GetReferalTypes()
+ {
+ return ReferTypesConnection.SendPostWithCredsInHeader("", "");
+ }
+
+ public string GetReferTo()
+ {
+ return ReferToConnection.SendPostWithCredsInHeader("", "");
+ }
+
+ public string GetReferFrom()
+ {
+ return ReferFromConnection.SendPostWithCredsInHeader("", "");
+ }
+
+ public string SendReferral(string JsonData)
+ {
+ return ReferralConnection.SendPostWithCredsInHeader("", JsonData);
+ }
+
+ }
+}
diff --git a/PWAPPv2/Source/Config/Configuration.cs b/PWAPPv2/Source/Config/Configuration.cs
new file mode 100644
index 0000000..a81d2ee
--- /dev/null
+++ b/PWAPPv2/Source/Config/Configuration.cs
@@ -0,0 +1,54 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Xml;
+using System.IO;
+
+namespace PWAPPv2.Source.Config
+{
+ public class Configuration
+ {
+ private Dictionary values;
+
+ public Configuration(string file)
+ {
+ values = new Dictionary();
+ if(!File.Exists(file))
+ {
+ throw new ConfigFileNotFoundException();
+ }
+
+ string f = File.ReadAllText(file);
+
+ XmlDocument xmlDoc = new XmlDocument();
+ xmlDoc.LoadXml(f);
+
+ XmlNodeList xmlNodeList = xmlDoc.DocumentElement.ChildNodes;
+ foreach (XmlNode xmlNode in xmlNodeList)
+ {
+ values.Add(xmlNode.Name, xmlNode.InnerText);
+ }
+
+ }
+
+ public string Get(string key)
+ {
+ try
+ {
+ return values[key];
+ }
+ catch
+ {
+ throw new ConfigValueNotFoundException();
+ }
+ }
+
+
+ }
+
+ public class ConfigFileNotFoundException : Exception { }
+
+ public class ConfigValueNotFoundException: Exception { }
+}
diff --git a/PWAPPv2/Source/DataObjects/APICredentials.cs b/PWAPPv2/Source/DataObjects/APICredentials.cs
index c90a014..c870733 100644
--- a/PWAPPv2/Source/DataObjects/APICredentials.cs
+++ b/PWAPPv2/Source/DataObjects/APICredentials.cs
@@ -1,18 +1,17 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PWAPPv2.Source.DataObjects
+namespace PWAPPv2.Source.DataObjects
{
- class APICredentials
+ public class APICredentials
{
public string UserID;
public string Password;
public string PracticeId;
public string APIid;
+ public APICredentials()
+ {
+
+ }
+
public APICredentials(Source.APIConfig config)
{
UserID = config.PWUserID;
@@ -21,6 +20,14 @@ namespace PWAPPv2.Source.DataObjects
APIid = config.PWApiID;
}
+ public APICredentials(Source.Config.Configuration practiceConfig)
+ {
+ UserID = practiceConfig.Get("pwuserid");
+ Password = practiceConfig.Get("pwpassword");
+ PracticeId = practiceConfig.Get("pwpracticeid");
+ APIid = practiceConfig.Get("pwapiid");
+ }
+
public string BuildJsonBodyContents()
{
return "'UserID':'" + UserID + "'," +
diff --git a/PWAPPv2/Source/DataObjects/Attachment.cs b/PWAPPv2/Source/DataObjects/Attachment.cs
index 2ef9eec..53d59ae 100644
--- a/PWAPPv2/Source/DataObjects/Attachment.cs
+++ b/PWAPPv2/Source/DataObjects/Attachment.cs
@@ -1,40 +1,61 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PWAPPv2.Source.DataObjects
+namespace PWAPPv2.Source.DataObjects
{
class Attachment
{
APICredentials Credentials;
- PWImage image;
+ public PWImage image { get; set; }
+ public PWPdf pdf { get; set; }
+ public string Token;
- string Token;
+ private string fileType { get; set; }
-
- public Attachment(APICredentials credentials, PWImage pwImage, string token)
+ public Attachment(APICredentials credentials, PWImage pwImage)
{
Credentials = credentials;
image = pwImage;
- Token = token;
+ //Token = token;
+ pdf = null;
+ fileType = "image/jpeg";
+ }
+
+ public Attachment(APICredentials credentials, PWPdf pwPdf)
+ {
+ Credentials = credentials;
+ pdf = pwPdf;
+ image = null;
+ fileType = "application/pdf";
}
public string ToJsonString()
{
- return "\"{" + Credentials.BuildJsonBodyContents() +
- ",'UserNum':'API'," +
- "'AttToken':'" + Token.Replace("\"", "") + "'," +
- "'FileName':'" + image.ShortFileName() + "'," +
- "'ContentType':'_1'," +
- "'ThumbExists':'1'," +
- "'ZoomExists':'1'," +
- "'FileDate':''," +
- "'Base64FileContents':'" + image.GetBase64String() + "',\n" +
- "'Base64ThumbContents':'" + image.GetBase64ThumbString() + "',\n" +
- "'Base64ZoomContents':'" + image.GetBase64ZoomString() + "'}\"";
+ if (fileType == "image/jpeg")
+ {
+ return "\"{" + Credentials.BuildJsonBodyContents() +
+ ",'UserNum':'API'," +
+ "'AttToken':'" + Token.Replace("\"", "") + "'," +
+ "'FileName':'" + image.ShortFileName() + "'," +
+ "'ThumbExists':'1'," +
+ "'ZoomExists':'1'," +
+ "'FileDate':''," +
+ "'FileType':'" + fileType + "'," +
+ "'Base64FileContents':'" + image.GetBase64String() + "',\n" +
+ "'Base64ThumbContents':'" + image.GetBase64ThumbString() + "',\n" +
+ "'Base64ZoomContents':'" + image.GetBase64ZoomString() + "'}\"";
+ }
+ else
+ {
+ return "\"{" + Credentials.BuildJsonBodyContents() +
+ ",'UserNum':'API'," +
+ "'AttToken':'" + Token.Replace("\"", "") + "'," +
+ "'FileName':'" + pdf.ShortFileName() + "'," +
+ "'ThumbExists':'0'," +
+ "'ZoomExists':'0'," +
+ "'FileDate':''," +
+ "'FileType':'" + fileType + "'," +
+ "'Base64FileContents':'" + pdf.GetBase64String() + "',\n" +
+ "'Base64ThumbContents':'',\n" +
+ "'Base64ZoomContents':''}\"";
+ }
}
-
}
}
diff --git a/PWAPPv2/Source/DataObjects/ComboBoxData.cs b/PWAPPv2/Source/DataObjects/ComboBoxData.cs
index 70f7736..f424081 100644
--- a/PWAPPv2/Source/DataObjects/ComboBoxData.cs
+++ b/PWAPPv2/Source/DataObjects/ComboBoxData.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
+using System.Windows.Controls;
namespace PWAPPv2.Source.DataObjects
{
diff --git a/PWAPPv2/Source/DataObjects/Exceptions.cs b/PWAPPv2/Source/DataObjects/Exceptions.cs
index cf5bb7b..f2bf798 100644
--- a/PWAPPv2/Source/DataObjects/Exceptions.cs
+++ b/PWAPPv2/Source/DataObjects/Exceptions.cs
@@ -1,8 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace PWAPPv2.Source.DataObjects
{
diff --git a/PWAPPv2/Source/DataObjects/NumValList.cs b/PWAPPv2/Source/DataObjects/NumValList.cs
index d63cf08..8211398 100644
--- a/PWAPPv2/Source/DataObjects/NumValList.cs
+++ b/PWAPPv2/Source/DataObjects/NumValList.cs
@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace PWAPPv2.Source.DataObjects
{
@@ -18,11 +15,11 @@ namespace PWAPPv2.Source.DataObjects
public NumValList(string Content, char Delim)
{
string[] split = Content.Split(Delim);
- if((split.Length % 2) != 0)
+ if ((split.Length % 2) != 0)
{
throw new UnevenValuesException();
}
- for(int i = 0; i < split.Length; i++)
+ for (int i = 0; i < split.Length; i++)
{
this.Add(int.Parse(split[i]), split[i + 1]);
i++;
diff --git a/PWAPPv2/Source/DataObjects/NumValPair.cs b/PWAPPv2/Source/DataObjects/NumValPair.cs
index f6bc7bd..5628a32 100644
--- a/PWAPPv2/Source/DataObjects/NumValPair.cs
+++ b/PWAPPv2/Source/DataObjects/NumValPair.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PWAPPv2.Source.DataObjects
+namespace PWAPPv2.Source.DataObjects
{
class NumValPair
{
diff --git a/PWAPPv2/Source/DataObjects/PWImage.cs b/PWAPPv2/Source/DataObjects/PWImage.cs
index 30ad628..2f5ce19 100644
--- a/PWAPPv2/Source/DataObjects/PWImage.cs
+++ b/PWAPPv2/Source/DataObjects/PWImage.cs
@@ -1,12 +1,7 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Media.Imaging;
-using System.Windows.Media;
using System.Drawing;
using System.IO;
+using System.Windows.Media.Imaging;
namespace PWAPPv2.Source.DataObjects
{
diff --git a/PWAPPv2/Source/DataObjects/PWPdf.cs b/PWAPPv2/Source/DataObjects/PWPdf.cs
new file mode 100644
index 0000000..efa371f
--- /dev/null
+++ b/PWAPPv2/Source/DataObjects/PWPdf.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PWAPPv2.Source.DataObjects
+{
+ public class PWPdf
+ {
+ public string path;
+
+
+ public PWPdf(string path)
+ {
+ this.path = path;
+ }
+
+ public string GetBase64String()
+ {
+ byte[] bytes = File.ReadAllBytes(path);
+ return Convert.ToBase64String(bytes);
+ }
+
+ public string ShortFileName()
+ {
+ return path.Substring(path.LastIndexOf("\\") + 1);
+ }
+ }
+}
diff --git a/PWAPPv2/Source/DataObjects/ReferFromBox.cs b/PWAPPv2/Source/DataObjects/ReferFromBox.cs
index b0128ff..742472c 100644
--- a/PWAPPv2/Source/DataObjects/ReferFromBox.cs
+++ b/PWAPPv2/Source/DataObjects/ReferFromBox.cs
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
using System.Windows.Controls;
namespace PWAPPv2.Source.DataObjects
diff --git a/PWAPPv2/Source/DataObjects/ReferToBox.cs b/PWAPPv2/Source/DataObjects/ReferToBox.cs
index 73c8d37..5267970 100644
--- a/PWAPPv2/Source/DataObjects/ReferToBox.cs
+++ b/PWAPPv2/Source/DataObjects/ReferToBox.cs
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
using System.Windows.Controls;
namespace PWAPPv2.Source.DataObjects
diff --git a/PWAPPv2/Source/DataObjects/Referral.cs b/PWAPPv2/Source/DataObjects/Referral.cs
index 9a5458a..c361c74 100644
--- a/PWAPPv2/Source/DataObjects/Referral.cs
+++ b/PWAPPv2/Source/DataObjects/Referral.cs
@@ -1,11 +1,7 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
-using System.Windows;
namespace PWAPPv2.Source.DataObjects
{
@@ -40,7 +36,7 @@ namespace PWAPPv2.Source.DataObjects
string RemarksText = new TextRange(RemarksBox.Document.ContentStart, RemarksBox.Document.ContentEnd).Text;
int contact = 0;
- if(ContactBox.IsChecked == true)
+ if (ContactBox.IsChecked == true)
{
contact = 1;
}
@@ -76,11 +72,11 @@ namespace PWAPPv2.Source.DataObjects
{
MessageBox.Show("Please select a referral type");
}
- catch(Source.DataObjects.ReferToDefaultException)
+ catch (Source.DataObjects.ReferToDefaultException)
{
MessageBox.Show("Please select a refer to");
}
- catch(Source.DataObjects.ReferFromDefaultException)
+ catch (Source.DataObjects.ReferFromDefaultException)
{
MessageBox.Show("Please select a refer from");
}
diff --git a/PWAPPv2/Source/DataObjects/ReferralTypeBox.cs b/PWAPPv2/Source/DataObjects/ReferralTypeBox.cs
index 4d5b410..14635d4 100644
--- a/PWAPPv2/Source/DataObjects/ReferralTypeBox.cs
+++ b/PWAPPv2/Source/DataObjects/ReferralTypeBox.cs
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
using System.Windows.Controls;
namespace PWAPPv2.Source.DataObjects
@@ -28,7 +24,7 @@ namespace PWAPPv2.Source.DataObjects
TypeID.Add(id);
}
- catch(Exception)
+ catch (Exception)
{
throw new DataInvalidException();
}
@@ -36,7 +32,7 @@ namespace PWAPPv2.Source.DataObjects
}
- foreach(string name in TypeName)
+ foreach (string name in TypeName)
{
Add(name);
}
@@ -52,9 +48,9 @@ namespace PWAPPv2.Source.DataObjects
{
throw new ReferralTypeDefaultException();
}
- for(int i = 0; i < TypeName.Count; i++)
+ for (int i = 0; i < TypeName.Count; i++)
{
- if(TypeName[i] == Selected)
+ if (TypeName[i] == Selected)
{
return TypeID[i];
}
diff --git a/PWAPPv2/Source/Database/DatabaseConfig.cs b/PWAPPv2/Source/Database/DatabaseConfig.cs
index 971b1a7..789b76e 100644
--- a/PWAPPv2/Source/Database/DatabaseConfig.cs
+++ b/PWAPPv2/Source/Database/DatabaseConfig.cs
@@ -1,8 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using System.Xml;
namespace PWAPPv2.Source.Database
@@ -22,12 +18,12 @@ namespace PWAPPv2.Source.Database
{
cfg.Load(path);
}
- catch(XmlException)
+ catch (XmlException)
{
Console.WriteLine("An error has occured parsing the config file.");
return;
}
- catch(System.IO.FileNotFoundException)
+ catch (System.IO.FileNotFoundException)
{
Console.WriteLine("Config file could not be found!");
}
diff --git a/PWAPPv2/Source/Database/DatabaseConnection.cs b/PWAPPv2/Source/Database/DatabaseConnection.cs
index 3d26098..33efa00 100644
--- a/PWAPPv2/Source/Database/DatabaseConnection.cs
+++ b/PWAPPv2/Source/Database/DatabaseConnection.cs
@@ -1,13 +1,12 @@
-using System;
+using MySqlConnector;
+using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Microsoft.Data.SqlClient;
-using MySqlConnector;
namespace PWAPPv2.Source.Database
{
+ ///
+ /// Class DatabaseConnection creates and maintains a connection to and OpenDental MySqlDatabase.
+ ///
class DatabaseConnection
{
@@ -22,13 +21,19 @@ namespace PWAPPv2.Source.Database
Connection = new MySqlConnection(SqlString);
}
+ public DatabaseConnection(Config.Configuration config)
+ {
+ SqlString = "server=" + config.Get("ODhost") + ";Uid=" + config.Get("ODuser") + ";database=" + config.Get("ODdatabase") + ";Pwd=" + config.Get("ODpassword");
+ Connection = new MySqlConnection(SqlString);
+ }
+
public void Connect()
{
try
{
Connection.Open();
}
- catch(Exception)
+ catch (Exception)
{
throw new DatabaseConnectionException();
}
@@ -99,7 +104,7 @@ namespace PWAPPv2.Source.Database
{
}
-
+
class DatabaseConnectionException : Exception
{ }
diff --git a/PWAPPv2/Source/Patient.cs b/PWAPPv2/Source/Patient.cs
index c46a0da..30f9c4b 100644
--- a/PWAPPv2/Source/Patient.cs
+++ b/PWAPPv2/Source/Patient.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Collections.Generic;
namespace PWAPPv2.Source
{
diff --git a/PWAPPv2/Source/PatientGUIAdapter.cs b/PWAPPv2/Source/PatientGUIAdapter.cs
index aa6e5cc..3cd9d14 100644
--- a/PWAPPv2/Source/PatientGUIAdapter.cs
+++ b/PWAPPv2/Source/PatientGUIAdapter.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PWAPPv2.Source
+namespace PWAPPv2.Source
{
class PatientGUIAdapter
{
diff --git a/PWAppUpdater/App.xaml b/PWAppUpdater/App.xaml
new file mode 100644
index 0000000..c91f125
--- /dev/null
+++ b/PWAppUpdater/App.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/PWAppUpdater/App.xaml.cs b/PWAppUpdater/App.xaml.cs
new file mode 100644
index 0000000..0ba6512
--- /dev/null
+++ b/PWAppUpdater/App.xaml.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace PWAppUpdater
+{
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App : Application
+ {
+ }
+}
diff --git a/PWAppUpdater/AssemblyInfo.cs b/PWAppUpdater/AssemblyInfo.cs
new file mode 100644
index 0000000..8b5504e
--- /dev/null
+++ b/PWAppUpdater/AssemblyInfo.cs
@@ -0,0 +1,10 @@
+using System.Windows;
+
+[assembly: ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
diff --git a/PWAppUpdater/FTP/FTPManager.cs b/PWAppUpdater/FTP/FTPManager.cs
new file mode 100644
index 0000000..e478cbd
--- /dev/null
+++ b/PWAppUpdater/FTP/FTPManager.cs
@@ -0,0 +1,45 @@
+using System;
+using System.IO;
+using System.Net;
+
+
+namespace PWAppUpdater.FTP
+{
+ class FTPManager
+ {
+ private string BaseUri;
+ private NetworkCredential credential;
+
+ public FTPManager(string baseUri, string username, string password)
+ {
+ BaseUri = baseUri;
+ credential = new NetworkCredential(username, password);
+ }
+
+ public void DownloadFile(string FTPPath, string localPath)
+ {
+ try
+ {
+ FtpWebRequest request = (FtpWebRequest)WebRequest.Create(BaseUri + FTPPath);
+ request.Method = WebRequestMethods.Ftp.DownloadFile;
+ request.Credentials = credential;
+ request.KeepAlive = false;
+ request.UseBinary = true;
+ request.UsePassive = true;
+
+ FtpWebResponse response = (FtpWebResponse)request.GetResponse();
+ Stream responseStream = response.GetResponseStream();
+
+ using (Stream s = File.Create(localPath))
+ {
+ responseStream.CopyTo(s);
+ }
+ response.Close();
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine(e.Message.ToString());
+ }
+ }
+ }
+}
diff --git a/PWAppUpdater/MainWindow.xaml b/PWAppUpdater/MainWindow.xaml
new file mode 100644
index 0000000..bb52683
--- /dev/null
+++ b/PWAppUpdater/MainWindow.xaml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
diff --git a/PWAppUpdater/MainWindow.xaml.cs b/PWAppUpdater/MainWindow.xaml.cs
new file mode 100644
index 0000000..ff7e15a
--- /dev/null
+++ b/PWAppUpdater/MainWindow.xaml.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Net.NetworkInformation;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace PWAppUpdater
+{
+ ///
+ /// Interaction logic for MainWindow.xaml
+ ///
+ public partial class MainWindow : Window
+ {
+ public MainWindow()
+ {
+ InitializeComponent();
+
+
+ statusText.Content = "The program will now be updated.\nPlease click \"OK\" to continue.";
+ }
+
+ private void Button_Click(object sender, RoutedEventArgs e)
+ {
+ OKButton.IsEnabled = false;
+ for(int i = 0; i < 100; i++)
+ {
+ barProgressBar.Value = i;
+ barProgressBar.UpdateLayout();
+ Thread.Sleep(100);
+ }
+ }
+ }
+}
diff --git a/PWAppUpdater/PWAppUpdater.csproj b/PWAppUpdater/PWAppUpdater.csproj
new file mode 100644
index 0000000..d5ad98c
--- /dev/null
+++ b/PWAppUpdater/PWAppUpdater.csproj
@@ -0,0 +1,14 @@
+
+
+
+ WinExe
+ net6.0-windows
+ enable
+ true
+
+
+
+
+
+
+
diff --git a/PWAppUpdater/Updater.cs b/PWAppUpdater/Updater.cs
new file mode 100644
index 0000000..443f204
--- /dev/null
+++ b/PWAppUpdater/Updater.cs
@@ -0,0 +1,52 @@
+using PWAppUpdater.FTP;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace PWAppUpdater
+{
+ class Updater
+ {
+ public static void Update(string installPath, string practiceConfigLocation = "", string tempPath = "")
+ {
+ try
+ {
+
+
+ if (tempPath == "")
+ {
+ tempPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
+ tempPath = Path.Combine(tempPath, "PWAPP\\Temp");
+ }
+ if (!Directory.Exists(tempPath))
+ {
+ Directory.CreateDirectory(tempPath);
+ }
+ FTP.FTPManager ftpManager = new FTPManager("ftp://waws-prod-blu-109.ftp.azurewebsites.windows.net/", "patientweb\\$patientweb", "vHBnkgxPDS4Q410eehaFlXb8DH67QW50m9Rsxf1omXyYWRDgYioWJL63Tagp");
+ ftpManager.DownloadFile("pwapp/current/Release.zip", tempPath);
+
+ if (Directory.Exists(installPath))
+ {
+ Directory.Delete(installPath, true);
+ }
+ Directory.CreateDirectory(installPath);
+ Zip.ZipManager.UnZip(tempPath, installPath, true);
+ }
+ catch (UnauthorizedAccessException)
+ {
+ MessageBox.Show("Updater does not have sufficent permissions to perform update. Please run with administrator privilages to continue.");
+ }
+
+ }
+ }
+
+ class CouldNotFindInstallPathException : Exception
+ {
+
+ }
+}
diff --git a/PWAppUpdater/Zip/ZipManager.cs b/PWAppUpdater/Zip/ZipManager.cs
new file mode 100644
index 0000000..26696bc
--- /dev/null
+++ b/PWAppUpdater/Zip/ZipManager.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.IO.Compression;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PWAppUpdater.Zip
+{
+ class ZipManager
+ {
+ public static void UnZip(string source, string destination, bool Override)
+ {
+ if (Override)
+ {
+ if (Directory.Exists(destination))
+ {
+ Directory.Delete(destination, true);
+ }
+ }
+
+ ZipFile.ExtractToDirectory(source, destination);
+ }
+
+ }
+}
+
diff --git a/PWAppUpdater/app.manifest b/PWAppUpdater/app.manifest
new file mode 100644
index 0000000..56d0da1
--- /dev/null
+++ b/PWAppUpdater/app.manifest
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/PWAppUpdater2/FTP/FTPManager.cs b/PWAppUpdater2/FTP/FTPManager.cs
new file mode 100644
index 0000000..e478cbd
--- /dev/null
+++ b/PWAppUpdater2/FTP/FTPManager.cs
@@ -0,0 +1,45 @@
+using System;
+using System.IO;
+using System.Net;
+
+
+namespace PWAppUpdater.FTP
+{
+ class FTPManager
+ {
+ private string BaseUri;
+ private NetworkCredential credential;
+
+ public FTPManager(string baseUri, string username, string password)
+ {
+ BaseUri = baseUri;
+ credential = new NetworkCredential(username, password);
+ }
+
+ public void DownloadFile(string FTPPath, string localPath)
+ {
+ try
+ {
+ FtpWebRequest request = (FtpWebRequest)WebRequest.Create(BaseUri + FTPPath);
+ request.Method = WebRequestMethods.Ftp.DownloadFile;
+ request.Credentials = credential;
+ request.KeepAlive = false;
+ request.UseBinary = true;
+ request.UsePassive = true;
+
+ FtpWebResponse response = (FtpWebResponse)request.GetResponse();
+ Stream responseStream = response.GetResponseStream();
+
+ using (Stream s = File.Create(localPath))
+ {
+ responseStream.CopyTo(s);
+ }
+ response.Close();
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine(e.Message.ToString());
+ }
+ }
+ }
+}
diff --git a/PWAppUpdater2/Form1.Designer.cs b/PWAppUpdater2/Form1.Designer.cs
new file mode 100644
index 0000000..d6e9fa3
--- /dev/null
+++ b/PWAppUpdater2/Form1.Designer.cs
@@ -0,0 +1,98 @@
+namespace PWAppUpdater2
+{
+ partial class Form1
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ progressBar1 = new ProgressBar();
+ button1 = new Button();
+ label1 = new Label();
+ StepInfo = new Label();
+ SuspendLayout();
+ //
+ // progressBar1
+ //
+ progressBar1.Location = new Point(30, 60);
+ progressBar1.Name = "progressBar1";
+ progressBar1.Size = new Size(200, 10);
+ progressBar1.TabIndex = 0;
+ progressBar1.Click += progressBar1_Click;
+ //
+ // button1
+ //
+ button1.Location = new Point(105, 80);
+ button1.Name = "button1";
+ button1.Size = new Size(50, 23);
+ button1.TabIndex = 1;
+ button1.Text = "OK";
+ button1.UseVisualStyleBackColor = true;
+ button1.Click += button1_Click;
+ //
+ // label1
+ //
+ label1.AutoSize = true;
+ label1.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
+ label1.Location = new Point(12, 9);
+ label1.Name = "label1";
+ label1.Size = new Size(168, 30);
+ label1.TabIndex = 2;
+ label1.Text = "The program will now update. \r\nPlease click \"OK\" to continue.";
+ label1.Click += label1_Click;
+ //
+ // StepInfo
+ //
+ StepInfo.AutoSize = true;
+ StepInfo.Location = new Point(30, 42);
+ StepInfo.Name = "StepInfo";
+ StepInfo.Size = new Size(0, 15);
+ StepInfo.TabIndex = 3;
+ StepInfo.Click += label2_Click;
+ //
+ // Form1
+ //
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(264, 111);
+ Controls.Add(StepInfo);
+ Controls.Add(label1);
+ Controls.Add(button1);
+ Controls.Add(progressBar1);
+ Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
+ Name = "Form1";
+ Text = "Form1";
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private ProgressBar progressBar1;
+ private Button button1;
+ private Label label1;
+ private Label StepInfo;
+ }
+}
\ No newline at end of file
diff --git a/PWAppUpdater2/Form1.cs b/PWAppUpdater2/Form1.cs
new file mode 100644
index 0000000..c0252e7
--- /dev/null
+++ b/PWAppUpdater2/Form1.cs
@@ -0,0 +1,52 @@
+using PWAppUpdater;
+
+namespace PWAppUpdater2
+{
+ public partial class Form1 : Form
+ {
+
+
+ public Form1()
+ {
+
+ InitializeComponent();
+
+ }
+
+ private void progressBar1_Click(object sender, EventArgs e)
+ {
+
+ }
+
+ private void button1_Click(object sender, EventArgs e)
+ {
+ Directory.SetCurrentDirectory("C:\\PWAPP");
+ label1.Text = "Updating.... Please wait.";
+ label1.Update();
+ progressBar1.Maximum = 8;
+ progressBar1.Step = 1;
+ button1.Enabled = false;
+ try
+ {
+ PWAppUpdater.Updater.Update("C:\\PWAPP\\App", progressBar1, StepInfo, "C:\\PWAPP\\Temp");
+ }
+ catch (NoAuthException)
+ {
+ MessageBox.Show("Please run the updater with administrator privilages or from the PWApp Application.");
+ Application.Exit();
+ }
+ MessageBox.Show("Done!");
+ Application.Exit();
+ }
+
+ private void label1_Click(object sender, EventArgs e)
+ {
+
+ }
+
+ private void label2_Click(object sender, EventArgs e)
+ {
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/PWAppUpdater2/Form1.resx b/PWAppUpdater2/Form1.resx
new file mode 100644
index 0000000..af32865
--- /dev/null
+++ b/PWAppUpdater2/Form1.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/PWAppUpdater2/PWAppUpdaterForm.csproj b/PWAppUpdater2/PWAppUpdaterForm.csproj
new file mode 100644
index 0000000..b57c89e
--- /dev/null
+++ b/PWAppUpdater2/PWAppUpdaterForm.csproj
@@ -0,0 +1,11 @@
+
+
+
+ WinExe
+ net6.0-windows
+ enable
+ true
+ enable
+
+
+
\ No newline at end of file
diff --git a/PWAppUpdater2/Program.cs b/PWAppUpdater2/Program.cs
new file mode 100644
index 0000000..0d23194
--- /dev/null
+++ b/PWAppUpdater2/Program.cs
@@ -0,0 +1,17 @@
+namespace PWAppUpdater2
+{
+ internal static class Program
+ {
+ ///
+ /// The main entry point for the application.
+ ///
+ [STAThread]
+ static void Main()
+ {
+ // To customize application configuration such as set high DPI settings or default font,
+ // see https://aka.ms/applicationconfiguration.
+ ApplicationConfiguration.Initialize();
+ Application.Run(new Form1());
+ }
+ }
+}
\ No newline at end of file
diff --git a/PWAppUpdater2/Updater.cs b/PWAppUpdater2/Updater.cs
new file mode 100644
index 0000000..88c8f86
--- /dev/null
+++ b/PWAppUpdater2/Updater.cs
@@ -0,0 +1,73 @@
+using PWAppUpdater.FTP;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace PWAppUpdater
+{
+ class Updater
+ {
+ public static void Update(string installPath, ProgressBar progress, Label stepInfo, string tempPath = "")
+ {
+ try
+ {
+
+ progress.PerformStep();
+ stepInfo.Text = "Creating temp directories...";
+ stepInfo.Update();
+ if (tempPath == "")
+ {
+ tempPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
+ tempPath = Path.Combine(tempPath, "PWAPP\\Temp");
+ }
+ progress.PerformStep();
+ if (!Directory.Exists(tempPath))
+ {
+ Directory.CreateDirectory(tempPath);
+ }
+ progress.PerformStep();
+ stepInfo.Text = "Downloading update...";
+ stepInfo.Update();
+ FTP.FTPManager ftpManager = new FTPManager("ftp://waws-prod-blu-109.ftp.azurewebsites.windows.net/", "patientweb\\$patientweb", "vHBnkgxPDS4Q410eehaFlXb8DH67QW50m9Rsxf1omXyYWRDgYioWJL63Tagp");
+ ftpManager.DownloadFile("pwapp/current/Release.zip", tempPath + "\\Release.zip");
+ progress.PerformStep();
+ stepInfo.Text = "Removing old installation...";
+ stepInfo.Update();
+ progress.PerformStep();
+ stepInfo.Text = "Creating new install directory...";
+ stepInfo.Update();
+ Directory.CreateDirectory(installPath);
+ progress.PerformStep();
+ stepInfo.Text = "Unpacking update...";
+ stepInfo.Update();
+ Zip.ZipManager.UnZip(tempPath + "\\Release.zip", installPath, true);
+ progress.PerformStep();
+ stepInfo.Text = "Cleaning up installation...";
+ stepInfo.Update();
+ Directory.Delete(tempPath, true);
+ progress.PerformStep();
+
+ stepInfo.Text = "Complete!";
+ stepInfo.Update();
+ }
+ catch (UnauthorizedAccessException)
+ {
+ MessageBox.Show("Updater does not have sufficent permissions to perform update. Please run with administrator privilages to continue.");
+ throw new NoAuthException();
+ }
+
+ }
+ }
+
+ class NoAuthException : Exception { }
+
+ class CouldNotFindInstallPathException : Exception
+ {
+
+ }
+}
diff --git a/PWAppUpdater2/Zip/ZipManager.cs b/PWAppUpdater2/Zip/ZipManager.cs
new file mode 100644
index 0000000..26696bc
--- /dev/null
+++ b/PWAppUpdater2/Zip/ZipManager.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.IO.Compression;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PWAppUpdater.Zip
+{
+ class ZipManager
+ {
+ public static void UnZip(string source, string destination, bool Override)
+ {
+ if (Override)
+ {
+ if (Directory.Exists(destination))
+ {
+ Directory.Delete(destination, true);
+ }
+ }
+
+ ZipFile.ExtractToDirectory(source, destination);
+ }
+
+ }
+}
+
diff --git a/UnitTests/ConfigTest.cs b/UnitTests/ConfigTest.cs
new file mode 100644
index 0000000..0510881
--- /dev/null
+++ b/UnitTests/ConfigTest.cs
@@ -0,0 +1,21 @@
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System;
+using PWAPPv2.Source;
+
+namespace UnitTests
+{
+ [TestClass]
+ public class ConfigTest
+ {
+ [TestMethod]
+ public void TestGetPracticeConfigs()
+ {
+ PWAPPv2.Source.Config.Configuration configuration = new PWAPPv2.Source.Config.Configuration(".\\Config\\PracticeConfig.xml");
+ Assert.IsNotNull(configuration);
+
+ string apiKey = configuration.Get("pwapiid");
+ Assert.IsNotNull(apiKey);
+
+ }
+ }
+}
diff --git a/UnitTests/PWConnectionTest.cs b/UnitTests/PWConnectionTest.cs
new file mode 100644
index 0000000..1194a09
--- /dev/null
+++ b/UnitTests/PWConnectionTest.cs
@@ -0,0 +1,22 @@
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System;
+
+namespace UnitTests
+{
+ [TestClass]
+ public class PWConnectionTest
+ {
+ [TestMethod]
+ public void TestCheckUpdate()
+ {
+ PWAPPv2.Source.Config.Configuration practiceConfig = new PWAPPv2.Source.Config.Configuration(".\\Config\\PracticeConfig.xml");
+ PWAPPv2.Source.Config.Configuration universalConfig = new PWAPPv2.Source.Config.Configuration(".\\Config\\UniversalConfig.xml");
+
+ PWAPPv2.Source.API.PWApiConnection pwApiConnection = new PWAPPv2.Source.API.PWApiConnection(practiceConfig, universalConfig);
+ Assert.IsNotNull(pwApiConnection);
+
+
+ Assert.IsFalse(pwApiConnection.CheckForUpdate());
+ }
+ }
+}
diff --git a/UnitTests/Properties/AssemblyInfo.cs b/UnitTests/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..806675f
--- /dev/null
+++ b/UnitTests/Properties/AssemblyInfo.cs
@@ -0,0 +1,20 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("UnitTests")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("UnitTests")]
+[assembly: AssemblyCopyright("Copyright © 2023")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+[assembly: ComVisible(false)]
+
+[assembly: Guid("164b9220-f337-4e88-b619-0c52c502b9c4")]
+
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/UnitTests/UnitTest1.cs b/UnitTests/UnitTest1.cs
new file mode 100644
index 0000000..f6a0f58
--- /dev/null
+++ b/UnitTests/UnitTest1.cs
@@ -0,0 +1,59 @@
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System;
+using PWAPPv2.Source.API;
+using PWAPPv2.Source.DataObjects;
+
+// System.Threading.Tasks.Task.Result.get returned "\"1|Endo|2|Implant|3|Oral Surgery|4|Ortho|5|Pedo|6|Perio|7|Restore|8|Other \\n\"" string
+
+namespace UnitTests
+{
+ [TestClass]
+ public class UnitTest1
+ {
+ [TestMethod]
+ public void TestV1Get()
+ {
+ APICredentials creds = new APICredentials();
+ creds.UserID = "testdoctor";
+ creds.Password = "testdoctor";
+ creds.PracticeId = "210";
+ creds.APIid = "12345678";
+
+ APIConnection conn = new APIConnection("http://apipatientweb.azurewebsites.net/", creds);
+
+ string res = conn.SendPostRequestAsync("api/PWReferralTypes");
+ Assert.AreEqual("\"1|Endo|2|Implant|3|Oral Surgery|4|Ortho|5|Pedo|6|Perio|7|Restore|8|Other \\n\"", res);
+
+ }
+
+ [TestMethod]
+ public void TestV2Get()
+ {
+ APICredentials creds = new APICredentials();
+ creds.UserID = "testdoctor";
+ creds.Password = "testdoctor";
+ creds.PracticeId = "210";
+ creds.APIid = "12345678";
+
+ APIConnection conn = new APIConnection("https://localhost:44354/", creds);
+ string res = conn.SendPostWithCredsInHeader("api/PWAppVersion", "");
+
+ }
+
+ [TestMethod]
+ [ExpectedException(typeof(RequestFailedExcpetion))]
+ public void TestInvalidCredentialsV2()
+ {
+ APICredentials creds = new APICredentials();
+ creds.UserID = "testdoctor";
+ creds.Password = "badPassword";
+ creds.PracticeId = "210";
+ creds.APIid = "12345678";
+
+ APIConnection conn = new APIConnection("https://localhost:44354/", creds);
+ string res = conn.SendPostWithCredsInHeader("api/PWAppVersion", "");
+
+ }
+
+ }
+}
diff --git a/UnitTests/UnitTests.csproj b/UnitTests/UnitTests.csproj
new file mode 100644
index 0000000..63f4cf7
--- /dev/null
+++ b/UnitTests/UnitTests.csproj
@@ -0,0 +1,70 @@
+
+
+
+
+
+ Debug
+ AnyCPU
+ {164B9220-F337-4E88-B619-0C52C502B9C4}
+ Library
+ Properties
+ UnitTests
+ UnitTests
+ v4.7.2
+ 512
+ {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 15.0
+ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
+ $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages
+ False
+ UnitTest
+
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll
+
+
+ ..\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
+
+
\ No newline at end of file
diff --git a/UnitTests/packages.config b/UnitTests/packages.config
new file mode 100644
index 0000000..f84cb10
--- /dev/null
+++ b/UnitTests/packages.config
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file