Commit 4ff65cec by Liv Haapala

Updates to various apps

1 parent 5bd9c821
Showing with 2363 additions and 658 deletions
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
...@@ -33,6 +34,7 @@ ...@@ -33,6 +34,7 @@
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="AutoUpdateLib, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="AutoUpdateLib, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
...@@ -56,6 +58,8 @@ ...@@ -56,6 +58,8 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="DataClasses\ApiCredential.cs" />
<Compile Include="DataClasses\RestClient.cs" />
<Compile Include="Forms\ApiSettings.cs"> <Compile Include="Forms\ApiSettings.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CardDisplay
{
public class ApiCredential
{
public string authname;
public DateTime created;
public bool enabled;
public string secret;
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Web.Script.Serialization;
namespace CardDisplay
{
public enum HttpVerb
{
GET,
POST,
PUT,
DELETE
}
public class RestClient
{
public string EndPoint { get; set; }
public HttpVerb Method { get; set; }
public string ContentType { get; set; }
public string PostData { get; set; }
public static string ApiApplicationKey;
public static string ApiUser;
public static string ApiPass;
public static string ApiURL;
public RestClient()
{
EndPoint = ApiURL;
Method = HttpVerb.GET;
ContentType = "application/json";
PostData = "";
}
public RestClient(string endpoint)
{
EndPoint = endpoint;
Method = HttpVerb.GET;
ContentType = "application/json";
PostData = "";
}
public RestClient(string endpoint, HttpVerb method)
{
EndPoint = endpoint;
Method = method;
ContentType = "application/json";
PostData = "";
}
public RestClient(string endpoint, HttpVerb method, string postData)
{
EndPoint = endpoint;
Method = method;
ContentType = "application/json";
PostData = postData;
}
public static string CalculateSHA1(string text)
{
// Convert the input string to a byte array
byte[] buffer = Encoding.GetEncoding("iso-8859-1").GetBytes(text);
// In doing your test, you won't want to re-initialize like this every time you test a
// string.
SHA1CryptoServiceProvider cryptoTransformSHA1 =
new SHA1CryptoServiceProvider();
// The replace won't be necessary for your tests so long as you are consistent in what
// you compare.
string hash = BitConverter.ToString(cryptoTransformSHA1.ComputeHash(buffer)).Replace("-", "").ToLower();
return hash;
}
private static int ConvertToTimestamp(DateTime value)
{
//create Timespan by subtracting the value provided from
//the Unix Epoch
TimeSpan span = (value - new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime());
//return the total seconds (which is a UNIX timestamp)
return (int)span.TotalSeconds;
}
public static string GetRequestURL(string server, string queryPath)
{
return GetRequestURL(server, queryPath,null);
}
public static string GetRequestURL(string server, string queryPath, string getparms)
{
int timestamp = ConvertToTimestamp(DateTime.Now);
string hash = CalculateSHA1("/" + queryPath + "+" + ApiApplicationKey + "+" + ApiUser + "+" + timestamp + "+" + ApiPass);
if (getparms != null && getparms.Length > 0)
getparms = getparms + "&";
string url = server + "/rest/" + queryPath + "?";
if (getparms != null)
url += getparms;
url += "appkey=" + ApiApplicationKey + "&appuser=" + ApiUser + "&appstamp=" + timestamp + "&appmac=" + hash;
Console.WriteLine(url);
return url;
}
public string MakeRequest(string queryPath)
{
return MakeRequest(queryPath, null);
}
public string MakeRequest(string queryPath, string getparms)
{
///placeadmin/places/30+abcdefg+testuser-asdf+1393735570144+acdcabbacd
///
var request = (HttpWebRequest)WebRequest.Create(GetRequestURL(EndPoint,queryPath,getparms));
request.Method = Method.ToString();
request.ContentLength = 0;
request.ContentType = ContentType;
if (!string.IsNullOrEmpty(PostData) && (Method == HttpVerb.POST || Method == HttpVerb.PUT ))
{
var encoding = new UTF8Encoding();
var bytes = Encoding.GetEncoding("iso-8859-1").GetBytes(PostData);
request.ContentLength = bytes.Length;
using (var writeStream = request.GetRequestStream())
{
writeStream.Write(bytes, 0, bytes.Length);
}
}
try
{
using (var response = (HttpWebResponse)request.GetResponse())
{
var responseValue = string.Empty;
if ((int)response.StatusCode < 200 && (int)response.StatusCode >= 300)
{
var message = String.Format("Request failed. Received HTTP {0}", response.StatusCode);
throw new ApplicationException(message);
}
// grab the response
//if (response.ContentLength > 0)
//{
using (var responseStream = response.GetResponseStream())
{
if (responseStream != null)
using (var reader = new StreamReader(responseStream))
{
responseValue = reader.ReadToEnd();
}
}
//}
return responseValue;
}
}
catch (WebException e)
{
if (e.Status == WebExceptionStatus.ConnectFailure)
throw e;
Stream responseStream = ((WebException)e).Response.GetResponseStream();
if (responseStream != null)
{
string responseValue = StreamToString(responseStream);
Console.WriteLine("Response was " + responseValue);
throw new Exception(responseValue);
}
throw e;
}
}
/// <summary>
/// Convert streams from web to string
/// </summary>
/// <param name="responseStream">Webresponse stream</param>
/// <returns>string</returns>
private string StreamToString(Stream responseStream)
{
StreamReader reader = new StreamReader(responseStream);
string responseString = reader.ReadToEnd();
responseStream.Close();
reader.Close();
return responseString;
}
public static ApiCredential GetApiCredential(string username, string pw, string apiKey, string url)
{
var request = (HttpWebRequest)WebRequest.Create(url+"/rest/apiapp/v1/createInstance/"+apiKey);
/*
NetworkCredential credentials = new NetworkCredential();
credentials.UserName = username;
credentials.Password = pw;
CredentialCache credentialCache = new CredentialCache();
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
credentialCache.Add(new System.Uri(url), "Basic", credentials);
request.Credentials = credentialCache;
request.PreAuthenticate = true;
*/
string encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(username + ":" + pw));
request.Headers.Add("Authorization", "Basic " + encoded);
request.Method = "POST";
try
{
using (var response = (HttpWebResponse)request.GetResponse())
{
var responseValue = string.Empty;
if ((int)response.StatusCode < 200 && (int)response.StatusCode >= 300)
{
var message = String.Format("Request failed. Received HTTP {0}", response.StatusCode);
throw new ApplicationException(message);
}
// grab the response
//if (response.ContentLength > 0)
//{
using (var responseStream = response.GetResponseStream())
{
if (responseStream != null)
using (var reader = new StreamReader(responseStream))
{
responseValue = reader.ReadToEnd();
}
}
//}
JavaScriptSerializer ser = new JavaScriptSerializer();
try
{
ApiCredential credential = ser.Deserialize<ApiCredential>(responseValue);
return credential;
} catch(Exception ex)
{
throw ex;
}
}
}
catch (WebException e)
{
throw e;
}
}
} // class
}
namespace CardDisplay.Forms namespace CardDisplay
{ {
partial class ApiSettings partial class ApiSettings
{ {
...@@ -28,123 +28,133 @@ ...@@ -28,123 +28,133 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.label4 = new System.Windows.Forms.Label();
this.ApiPassTextBox = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.ApiUserTextBox = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.ApiKeyTextBox = new System.Windows.Forms.TextBox();
this.SaveButton = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.apiURLTextBox = new System.Windows.Forms.TextBox(); this.apiURLTextBox = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.SaveButton = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.usernameTextBox = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.pwTextBox = new System.Windows.Forms.TextBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.resetApiTokenCheckBox = new System.Windows.Forms.CheckBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// label4 // apiURLTextBox
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(12, 148);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(48, 13);
this.label4.TabIndex = 35;
this.label4.Text = "Api Pass";
//
// ApiPassTextBox
//
this.ApiPassTextBox.Location = new System.Drawing.Point(12, 164);
this.ApiPassTextBox.Name = "ApiPassTextBox";
this.ApiPassTextBox.Size = new System.Drawing.Size(260, 20);
this.ApiPassTextBox.TabIndex = 34;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(12, 109);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(47, 13);
this.label3.TabIndex = 33;
this.label3.Text = "Api User";
//
// ApiUserTextBox
//
this.ApiUserTextBox.Location = new System.Drawing.Point(12, 125);
this.ApiUserTextBox.Name = "ApiUserTextBox";
this.ApiUserTextBox.Size = new System.Drawing.Size(260, 20);
this.ApiUserTextBox.TabIndex = 32;
//
// label2
// //
this.label2.AutoSize = true; this.apiURLTextBox.Location = new System.Drawing.Point(6, 113);
this.label2.Location = new System.Drawing.Point(12, 70); this.apiURLTextBox.Name = "apiURLTextBox";
this.label2.Name = "label2"; this.apiURLTextBox.ReadOnly = true;
this.label2.Size = new System.Drawing.Size(79, 13); this.apiURLTextBox.Size = new System.Drawing.Size(260, 20);
this.label2.TabIndex = 31; this.apiURLTextBox.TabIndex = 0;
this.label2.Text = "Application key";
// //
// ApiKeyTextBox // label1
// //
this.ApiKeyTextBox.Location = new System.Drawing.Point(12, 86); this.label1.AutoSize = true;
this.ApiKeyTextBox.Name = "ApiKeyTextBox"; this.label1.Location = new System.Drawing.Point(6, 97);
this.ApiKeyTextBox.Size = new System.Drawing.Size(260, 20); this.label1.Name = "label1";
this.ApiKeyTextBox.TabIndex = 30; this.label1.Size = new System.Drawing.Size(47, 13);
this.label1.TabIndex = 1;
this.label1.Text = "Moya url";
// //
// SaveButton // SaveButton
// //
this.SaveButton.Location = new System.Drawing.Point(197, 210); this.SaveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.SaveButton.Location = new System.Drawing.Point(228, 167);
this.SaveButton.Name = "SaveButton"; this.SaveButton.Name = "SaveButton";
this.SaveButton.Size = new System.Drawing.Size(75, 23); this.SaveButton.Size = new System.Drawing.Size(75, 23);
this.SaveButton.TabIndex = 29; this.SaveButton.TabIndex = 2;
this.SaveButton.Text = "Save"; this.SaveButton.Text = "Save";
this.SaveButton.UseVisualStyleBackColor = true; this.SaveButton.UseVisualStyleBackColor = true;
this.SaveButton.Click += new System.EventHandler(this.SaveButton_Click); this.SaveButton.Click += new System.EventHandler(this.SaveButton_Click);
// //
// label1 // label3
// //
this.label1.AutoSize = true; this.label3.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 27); this.label3.Location = new System.Drawing.Point(6, 19);
this.label1.Name = "label1"; this.label3.Name = "label3";
this.label1.Size = new System.Drawing.Size(47, 13); this.label3.Size = new System.Drawing.Size(55, 13);
this.label1.TabIndex = 28; this.label3.TabIndex = 6;
this.label1.Text = "Moya url"; this.label3.Text = "Username";
// //
// apiURLTextBox // usernameTextBox
// //
this.apiURLTextBox.Location = new System.Drawing.Point(12, 43); this.usernameTextBox.Location = new System.Drawing.Point(6, 35);
this.apiURLTextBox.Name = "apiURLTextBox"; this.usernameTextBox.Name = "usernameTextBox";
this.apiURLTextBox.Size = new System.Drawing.Size(260, 20); this.usernameTextBox.ReadOnly = true;
this.apiURLTextBox.TabIndex = 27; this.usernameTextBox.Size = new System.Drawing.Size(260, 20);
this.usernameTextBox.TabIndex = 5;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(6, 58);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(53, 13);
this.label4.TabIndex = 8;
this.label4.Text = "Password";
//
// pwTextBox
//
this.pwTextBox.Location = new System.Drawing.Point(6, 74);
this.pwTextBox.Name = "pwTextBox";
this.pwTextBox.PasswordChar = 'ῷ';
this.pwTextBox.ReadOnly = true;
this.pwTextBox.Size = new System.Drawing.Size(260, 20);
this.pwTextBox.TabIndex = 7;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.pwTextBox);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.usernameTextBox);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.apiURLTextBox);
this.groupBox1.Controls.Add(this.resetApiTokenCheckBox);
this.groupBox1.Location = new System.Drawing.Point(13, 13);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(288, 142);
this.groupBox1.TabIndex = 9;
this.groupBox1.TabStop = false;
//
// resetApiTokenCheckBox
//
this.resetApiTokenCheckBox.AutoSize = true;
this.resetApiTokenCheckBox.Location = new System.Drawing.Point(6, -1);
this.resetApiTokenCheckBox.Name = "resetApiTokenCheckBox";
this.resetApiTokenCheckBox.Size = new System.Drawing.Size(101, 17);
this.resetApiTokenCheckBox.TabIndex = 0;
this.resetApiTokenCheckBox.Text = "Reset api token";
this.resetApiTokenCheckBox.UseVisualStyleBackColor = true;
this.resetApiTokenCheckBox.CheckedChanged += new System.EventHandler(this.resetApiTokenCheckBox_CheckedChanged);
// //
// ApiSettings // ApiSettings
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 261); this.ClientSize = new System.Drawing.Size(315, 202);
this.Controls.Add(this.label4);
this.Controls.Add(this.ApiPassTextBox);
this.Controls.Add(this.label3);
this.Controls.Add(this.ApiUserTextBox);
this.Controls.Add(this.label2);
this.Controls.Add(this.ApiKeyTextBox);
this.Controls.Add(this.SaveButton); this.Controls.Add(this.SaveButton);
this.Controls.Add(this.label1); this.Controls.Add(this.groupBox1);
this.Controls.Add(this.apiURLTextBox);
this.Name = "ApiSettings"; this.Name = "ApiSettings";
this.Text = "ApiSettings"; this.Text = "ApiSettings";
this.Load += new System.EventHandler(this.ApiSettings_Load); this.Load += new System.EventHandler(this.ApiSettings_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout();
} }
#endregion #endregion
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox ApiPassTextBox;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox ApiUserTextBox;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox ApiKeyTextBox;
private System.Windows.Forms.Button SaveButton;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox apiURLTextBox; private System.Windows.Forms.TextBox apiURLTextBox;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button SaveButton;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox usernameTextBox;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox pwTextBox;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.CheckBox resetApiTokenCheckBox;
} }
} }
\ No newline at end of file
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
namespace CardDisplay.Forms namespace CardDisplay
{ {
public partial class ApiSettings : Form public partial class ApiSettings : Form
{ {
...@@ -18,21 +12,62 @@ namespace CardDisplay.Forms ...@@ -18,21 +12,62 @@ namespace CardDisplay.Forms
private void SaveButton_Click(object sender, EventArgs e) private void SaveButton_Click(object sender, EventArgs e)
{ {
Properties.Settings.Default.ApiURL = apiURLTextBox.Text; ApiCredential apiCredential = null;
Properties.Settings.Default.ApiKey = ApiKeyTextBox.Text;
Properties.Settings.Default.ApiUser = ApiUserTextBox.Text;
Properties.Settings.Default.ApiPass = ApiPassTextBox.Text;
Properties.Settings.Default.Save();
if (resetApiTokenCheckBox.Checked)
{
try
{
apiCredential = RestClient.GetApiCredential(usernameTextBox.Text, pwTextBox.Text, Properties.Settings.Default.ApiApplicationKey, apiURLTextBox.Text);
}
catch (Exception ex)
{
MessageBox.Show("Failed to get api credentials: " + ex.Message);
}
if (apiCredential != null)
{
Properties.Settings.Default.ApiURL = apiURLTextBox.Text;
Properties.Settings.Default.ApiUser = apiCredential.authname;
Properties.Settings.Default.ApiPass = apiCredential.secret;
Properties.Settings.Default.ApiTokenSet = true;
Properties.Settings.Default.Save();
}
}
RestClient.ApiApplicationKey = Properties.Settings.Default.ApiApplicationKey;
RestClient.ApiPass = Properties.Settings.Default.ApiPass;
RestClient.ApiUser = Properties.Settings.Default.ApiUser;
RestClient.ApiURL = Properties.Settings.Default.ApiURL;
this.DialogResult = System.Windows.Forms.DialogResult.OK; this.DialogResult = System.Windows.Forms.DialogResult.OK;
} }
private void ApiSettings_Load(object sender, EventArgs e) private void ApiSettings_Load(object sender, EventArgs e)
{ {
resetApiTokenCheckBox.Checked = !Properties.Settings.Default.ApiTokenSet;
apiURLTextBox.Text = Properties.Settings.Default.ApiURL; apiURLTextBox.Text = Properties.Settings.Default.ApiURL;
ApiKeyTextBox.Text = Properties.Settings.Default.ApiKey; //usernameTextBox.Text = Properties.Settings.Default.ApiUser;
ApiUserTextBox.Text = Properties.Settings.Default.ApiUser; //pwTextBox.Text = Properties.Settings.Default.ApiPass;
ApiPassTextBox.Text = Properties.Settings.Default.ApiPass; }
private void resetApiTokenCheckBox_CheckedChanged(object sender, EventArgs e)
{
if (!resetApiTokenCheckBox.Checked)
{
apiURLTextBox.ReadOnly = true;
usernameTextBox.ReadOnly = true;
pwTextBox.ReadOnly = true;
}
else
{
apiURLTextBox.ReadOnly = false;
usernameTextBox.ReadOnly = false;
pwTextBox.ReadOnly = false;
}
} }
} }
} }
...@@ -4,6 +4,7 @@ using System; ...@@ -4,6 +4,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
...@@ -19,7 +20,7 @@ namespace CardDisplay ...@@ -19,7 +20,7 @@ namespace CardDisplay
InitializeComponent(); InitializeComponent();
RestClient.ApiURL = Properties.Settings.Default.ApiURL; RestClient.ApiURL = Properties.Settings.Default.ApiURL;
RestClient.ApiApplicationKey = Properties.Settings.Default.ApiKey; RestClient.ApiApplicationKey = Properties.Settings.Default.ApiApplicationKey;
RestClient.ApiUser = Properties.Settings.Default.ApiUser; RestClient.ApiUser = Properties.Settings.Default.ApiUser;
RestClient.ApiPass = Properties.Settings.Default.ApiPass; RestClient.ApiPass = Properties.Settings.Default.ApiPass;
} }
...@@ -159,6 +160,10 @@ namespace CardDisplay ...@@ -159,6 +160,10 @@ namespace CardDisplay
{ {
ret = client.MakeRequest("reader/readerevents/" + reader.readerId + "/" + slot1ReaderEventId); ret = client.MakeRequest("reader/readerevents/" + reader.readerId + "/" + slot1ReaderEventId);
ret = ret.Replace("\"printedCardId\":null,", "");
Debug.WriteLine("Ret: " + ret);
var ser = new JavaScriptSerializer(); var ser = new JavaScriptSerializer();
ReaderEventList events = ser.Deserialize<ReaderEventList>(ret); ReaderEventList events = ser.Deserialize<ReaderEventList>(ret);
events.readerEvents = events.readerEvents.OrderByDescending(r => r.readerEventTime).ToList(); events.readerEvents = events.readerEvents.OrderByDescending(r => r.readerEventTime).ToList();
...@@ -218,7 +223,7 @@ namespace CardDisplay ...@@ -218,7 +223,7 @@ namespace CardDisplay
try try
{ {
ret = client.MakeRequest("reader/readerevents/" + reader.readerId + "/" + slot2ReaderEventId); ret = client.MakeRequest("reader/readerevents/" + reader.readerId + "/" + slot2ReaderEventId);
ret = ret.Replace("\"printedCardId\":null,", "");
var ser = new JavaScriptSerializer(); var ser = new JavaScriptSerializer();
ReaderEventList events = ser.Deserialize<ReaderEventList>(ret); ReaderEventList events = ser.Deserialize<ReaderEventList>(ret);
events.readerEvents = events.readerEvents.OrderByDescending(r => r.readerEventTime).ToList(); events.readerEvents = events.readerEvents.OrderByDescending(r => r.readerEventTime).ToList();
...@@ -278,7 +283,7 @@ namespace CardDisplay ...@@ -278,7 +283,7 @@ namespace CardDisplay
try try
{ {
ret = client.MakeRequest("reader/readerevents/" + reader.readerId + "/" + slot3ReaderEventId); ret = client.MakeRequest("reader/readerevents/" + reader.readerId + "/" + slot3ReaderEventId);
ret = ret.Replace("\"printedCardId\":null,", "");
var ser = new JavaScriptSerializer(); var ser = new JavaScriptSerializer();
ReaderEventList events = ser.Deserialize<ReaderEventList>(ret); ReaderEventList events = ser.Deserialize<ReaderEventList>(ret);
events.readerEvents = events.readerEvents.OrderByDescending(r => r.readerEventTime).ToList(); events.readerEvents = events.readerEvents.OrderByDescending(r => r.readerEventTime).ToList();
......
...@@ -106,7 +106,7 @@ namespace CardDisplay.Forms ...@@ -106,7 +106,7 @@ namespace CardDisplay.Forms
try try
{ {
ret = client.MakeRequest("reader/readerevents/" + reader.readerId + "/" + slot1ReaderEventId); ret = client.MakeRequest("reader/readerevents/" + reader.readerId + "/" + slot1ReaderEventId);
ret = ret.Replace("\"printedCardId\":null,", "");
var ser = new JavaScriptSerializer(); var ser = new JavaScriptSerializer();
ReaderEventList events = ser.Deserialize<ReaderEventList>(ret); ReaderEventList events = ser.Deserialize<ReaderEventList>(ret);
events.readerEvents = events.readerEvents.OrderByDescending(r => r.readerEventTime).ToList(); events.readerEvents = events.readerEvents.OrderByDescending(r => r.readerEventTime).ToList();
......
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
...@@ -11,10 +12,22 @@ namespace CardDisplay ...@@ -11,10 +12,22 @@ namespace CardDisplay
/// The main entry point for the application. /// The main entry point for the application.
/// </summary> /// </summary>
[STAThread] [STAThread]
static void Main() static void Main(string[] args)
{ {
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
if (!Debugger.IsAttached)
{
if (args.Length == 0 || args[0] != "-noautoupdate")
{
if (AutoUpdateLib.AutoUpdateCore.CheckForUpdates(null))
return; //program is required to close by autoupdate (probably updated)
}
}
Application.Run(new Form1()); Application.Run(new Form1());
} }
} }
......
...@@ -32,5 +32,5 @@ using System.Runtime.InteropServices; ...@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.6.0")] [assembly: AssemblyVersion("1.0.7.0")]
[assembly: AssemblyFileVersion("1.0.6.0")] [assembly: AssemblyFileVersion("1.0.7.0")]
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:4.0.30319.18449 // Runtime Version:4.0.30319.42000
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
......
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:4.0.30319.18449 // Runtime Version:4.0.30319.42000
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
...@@ -12,7 +12,7 @@ namespace CardDisplay.Properties { ...@@ -12,7 +12,7 @@ namespace CardDisplay.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
...@@ -25,13 +25,13 @@ namespace CardDisplay.Properties { ...@@ -25,13 +25,13 @@ namespace CardDisplay.Properties {
[global::System.Configuration.UserScopedSettingAttribute()] [global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")] [global::System.Configuration.DefaultSettingValueAttribute("Nie4xu9eedu8Shaey1bu")]
public string ApiKey { public string ApiApplicationKey {
get { get {
return ((string)(this["ApiKey"])); return ((string)(this["ApiApplicationKey"]));
} }
set { set {
this["ApiKey"] = value; this["ApiApplicationKey"] = value;
} }
} }
...@@ -70,5 +70,17 @@ namespace CardDisplay.Properties { ...@@ -70,5 +70,17 @@ namespace CardDisplay.Properties {
this["ApiPass"] = value; this["ApiPass"] = value;
} }
} }
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool ApiTokenSet {
get {
return ((bool)(this["ApiTokenSet"]));
}
set {
this["ApiTokenSet"] = value;
}
}
} }
} }
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="CardDisplay.Properties" GeneratedClassName="Settings"> <SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="CardDisplay.Properties" GeneratedClassName="Settings">
<Profiles /> <Profiles />
<Settings> <Settings>
<Setting Name="ApiKey" Type="System.String" Scope="User"> <Setting Name="ApiApplicationKey" Type="System.String" Scope="User">
<Value Profile="(Default)" /> <Value Profile="(Default)">Nie4xu9eedu8Shaey1bu</Value>
</Setting> </Setting>
<Setting Name="ApiURL" Type="System.String" Scope="User"> <Setting Name="ApiURL" Type="System.String" Scope="User">
<Value Profile="(Default)" /> <Value Profile="(Default)" />
...@@ -14,5 +14,8 @@ ...@@ -14,5 +14,8 @@
<Setting Name="ApiPass" Type="System.String" Scope="User"> <Setting Name="ApiPass" Type="System.String" Scope="User">
<Value Profile="(Default)" /> <Value Profile="(Default)" />
</Setting> </Setting>
<Setting Name="ApiTokenSet" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings> </Settings>
</SettingsFile> </SettingsFile>
\ No newline at end of file
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
</configSections> </configSections>
<userSettings> <userSettings>
<CardDisplay.Properties.Settings> <CardDisplay.Properties.Settings>
<setting name="ApiKey" serializeAs="String"> <setting name="ApiApplicationKey" serializeAs="String">
<value /> <value>Nie4xu9eedu8Shaey1bu</value>
</setting> </setting>
<setting name="ApiURL" serializeAs="String"> <setting name="ApiURL" serializeAs="String">
<value /> <value />
...@@ -19,6 +19,9 @@ ...@@ -19,6 +19,9 @@
<setting name="ApiPass" serializeAs="String"> <setting name="ApiPass" serializeAs="String">
<value /> <value />
</setting> </setting>
<setting name="ApiTokenSet" serializeAs="String">
<value>False</value>
</setting>
</CardDisplay.Properties.Settings> </CardDisplay.Properties.Settings>
</userSettings> </userSettings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<AutoPublishSettings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <AutoPublishSettings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<UploadUser>f-solu-06</UploadUser> <UploadUser>f-solu-06</UploadUser>
<UploadPath>/home/f-solu-06/software.f-solutions.fi</UploadPath> <UploadPath>/home/f-solu-06/software.f-solutions.fi</UploadPath>
<UploadHost>software.f-solutions.fi</UploadHost> <UploadHost>www4.f-solutions.fi</UploadHost>
<ProjectName>CardDisplay</ProjectName> <ProjectName>CardDisplay</ProjectName>
<Customers> <Customers>
<Customer> <Customer>
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
Name "CardDisplay moya v1_00_06" Name "CardDisplay moya v1_00_07"
; DO NOT CHANGE OutFile "installer_temp.exe" !!! AutoPublish requires this. ; DO NOT CHANGE OutFile "installer_temp.exe" !!! AutoPublish requires this.
...@@ -198,7 +198,7 @@ FunctionEnd ...@@ -198,7 +198,7 @@ FunctionEnd
Section "!CardDisplay moya stable v1_00_06" SecMain Section "!CardDisplay moya stable v1_00_07" SecMain
SetShellVarContext current SetShellVarContext current
...@@ -225,8 +225,10 @@ Section "!CardDisplay moya stable v1_00_06" SecMain ...@@ -225,8 +225,10 @@ Section "!CardDisplay moya stable v1_00_06" SecMain
; that is referenced to the main project. ; that is referenced to the main project.
File "C:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\bin\Release\MoyaAdminLib.dll" File "C:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\bin\Release\MoyaAdminLib.dll"
File "C:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\bin\Release\AutoUpdateLib.dll"
File "C:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\bin\Release\CardDisplay.pdb" File "C:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\bin\Release\CardDisplay.pdb"
File "C:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\bin\Release\AutoUpdateLib.pdb"
...@@ -315,8 +317,10 @@ Section "Uninstall" ...@@ -315,8 +317,10 @@ Section "Uninstall"
; that is referenced to the main project. ; that is referenced to the main project.
Delete "$INSTDIR\C:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\bin\Release\MoyaAdminLib.dll" Delete "$INSTDIR\C:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\bin\Release\MoyaAdminLib.dll"
Delete "$INSTDIR\C:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\bin\Release\AutoUpdateLib.dll"
Delete "$INSTDIR\C:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\bin\Release\CardDisplay.pdb" Delete "$INSTDIR\C:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\bin\Release\CardDisplay.pdb"
Delete "$INSTDIR\C:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\bin\Release\AutoUpdateLib.pdb"
......
...@@ -9,6 +9,10 @@ using System.Windows.Forms; ...@@ -9,6 +9,10 @@ using System.Windows.Forms;
using System.Web.Script.Serialization; using System.Web.Script.Serialization;
using System.Net; using System.Net;
using System.Collections.Specialized; using System.Collections.Specialized;
using Emgu.CV;
using Emgu.CV.Structure;
using Emgu.CV.CvEnum;
using System.Diagnostics;
namespace ImageResizer namespace ImageResizer
{ {
...@@ -216,6 +220,8 @@ namespace ImageResizer ...@@ -216,6 +220,8 @@ namespace ImageResizer
} }
private bool _suspendRefresh = false; private bool _suspendRefresh = false;
HaarCascade face;
#endregion #endregion
#region Constructors #region Constructors
...@@ -227,6 +233,8 @@ namespace ImageResizer ...@@ -227,6 +233,8 @@ namespace ImageResizer
// Save in full quality // Save in full quality
_encoderParams.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 100L); _encoderParams.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 100L);
// Find the codecs for the supported formats, set the open and save dialog filters // Find the codecs for the supported formats, set the open and save dialog filters
string displayFilters = string.Empty; string displayFilters = string.Empty;
int codecCount = 0; int codecCount = 0;
...@@ -315,6 +323,8 @@ namespace ImageResizer ...@@ -315,6 +323,8 @@ namespace ImageResizer
if (!SuspendRefresh && DrawnImage != null) if (!SuspendRefresh && DrawnImage != null)
{ {
// if( the image is too large, draw only visible portion as dictated by the scrollbars, otherwise draw the whole image. // if( the image is too large, draw only visible portion as dictated by the scrollbars, otherwise draw the whole image.
if (DrawnImage.Width > grpImage.Width || DrawnImage.Height > grpImage.Height) if (DrawnImage.Width > grpImage.Width || DrawnImage.Height > grpImage.Height)
{ {
...@@ -338,8 +348,11 @@ namespace ImageResizer ...@@ -338,8 +348,11 @@ namespace ImageResizer
// Draw the crop rectangle with both yellow and black so it is easily visible no matter the image. // Draw the crop rectangle with both yellow and black so it is easily visible no matter the image.
if (chkCrop.Checked) if (chkCrop.Checked)
{ {
e.Graphics.DrawRectangle(Pens.Yellow, CropBoxX, CropBoxY, (float)nudCropWidth.Value, (float)nudCropHeight.Value); if (!RecognizeFaceAndDrawCropBox(DrawnImage, e.Graphics))
e.Graphics.DrawRectangle(Pens.Black, CropBoxX - 1, CropBoxY - 1, (float)nudCropWidth.Value + 2, (float)nudCropHeight.Value + 2); {
e.Graphics.DrawRectangle(Pens.Yellow, CropBoxX, CropBoxY, (float)nudCropWidth.Value, (float)nudCropHeight.Value);
e.Graphics.DrawRectangle(Pens.Black, CropBoxX - 1, CropBoxY - 1, (float)nudCropWidth.Value + 2, (float)nudCropHeight.Value + 2);
}
} }
} }
} }
...@@ -830,10 +843,21 @@ namespace ImageResizer ...@@ -830,10 +843,21 @@ namespace ImageResizer
private void ImageResizer_Load(object sender, EventArgs e) private void ImageResizer_Load(object sender, EventArgs e)
{ {
if(selectedUser != null) try
{
face = new HaarCascade("haarcascade_frontalface_default.xml");
} catch (Exception ex)
{
Console.WriteLine("Failed to setup face recognizion: " + ex.Message);
}
if (selectedUser != null)
{ {
SelectUser(selectedUser); SelectUser(selectedUser);
} }
} }
...@@ -857,8 +881,7 @@ namespace ImageResizer ...@@ -857,8 +881,7 @@ namespace ImageResizer
Card card = ser.Deserialize<Card>(json); Card card = ser.Deserialize<Card>(json);
//string url = RestClient.GetRequestURL(defaultApiUrl, "card/GetImage/" + card.id); //string url = RestClient.GetRequestURL(defaultApiUrl, "card/GetImage/" + card.id);
if (card.state == "PENDING_VALIDATION" || if (card.state == "PENDING_VALIDATION")
card.state == "REJECTED")
{ {
selectedUser = user; selectedUser = user;
string url = RestClient.GetRequestURL(defaultApiUrl, "v2/user/" + user.UserId + "/image"); string url = RestClient.GetRequestURL(defaultApiUrl, "v2/user/" + user.UserId + "/image");
...@@ -904,8 +927,7 @@ namespace ImageResizer ...@@ -904,8 +927,7 @@ namespace ImageResizer
Card card = ser.Deserialize<Card>(json); Card card = ser.Deserialize<Card>(json);
//string url = RestClient.GetRequestURL(defaultApiUrl, "card/GetImage/" + card.id); //string url = RestClient.GetRequestURL(defaultApiUrl, "card/GetImage/" + card.id);
if (card.state == "PENDING_VALIDATION" || if (card != null && card.state == "PENDING_VALIDATION")
card.state == "REJECTED")
{ {
selectedUser = user; selectedUser = user;
string url = RestClient.GetRequestURL(defaultApiUrl, "v2/user/" + user.UserId + "/image"); string url = RestClient.GetRequestURL(defaultApiUrl, "v2/user/" + user.UserId + "/image");
...@@ -944,6 +966,92 @@ namespace ImageResizer ...@@ -944,6 +966,92 @@ namespace ImageResizer
selectNextUser(); selectNextUser();
} }
private bool RecognizeFaceAndDrawCropBox(Bitmap faceImage, Graphics g)
{
if (face != null)
{
Image<Bgr, Byte> currentFrame = new Image<Bgr, byte>(faceImage);
Image<Gray, byte> gray = null;
gray = currentFrame.Convert<Gray, Byte>();
MCvAvgComp[][] facesDetected = null;
if (gray != null)
{
//Face Detector
facesDetected = gray.DetectHaarCascade(
face,
1.1,
10,
Emgu.CV.CvEnum.HAAR_DETECTION_TYPE.DO_CANNY_PRUNING,
new Size(50, 50));
}
//Action for each element detected
if (facesDetected != null && facesDetected[0].Length > 0)
{
Debug.WriteLine("[imageresizer] Face dedected!");
MCvAvgComp f = facesDetected[0][0];
//decimal width = ((decimal)f.rect.Width) * 3.1M;
//decimal width = ((decimal)f.rect.Width) * 2.8M;
decimal scale = 1.4M; // use this to define size for crop box
int width = (int)(f.rect.Width * scale);
//decimal height = ((decimal)f.rect.Height);
int height = (int)(f.rect.Width * scale * 1.36774193548M);
if (height > faceImage.Height) height = faceImage.Height;
if (width > faceImage.Width) width = faceImage.Width;
int y = f.rect.Y - (int)((height - f.rect.Height) / 2); // calculate new horisontal centerline
int x = f.rect.X - (int)((width - f.rect.Width) / 2); // calculate new vertical center line (not needed if scale is 1)
//g.DrawRectangle(Pens.Blue, f.rect.X, f.rect.Y, f.rect.Width, f.rect.Height);
//g.DrawLine(Pens.Red, f.rect.X, f.rect.Y + (f.rect.Height /2), f.rect.X + f.rect.Width , f.rect.Y + (f.rect.Height / 2));
// allow offset, do not allow thing go outside of picture
if (y < 0) y = 0;
if (y + (int)height > faceImage.Height) y = faceImage.Height - (int)height;
if (x < 0) x = 0;
if (x + (int)width > faceImage.Width) x = faceImage.Width - (int)width;
Debug.WriteLine("[imageresizer] Crop: x: " + x.ToString() + ", y: " + y.ToString() + ", width: " + width.ToString() + ", height: " + height + ", faceImage.Width: " + faceImage.Width.ToString() + ", faceImage.Height: " + faceImage.Height);
if (x + (int)width <= faceImage.Width && y + (int)height <= faceImage.Height && x >= 0 && y >= 0)
{
//Debug.WriteLine("[imageresizer] Crop: x: " + x.ToString() + ", y: " + y.ToString() + ", width: " + width.ToString() + ", height: " + height);
Rectangle cropRect = new Rectangle(x, y, (int)width, (int)height);
Image<Bgr, byte> croppedImage = currentFrame.Copy(cropRect);
croppedImage = croppedImage.Resize(310, 424, INTER.CV_INTER_CUBIC);
//Debug.WriteLine("[takepictureform] Adding score '" + score + "' to croppedImageDictionary.");
g.DrawRectangle(Pens.Yellow, x, y, (float) width, (float)height);
g.DrawRectangle(Pens.Black, x - 1, y - 1, (float)width + 2, (float)height + 2);
return true;
} else
{
Debug.WriteLine("[imageresizer] Failed to draw crop box!");
}
}
} else
{
Debug.WriteLine("[imageresizer] Couldn't dedect faces, something wrong with initializon!");
}
return false;
}
private void cropButton_Click(object sender, EventArgs e) private void cropButton_Click(object sender, EventArgs e)
{ {
_editedImage = new Bitmap((int)nudCropWidth.Value, (int)nudCropHeight.Value); _editedImage = new Bitmap((int)nudCropWidth.Value, (int)nudCropHeight.Value);
......
...@@ -40,6 +40,21 @@ ...@@ -40,6 +40,21 @@
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Emgu.CV">
<HintPath>Resources\Emgu.CV.dll</HintPath>
</Reference>
<Reference Include="Emgu.CV.GPU">
<HintPath>Resources\Emgu.CV.GPU.dll</HintPath>
</Reference>
<Reference Include="Emgu.CV.ML">
<HintPath>Resources\Emgu.CV.ML.dll</HintPath>
</Reference>
<Reference Include="Emgu.CV.UI">
<HintPath>Resources\Emgu.CV.UI.dll</HintPath>
</Reference>
<Reference Include="Emgu.Util">
<HintPath>Resources\Emgu.Util.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
...@@ -95,6 +110,7 @@ ...@@ -95,6 +110,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="photo_portrait.ico" /> <Content Include="photo_portrait.ico" />
<Content Include="Resources\haarcascade_frontalface_default.xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\MoyaAdminLib\MoyaAdminLib.csproj"> <ProjectReference Include="..\..\..\MoyaAdminLib\MoyaAdminLib.csproj">
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Web" /> <Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" /> <Reference Include="System.Web.Extensions" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
......
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Runtime.Serialization;
using System.Text; using System.Text;
namespace MoyaAdminLib namespace MoyaAdminLib
...@@ -11,7 +12,7 @@ namespace MoyaAdminLib ...@@ -11,7 +12,7 @@ namespace MoyaAdminLib
public DateTime readerEventTime = DateTime.MinValue; public DateTime readerEventTime = DateTime.MinValue;
public int readerId = 0; public int readerId = 0;
public Eventuser eventuser; public Eventuser eventuser;
public int printedCardId = 0; public int? printedCardId = 0;
public string printedCardState = ""; public string printedCardState = "";
} }
} }
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.moyaCsvOpenFileDialog = new System.Windows.Forms.OpenFileDialog();
this.GoogleCsvOpenFileDialog = new System.Windows.Forms.OpenFileDialog(); this.GoogleCsvOpenFileDialog = new System.Windows.Forms.OpenFileDialog();
this.moyaCsvTextBox = new System.Windows.Forms.TextBox(); this.moyaCsvTextBox = new System.Windows.Forms.TextBox();
this.googleCsvTextBox = new System.Windows.Forms.TextBox(); this.googleCsvTextBox = new System.Windows.Forms.TextBox();
...@@ -38,12 +37,9 @@ ...@@ -38,12 +37,9 @@
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.resultTextBox = new System.Windows.Forms.TextBox(); this.resultTextBox = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button();
this.moyaCsvOpenFileDialog = new System.Windows.Forms.OpenFileDialog();
this.SuspendLayout(); this.SuspendLayout();
// //
// moyaCsvOpenFileDialog
//
this.moyaCsvOpenFileDialog.FileName = "openFileDialog1";
//
// GoogleCsvOpenFileDialog // GoogleCsvOpenFileDialog
// //
this.GoogleCsvOpenFileDialog.FileName = "openFileDialog2"; this.GoogleCsvOpenFileDialog.FileName = "openFileDialog2";
...@@ -111,6 +107,10 @@ ...@@ -111,6 +107,10 @@
this.button1.UseVisualStyleBackColor = true; this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click); this.button1.Click += new System.EventHandler(this.button1_Click);
// //
// moyaCsvOpenFileDialog
//
this.moyaCsvOpenFileDialog.FileName = "openFileDialog1";
//
// CSVGeneratorForItemCollectionForm // CSVGeneratorForItemCollectionForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
...@@ -132,8 +132,6 @@ ...@@ -132,8 +132,6 @@
} }
#endregion #endregion
private System.Windows.Forms.OpenFileDialog moyaCsvOpenFileDialog;
private System.Windows.Forms.OpenFileDialog GoogleCsvOpenFileDialog; private System.Windows.Forms.OpenFileDialog GoogleCsvOpenFileDialog;
private System.Windows.Forms.TextBox moyaCsvTextBox; private System.Windows.Forms.TextBox moyaCsvTextBox;
private System.Windows.Forms.TextBox googleCsvTextBox; private System.Windows.Forms.TextBox googleCsvTextBox;
...@@ -143,5 +141,6 @@ ...@@ -143,5 +141,6 @@
private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox resultTextBox; private System.Windows.Forms.TextBox resultTextBox;
private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button1;
private System.Windows.Forms.OpenFileDialog moyaCsvOpenFileDialog;
} }
} }
\ No newline at end of file
...@@ -25,7 +25,7 @@ namespace MoyaAdminUI ...@@ -25,7 +25,7 @@ namespace MoyaAdminUI
string resultCSV; string resultCSV;
StringWriter writer = new StringWriter(); StringWriter writer = new StringWriter();
string[] headers = new string[3]; string[] headers = new string[4];
...@@ -48,6 +48,7 @@ namespace MoyaAdminUI ...@@ -48,6 +48,7 @@ namespace MoyaAdminUI
headers[0] = "Nimi"; headers[0] = "Nimi";
headers[1] = "Sähköposti"; headers[1] = "Sähköposti";
headers[2] = "Tuotteet"; headers[2] = "Tuotteet";
headers[3] = "Ei tulossa";
//CsvWriter.Write(writer, ) //CsvWriter.Write(writer, )
} }
} }
...@@ -61,16 +62,19 @@ namespace MoyaAdminUI ...@@ -61,16 +62,19 @@ namespace MoyaAdminUI
string name = null; string name = null;
string email = null; string email = null;
string items = null; string items = null;
bool notComing = false;
string[] newLine = new string[3]; string[] newLine = new string[4];
Dictionary<string, string> nameToNameDict = new Dictionary<string, string>();
List<string> namesAddedToLines = new List<string>(); List<string> namesAddedToLines = new List<string>();
List<string> emailsAddedToLines = new List<string>();
CultureInfo provider = new CultureInfo("en-US"); CultureInfo provider = new CultureInfo("en-US");
foreach (ICsvLine line in CsvReader.ReadFromText(strMoyaCsv)) foreach (ICsvLine line in CsvReader.ReadFromText(strMoyaCsv))
{ {
notComing = false;
string kpl = line["Kpl"]; string kpl = line["Kpl"];
decimal amount = decimal.Parse(kpl, NumberStyles.AllowDecimalPoint, provider); decimal amount = decimal.Parse(kpl, NumberStyles.AllowDecimalPoint, provider);
...@@ -91,6 +95,7 @@ namespace MoyaAdminUI ...@@ -91,6 +95,7 @@ namespace MoyaAdminUI
foreach (ICsvLine line2 in CsvReader.ReadFromText(strGoogleCsv)) foreach (ICsvLine line2 in CsvReader.ReadFromText(strGoogleCsv))
{ {
if (line2["Nimi"].ToLower() == name.ToLower() || if (line2["Nimi"].ToLower() == name.ToLower() ||
line2["Nimi"].ToLower().Contains(name.ToLower()) ||
line2["Email Address"].ToLower() == email.ToLower()) line2["Email Address"].ToLower() == email.ToLower())
{ {
found = true; found = true;
...@@ -102,6 +107,12 @@ namespace MoyaAdminUI ...@@ -102,6 +107,12 @@ namespace MoyaAdminUI
else else
items += "Miesten malli, "; items += "Miesten malli, ";
items += line2["Järkkäpaidan koko"]; items += line2["Järkkäpaidan koko"];
if (line2["Ei tulossa/Perunut"] == "X")
notComing = true;
if (!nameToNameDict.Keys.Contains(name))
nameToNameDict.Add(name, line2["Nimi"]);
else
Debug.WriteLine("Name " + name + " already added to dict.");
} }
} }
...@@ -131,13 +142,21 @@ namespace MoyaAdminUI ...@@ -131,13 +142,21 @@ namespace MoyaAdminUI
newLine[2] = ""; newLine[2] = "";
Debug.WriteLine("Items is null!"); Debug.WriteLine("Items is null!");
} }
if (notComing)
newLine[3] = "X";
else
newLine[3] = "";
if(newLine != null) if(newLine != null)
lines.Add(newLine); lines.Add(newLine);
if(!namesAddedToLines.Contains(name)) if(!namesAddedToLines.Contains(name))
namesAddedToLines.Add(name); namesAddedToLines.Add(name);
if (!emailsAddedToLines.Contains(email))
emailsAddedToLines.Add(email);
newLine = new string[3]; newLine = new string[4];
name = line["Nimi"]; name = line["Nimi"];
email = line["Sähköposti"]; email = line["Sähköposti"];
...@@ -147,9 +166,11 @@ namespace MoyaAdminUI ...@@ -147,9 +166,11 @@ namespace MoyaAdminUI
foreach (ICsvLine line2 in CsvReader.ReadFromText(strGoogleCsv)) foreach (ICsvLine line2 in CsvReader.ReadFromText(strGoogleCsv))
{ {
if(!namesAddedToLines.Contains(line2["Nimi"]) ) if(!namesAddedToLines.Contains(line2["Nimi"]) &&
!emailsAddedToLines.Contains(line2["Email Address"]) &&
!nameToNameDict.Values.Contains(line2["Nimi"]))
{ {
newLine = new string[3]; newLine = new string[4];
if (line2["Nimi"] != null) if (line2["Nimi"] != null)
newLine[0] = line2["Nimi"]; newLine[0] = line2["Nimi"];
else else
...@@ -171,8 +192,13 @@ namespace MoyaAdminUI ...@@ -171,8 +192,13 @@ namespace MoyaAdminUI
newLine[2] = item; newLine[2] = item;
else else
newLine[2] = ""; newLine[2] = "";
if(newLine != null) if (line2["Ei tulossa/Perunut"] == "X")
newLine[3] = "X";
else
newLine[3] = "";
if (newLine != null)
lines.Add(newLine); lines.Add(newLine);
} }
} }
writer = new StringWriter(); writer = new StringWriter();
......
...@@ -117,13 +117,13 @@ ...@@ -117,13 +117,13 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="moyaCsvOpenFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="GoogleCsvOpenFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="GoogleCsvOpenFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>201, 17</value> <value>201, 17</value>
</metadata> </metadata>
<metadata name="selectFileToSaveOpenFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="selectFileToSaveOpenFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>395, 17</value> <value>395, 17</value>
</metadata> </metadata>
<metadata name="moyaCsvOpenFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root> </root>
\ No newline at end of file
...@@ -53,6 +53,10 @@ ...@@ -53,6 +53,10 @@
this.previewTextBox = new System.Windows.Forms.TextBox(); this.previewTextBox = new System.Windows.Forms.TextBox();
this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.messageToolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.messageToolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.listView1 = new System.Windows.Forms.ListView();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.label10 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.booksNumberNumericUpDown)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.booksNumberNumericUpDown)).BeginInit();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.lastAddedBookNumericUpDown)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.lastAddedBookNumericUpDown)).BeginInit();
...@@ -299,9 +303,9 @@ ...@@ -299,9 +303,9 @@
// //
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.messageToolStripStatusLabel}); this.messageToolStripStatusLabel});
this.statusStrip1.Location = new System.Drawing.Point(0, 267); this.statusStrip1.Location = new System.Drawing.Point(0, 272);
this.statusStrip1.Name = "statusStrip1"; this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(280, 22); this.statusStrip1.Size = new System.Drawing.Size(595, 22);
this.statusStrip1.TabIndex = 29; this.statusStrip1.TabIndex = 29;
this.statusStrip1.Text = "Status"; this.statusStrip1.Text = "Status";
// //
...@@ -311,11 +315,47 @@ ...@@ -311,11 +315,47 @@
this.messageToolStripStatusLabel.Size = new System.Drawing.Size(39, 17); this.messageToolStripStatusLabel.Size = new System.Drawing.Size(39, 17);
this.messageToolStripStatusLabel.Text = "Status"; this.messageToolStripStatusLabel.Text = "Status";
// //
// listView1
//
this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1,
this.columnHeader2});
this.listView1.FullRowSelect = true;
this.listView1.Location = new System.Drawing.Point(280, 27);
this.listView1.MultiSelect = false;
this.listView1.Name = "listView1";
this.listView1.Size = new System.Drawing.Size(303, 225);
this.listView1.TabIndex = 30;
this.listView1.UseCompatibleStateImageBehavior = false;
this.listView1.View = System.Windows.Forms.View.Details;
this.listView1.KeyUp += new System.Windows.Forms.KeyEventHandler(this.listView1_KeyUp);
//
// columnHeader1
//
this.columnHeader1.Text = "Nimi";
this.columnHeader1.Width = 99;
//
// columnHeader2
//
this.columnHeader2.Text = "Nick";
this.columnHeader2.Width = 106;
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(280, 8);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(69, 13);
this.label10.TabIndex = 31;
this.label10.Text = "Printed cards";
//
// CardLocationInput // CardLocationInput
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(280, 289); this.ClientSize = new System.Drawing.Size(595, 294);
this.Controls.Add(this.label10);
this.Controls.Add(this.listView1);
this.Controls.Add(this.statusStrip1); this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox2);
this.Controls.Add(this.label6); this.Controls.Add(this.label6);
...@@ -372,5 +412,9 @@ ...@@ -372,5 +412,9 @@
private System.Windows.Forms.TextBox previewTextBox; private System.Windows.Forms.TextBox previewTextBox;
private System.Windows.Forms.StatusStrip statusStrip1; private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel messageToolStripStatusLabel; private System.Windows.Forms.ToolStripStatusLabel messageToolStripStatusLabel;
private System.Windows.Forms.ListView listView1;
private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.ColumnHeader columnHeader2;
private System.Windows.Forms.Label label10;
} }
} }
\ No newline at end of file
...@@ -30,6 +30,42 @@ namespace MoyaAdminUI ...@@ -30,6 +30,42 @@ namespace MoyaAdminUI
private void CardLocationInput_Load(object sender, EventArgs e) private void CardLocationInput_Load(object sender, EventArgs e)
{ {
updatePreviewTextBox(); updatePreviewTextBox();
loadPrintedCards();
}
private void loadPrintedCards()
{
List<Card> cards = new List<Card>();
foreach (User user in User.Cache)
{
RestClient client = new RestClient(Properties.Settings.Default.ApiURL);
string ret = "";
try
{
ret = client.MakeRequest("user/card/" + user.EventUserId);
var ser = new JavaScriptSerializer();
Card card = ser.Deserialize<Card>(ret);
if (card != null && card.state == "PRINTED")
{
cards.Add(card);
continue;
}
}
catch (Exception ex)
{
continue;
}
}
cards = cards.OrderBy(c => c.wholeName).ToList();
foreach(Card card in cards)
{
ListViewItem lvi = new ListViewItem(card.wholeName);
lvi.SubItems.Add(card.username);
lvi.Tag = card;
listView1.Items.Add(lvi);
}
} }
private void barcodeTextBox_TextChanged(object sender, EventArgs e) private void barcodeTextBox_TextChanged(object sender, EventArgs e)
...@@ -53,48 +89,21 @@ namespace MoyaAdminUI ...@@ -53,48 +89,21 @@ namespace MoyaAdminUI
if (id != 0) if (id != 0)
{ {
RestClient client = new RestClient(Properties.Settings.Default.ApiURL);
string ret = client.MakeRequest("card/Get/" + id);
var ser = new JavaScriptSerializer();
Card card = ser.Deserialize<Card>(ret);
int lastAddedBook = (int)booksNumberNumericUpDown.Value;
int lastAddedPage = (int)pageNumberNumericUpDown.Value;
int lastAddedSlot = (int)slotsNumberNumericUpDown.Value;
string value = "";
if (prefixTextBox.Text != "")
value = prefixTextBox.Text + ".";
value += booksNumberNumericUpDown.Value.ToString() + "." + pageNumberNumericUpDown.Value.ToString() + "." + slotsNumberNumericUpDown.Value.ToString();
if ((slotsNumberNumericUpDown.Value + 1) > numberOfCardSlotsnumericUpDown.Value)
{
slotsNumberNumericUpDown.Value = 1;
pageNumberNumericUpDown.Value++;
}
else
slotsNumberNumericUpDown.Value++;
string json = "{\"" + key + "\":\"" + value + "\"}";
RestClient client2 = new RestClient(Properties.Settings.Default.ApiURL, HttpVerb.PUT, json); RestClient client = new RestClient(Properties.Settings.Default.ApiURL);
string ret = null;
try try
{ {
client2.MakeRequest("meta/v1/printedcard/" + card.id + "/card-filing"); ret = client.MakeRequest("card/Get/" + id);
} }catch (Exception ex)
catch (ApplicationException ex)
{ {
if (!ex.Message.Contains("HTTP NoContent")) messageToolStripStatusLabel.Text = "Viivakoodin lukeminen ei onnistunut!";
return; return;
} }
var ser = new JavaScriptSerializer();
Card card = ser.Deserialize<Card>(ret);
lastAddedMeta = card; addMetaToCard(card);
lastAddedBookNumericUpDown.Value = lastAddedBook;
lastAddedPageNumericUpDown.Value = lastAddedPage;
lastAddedSlotsNumericUpDown.Value = lastAddedSlot;
messageToolStripStatusLabel.Text = "Viimeisin lisätty value: " + value + " kortille: " + card.Label();
} }
else else
messageToolStripStatusLabel.Text = "Viivakoodin lukeminen ei onnistunut!"; messageToolStripStatusLabel.Text = "Viivakoodin lukeminen ei onnistunut!";
...@@ -132,5 +141,61 @@ namespace MoyaAdminUI ...@@ -132,5 +141,61 @@ namespace MoyaAdminUI
barcodeTextBox.Focus(); barcodeTextBox.Focus();
} }
private void listView1_KeyUp(object sender, KeyEventArgs e)
{
if(e.KeyData == Keys.Enter && listView1.SelectedItems != null && listView1.SelectedItems.Count == 1)
{
if(listView1.SelectedItems[0].Tag is Card)
{
Card card = (Card)listView1.SelectedItems[0].Tag;
addMetaToCard(card);
int index = listView1.SelectedIndices[0];
index = index + 1;
if(index < listView1.Items.Count)
this.listView1.Items[index].Selected = true;
}
}
}
private void addMetaToCard(Card card)
{
int lastAddedBook = (int)booksNumberNumericUpDown.Value;
int lastAddedPage = (int)pageNumberNumericUpDown.Value;
int lastAddedSlot = (int)slotsNumberNumericUpDown.Value;
string value = "";
if (prefixTextBox.Text != "")
value = prefixTextBox.Text + ".";
value += booksNumberNumericUpDown.Value.ToString() + "." + pageNumberNumericUpDown.Value.ToString() + "." + slotsNumberNumericUpDown.Value.ToString();
if ((slotsNumberNumericUpDown.Value + 1) > numberOfCardSlotsnumericUpDown.Value)
{
slotsNumberNumericUpDown.Value = 1;
pageNumberNumericUpDown.Value++;
}
else
slotsNumberNumericUpDown.Value++;
string json = "{\"" + key + "\":\"" + value + "\"}";
RestClient client2 = new RestClient(Properties.Settings.Default.ApiURL, HttpVerb.PUT, json);
try
{
client2.MakeRequest("meta/v1/printedcard/" + card.id + "/card-filing");
}
catch (ApplicationException ex)
{
if (!ex.Message.Contains("HTTP NoContent"))
return;
}
lastAddedMeta = card;
lastAddedBookNumericUpDown.Value = lastAddedBook;
lastAddedPageNumericUpDown.Value = lastAddedPage;
lastAddedSlotsNumericUpDown.Value = lastAddedSlot;
messageToolStripStatusLabel.Text = "Viimeisin lisätty value: " + value + " kortille: " + card.Label();
}
} }
} }
namespace MoyaAdminUI
{
partial class GetListOfUsersWithUnlinkedPlacesForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.moyaCsvTextBox = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.resultTextBox = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.moyaCsvOpenFileDialog = new System.Windows.Forms.OpenFileDialog();
this.selectFileToSaveOpenFileDialog = new System.Windows.Forms.OpenFileDialog();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(38, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(57, 13);
this.label1.TabIndex = 8;
this.label1.Text = "Moya CSV";
//
// moyaCsvTextBox
//
this.moyaCsvTextBox.Location = new System.Drawing.Point(101, 6);
this.moyaCsvTextBox.Name = "moyaCsvTextBox";
this.moyaCsvTextBox.Size = new System.Drawing.Size(176, 20);
this.moyaCsvTextBox.TabIndex = 6;
//
// button1
//
this.button1.Location = new System.Drawing.Point(202, 58);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 12;
this.button1.Text = "Get CSV";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// resultTextBox
//
this.resultTextBox.Location = new System.Drawing.Point(101, 32);
this.resultTextBox.Name = "resultTextBox";
this.resultTextBox.Size = new System.Drawing.Size(176, 20);
this.resultTextBox.TabIndex = 10;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(58, 35);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(37, 13);
this.label3.TabIndex = 11;
this.label3.Text = "Result";
//
// moyaCsvOpenFileDialog
//
this.moyaCsvOpenFileDialog.FileName = "openFileDialog1";
//
// selectFileToSaveOpenFileDialog
//
this.selectFileToSaveOpenFileDialog.FileName = "openFileDialog2";
//
// GetListOfUsersWithUnlinkedPlacesForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(288, 98);
this.Controls.Add(this.button1);
this.Controls.Add(this.label3);
this.Controls.Add(this.resultTextBox);
this.Controls.Add(this.label1);
this.Controls.Add(this.moyaCsvTextBox);
this.Name = "GetListOfUsersWithUnlinkedPlacesForm";
this.Text = "GetListOfUsersWithUnlinkedPlacesForm";
this.Load += new System.EventHandler(this.GetListOfUsersWithUnlinkedPlacesForm_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox moyaCsvTextBox;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox resultTextBox;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.OpenFileDialog moyaCsvOpenFileDialog;
private System.Windows.Forms.OpenFileDialog selectFileToSaveOpenFileDialog;
}
}
\ No newline at end of file
using Csv;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace MoyaAdminUI
{
public partial class GetListOfUsersWithUnlinkedPlacesForm : Form
{
public GetListOfUsersWithUnlinkedPlacesForm()
{
InitializeComponent();
}
List<string> logins;
string moyaCSV;
string resultCSV;
StringWriter writer = new StringWriter();
string[] headers = new string[1];
public List<string> SetLoginsList
{
set { logins = value; }
}
private void GetListOfUsersWithUnlinkedPlacesForm_Load(object sender, EventArgs e)
{
if (moyaCsvOpenFileDialog.ShowDialog() == DialogResult.OK)
{
moyaCSV = moyaCsvOpenFileDialog.FileName;
moyaCsvTextBox.Text = moyaCSV;
}
if (selectFileToSaveOpenFileDialog.ShowDialog() == DialogResult.OK)
{
resultCSV = selectFileToSaveOpenFileDialog.FileName;
resultTextBox.Text = resultCSV;
headers[0] = "Sähköposti";
//CsvWriter.Write(writer, )
}
}
private void button1_Click(object sender, EventArgs e)
{
List<string[]> lines = new List<string[]>();
string strMoyaCsv = File.ReadAllText(moyaCSV);
string[] newLine = new string[1];
List<string> emails = new List<string>();
foreach(string login in logins)
{
foreach (ICsvLine line in CsvReader.ReadFromText(strMoyaCsv))
{
if(line["Login"] == login)
{
emails.Add(line["Email"]);
break;
}
}
}
foreach(string email in emails)
{
lines.Add(new string[] { email });
}
writer = new StringWriter();
CsvWriter.Write(writer, headers, lines.ToArray(), ':');
string result = writer.ToString();
File.WriteAllText(resultCSV, result);
if(lines.Count > 0)
{
MessageBox.Show("Wrote " + lines.Count.ToString() + " lines to file " + resultCSV);
this.DialogResult = DialogResult.OK;
this.Close();
} else
{
MessageBox.Show("No lines to write");
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="moyaCsvOpenFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="selectFileToSaveOpenFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>619, 17</value>
</metadata>
</root>
\ No newline at end of file
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
this.imageResizer1.RequiredWidth = 0; this.imageResizer1.RequiredWidth = 0;
this.imageResizer1.Size = new System.Drawing.Size(958, 936); this.imageResizer1.Size = new System.Drawing.Size(958, 936);
this.imageResizer1.TabIndex = 0; this.imageResizer1.TabIndex = 0;
this.imageResizer1.Load += new System.EventHandler(this.imageResizer1_Load);
// //
// ImageCropForm // ImageCropForm
// //
......
...@@ -50,5 +50,10 @@ namespace MoyaAdminUI ...@@ -50,5 +50,10 @@ namespace MoyaAdminUI
imageResizer1.SelectUser(selectedUser); imageResizer1.SelectUser(selectedUser);
} }
} }
private void imageResizer1_Load(object sender, EventArgs e)
{
}
} }
} }
...@@ -54,8 +54,9 @@ ...@@ -54,8 +54,9 @@
this.orgMealToolStripButton = new System.Windows.Forms.ToolStripButton(); this.orgMealToolStripButton = new System.Windows.Forms.ToolStripButton();
this.toolStripButton2 = new System.Windows.Forms.ToolStripButton(); this.toolStripButton2 = new System.Windows.Forms.ToolStripButton();
this.cropImageToolStripButton = new System.Windows.Forms.ToolStripButton(); this.cropImageToolStripButton = new System.Windows.Forms.ToolStripButton();
this.toolStripButton3 = new System.Windows.Forms.ToolStripButton(); this.getListOfUnlinkedComputerPlacesToolStripButton = new System.Windows.Forms.ToolStripButton();
this.generateBacksidesToolStripButton = new System.Windows.Forms.ToolStripButton(); this.generateBacksidesToolStripButton = new System.Windows.Forms.ToolStripButton();
this.toolStripButton4 = new System.Windows.Forms.ToolStripButton();
this.TopPanel = new System.Windows.Forms.Panel(); this.TopPanel = new System.Windows.Forms.Panel();
this.allPlacesCountTextBox = new System.Windows.Forms.TextBox(); this.allPlacesCountTextBox = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
...@@ -71,7 +72,7 @@ ...@@ -71,7 +72,7 @@
this.ImageRefreshTimer = new System.Windows.Forms.Timer(this.components); this.ImageRefreshTimer = new System.Windows.Forms.Timer(this.components);
this.panel2 = new System.Windows.Forms.Panel(); this.panel2 = new System.Windows.Forms.Panel();
this.placesCountTimer = new System.Windows.Forms.Timer(this.components); this.placesCountTimer = new System.Windows.Forms.Timer(this.components);
this.toolStripButton4 = new System.Windows.Forms.ToolStripButton(); this.toolStripButton3 = new System.Windows.Forms.ToolStripButton();
this.placesContextMenuStrip.SuspendLayout(); this.placesContextMenuStrip.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.MapPictureBox)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.MapPictureBox)).BeginInit();
this.toolStrip1.SuspendLayout(); this.toolStrip1.SuspendLayout();
...@@ -189,9 +190,10 @@ ...@@ -189,9 +190,10 @@
this.orgMealToolStripButton, this.orgMealToolStripButton,
this.toolStripButton2, this.toolStripButton2,
this.cropImageToolStripButton, this.cropImageToolStripButton,
this.toolStripButton3, this.getListOfUnlinkedComputerPlacesToolStripButton,
this.generateBacksidesToolStripButton, this.generateBacksidesToolStripButton,
this.toolStripButton4}); this.toolStripButton4,
this.toolStripButton3});
this.toolStrip1.Location = new System.Drawing.Point(0, 0); this.toolStrip1.Location = new System.Drawing.Point(0, 0);
this.toolStrip1.Name = "toolStrip1"; this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(1078, 25); this.toolStrip1.Size = new System.Drawing.Size(1078, 25);
...@@ -328,16 +330,15 @@ ...@@ -328,16 +330,15 @@
this.cropImageToolStripButton.Text = "Crop Image tool"; this.cropImageToolStripButton.Text = "Crop Image tool";
this.cropImageToolStripButton.Click += new System.EventHandler(this.cropImageToolStripButton_Click); this.cropImageToolStripButton.Click += new System.EventHandler(this.cropImageToolStripButton_Click);
// //
// toolStripButton3 // getListOfUnlinkedComputerPlacesToolStripButton
// //
this.toolStripButton3.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.getListOfUnlinkedComputerPlacesToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButton3.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton3.Image"))); this.getListOfUnlinkedComputerPlacesToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("getListOfUnlinkedComputerPlacesToolStripButton.Image")));
this.toolStripButton3.ImageTransparentColor = System.Drawing.Color.Magenta; this.getListOfUnlinkedComputerPlacesToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton3.Name = "toolStripButton3"; this.getListOfUnlinkedComputerPlacesToolStripButton.Name = "getListOfUnlinkedComputerPlacesToolStripButton";
this.toolStripButton3.Size = new System.Drawing.Size(23, 22); this.getListOfUnlinkedComputerPlacesToolStripButton.Size = new System.Drawing.Size(23, 22);
this.toolStripButton3.Text = "Get list of computer places that are not linked to user"; this.getListOfUnlinkedComputerPlacesToolStripButton.Text = "Get list of computer places that are not linked to user";
this.toolStripButton3.Visible = false; this.getListOfUnlinkedComputerPlacesToolStripButton.Click += new System.EventHandler(this.getListOfUnlinkedComputerPlacesToolStripButton_Click);
this.toolStripButton3.Click += new System.EventHandler(this.toolStripButton3_Click_1);
// //
// generateBacksidesToolStripButton // generateBacksidesToolStripButton
// //
...@@ -350,6 +351,16 @@ ...@@ -350,6 +351,16 @@
this.generateBacksidesToolStripButton.Visible = false; this.generateBacksidesToolStripButton.Visible = false;
this.generateBacksidesToolStripButton.Click += new System.EventHandler(this.generateBacksidesToolStripButton_Click); this.generateBacksidesToolStripButton.Click += new System.EventHandler(this.generateBacksidesToolStripButton_Click);
// //
// toolStripButton4
//
this.toolStripButton4.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButton4.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton4.Image")));
this.toolStripButton4.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton4.Name = "toolStripButton4";
this.toolStripButton4.Size = new System.Drawing.Size(23, 22);
this.toolStripButton4.Text = "Generate CSV for item collection";
this.toolStripButton4.Click += new System.EventHandler(this.toolStripButton4_Click);
//
// TopPanel // TopPanel
// //
this.TopPanel.Controls.Add(this.allPlacesCountTextBox); this.TopPanel.Controls.Add(this.allPlacesCountTextBox);
...@@ -481,15 +492,15 @@ ...@@ -481,15 +492,15 @@
this.placesCountTimer.Interval = 600000000; this.placesCountTimer.Interval = 600000000;
this.placesCountTimer.Tick += new System.EventHandler(this.placesCountTimer_Tick); this.placesCountTimer.Tick += new System.EventHandler(this.placesCountTimer_Tick);
// //
// toolStripButton4 // toolStripButton3
// //
this.toolStripButton4.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripButton3.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButton4.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton4.Image"))); this.toolStripButton3.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton3.Image")));
this.toolStripButton4.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButton3.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton4.Name = "toolStripButton4"; this.toolStripButton3.Name = "toolStripButton3";
this.toolStripButton4.Size = new System.Drawing.Size(23, 22); this.toolStripButton3.Size = new System.Drawing.Size(23, 22);
this.toolStripButton4.Text = "Generate CSV for item collection"; this.toolStripButton3.Text = "Get Printed Cards CSV";
this.toolStripButton4.Click += new System.EventHandler(this.toolStripButton4_Click); this.toolStripButton3.Click += new System.EventHandler(this.toolStripButton3_Click_2);
// //
// MainForm // MainForm
// //
...@@ -561,10 +572,11 @@ ...@@ -561,10 +572,11 @@
private System.Windows.Forms.ToolStripButton toolStripButton2; private System.Windows.Forms.ToolStripButton toolStripButton2;
private System.Windows.Forms.ToolStripMenuItem printPlaceStickersForSelectedPlacesToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem printPlaceStickersForSelectedPlacesToolStripMenuItem;
private System.Windows.Forms.ToolStripButton cropImageToolStripButton; private System.Windows.Forms.ToolStripButton cropImageToolStripButton;
private System.Windows.Forms.ToolStripButton toolStripButton3; private System.Windows.Forms.ToolStripButton getListOfUnlinkedComputerPlacesToolStripButton;
private System.Windows.Forms.ToolStripMenuItem doAReplaceForComputerPlaceNameToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem doAReplaceForComputerPlaceNameToolStripMenuItem;
private System.Windows.Forms.ToolStripButton generateBacksidesToolStripButton; private System.Windows.Forms.ToolStripButton generateBacksidesToolStripButton;
private System.Windows.Forms.ToolStripButton toolStripButton4; private System.Windows.Forms.ToolStripButton toolStripButton4;
private System.Windows.Forms.ToolStripButton toolStripButton3;
} }
} }
...@@ -12,6 +12,7 @@ using System.Net; ...@@ -12,6 +12,7 @@ using System.Net;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web.Script.Serialization;
using System.Windows.Forms; using System.Windows.Forms;
namespace MoyaAdminUI namespace MoyaAdminUI
...@@ -1537,25 +1538,7 @@ namespace MoyaAdminUI ...@@ -1537,25 +1538,7 @@ namespace MoyaAdminUI
private void toolStripButton3_Click_1(object sender, EventArgs e) private void toolStripButton3_Click_1(object sender, EventArgs e)
{ {
List<User> unmappedUsers = new List<User>();
foreach(ComputerPlace place in ComputerPlace.Cache)
{
if (place.APIReference != null && place.APIReference.eventuserId <= 0)
{
foreach (User user in User.Cache)
{
if (!unmappedUsers.Contains(user) && user.EventUserId == place.ReserverId)
{
unmappedUsers.Add(user);
break;
}
}
}
}
ListUsersForm frm = new ListUsersForm();
frm.Users = unmappedUsers;
frm.Show();
} }
private void doAReplaceForComputerPlaceNameToolStripMenuItem_Click(object sender, EventArgs e) private void doAReplaceForComputerPlaceNameToolStripMenuItem_Click(object sender, EventArgs e)
...@@ -1591,5 +1574,34 @@ namespace MoyaAdminUI ...@@ -1591,5 +1574,34 @@ namespace MoyaAdminUI
CSVGeneratorForItemCollectionForm frm = new CSVGeneratorForItemCollectionForm(); CSVGeneratorForItemCollectionForm frm = new CSVGeneratorForItemCollectionForm();
frm.Show(); frm.Show();
} }
private void getListOfUnlinkedComputerPlacesToolStripButton_Click(object sender, EventArgs e)
{
List<string> logins = new List<string>();
foreach(ListViewItem lvi in PlacesListView.Items)
{
if(lvi.Tag is ComputerPlace)
{
ComputerPlace place = (ComputerPlace)lvi.Tag;
if(place.APIReference != null && place.APIReference.eventuserId <= 0)
{
if (place.User != null)
{
if (!logins.Contains(place.User.Login))
logins.Add(place.User.Login);
}
}
}
}
GetListOfUsersWithUnlinkedPlacesForm frm = new GetListOfUsersWithUnlinkedPlacesForm();
frm.SetLoginsList = logins;
frm.Show();
}
private void toolStripButton3_Click_2(object sender, EventArgs e)
{
}
} }
} }
...@@ -214,53 +214,53 @@ ...@@ -214,53 +214,53 @@
<data name="usersToolStripPrintButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="usersToolStripPrintButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
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
1OqXAAAAAElFTkSuQmCC jPUu2gAAAABJRU5ErkJggg==
</value> </value>
</data> </data>
<data name="cardLocationInputToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="cardLocationInputToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
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
</value> </value>
</data> </data>
<data name="incomingFormToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="incomingFormToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
...@@ -281,20 +281,20 @@ ...@@ -281,20 +281,20 @@
<data name="cardInfoToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="cardInfoToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
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
AwlzqVOTaKWQAAAAAElFTkSuQmCC AeGpTdIVnM4AAAAASUVORK5CYII=
</value> </value>
</data> </data>
<data name="cloackRoomToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="cloackRoomToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
...@@ -330,20 +330,20 @@ ...@@ -330,20 +330,20 @@
<data name="toolStripButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="toolStripButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
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
</value> </value>
</data> </data>
<data name="orgMealToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="orgMealToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
...@@ -396,43 +396,70 @@ ...@@ -396,43 +396,70 @@
yfkbm/HHj8fojrEAAAAASUVORK5CYII= yfkbm/HHj8fojrEAAAAASUVORK5CYII=
</value> </value>
</data> </data>
<data name="toolStripButton3.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="getListOfUnlinkedComputerPlacesToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIqSURBVFhHvZc9L0RBFIZXROmjEyqJXkMkJOI/iD+AH4RG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 QiMqKqISStQkohQKrcIPkPA+m52bc+fe2Zk7s/EmTzbW7Lznzse55/QGmhCXYqP/V7nWxYG4F8+Dz32x
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw LBrC/Fr8incxKXK1IO4Ec4W4EFOiEk9uB5yKHK2KL2HnCvEipkVfLPuHsAO2RBdh/i3sHDHORSWW/Uy4
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc f/IkcyJFIfMnsSM2xZ54E/6YFVHTtnDLeMMXEYXMj8W4sJoRfhCHoqF5gfmPWOKLgELmRyKkXWHHPoqg
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 Rm2O2A47nivaWWPiVdiJIGaOOBP2Nw8iS4viU3Qx50zwxDYAklW2XBAp5oiDac1hTRRpdvAZE0H65mTM
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 JLHnJWoz56qTtqPitHPgWO4ctZlze5g3KnvV2OuuQYzM3EEQJXteZA5MmiKCtFcU/s3cyeaJfzd3IggO
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo cJI5V6KtmMg1d0q+wm1lVJc9LxLp0DcnbaaIIHOuaE28EKw5Lwy/mGgT5u43RUHwSrQB8MqMyZo7OHBZ
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ adt/RVI0DFObeeyqDStu+mWRnYyyKaRcc8q7W0G51xCFoZ2QwpEC0oozcSLsOEhNMtSYjOeqU/jWRGns
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D T0wQlNJsB2eCEtsfk5zhJEp8m2doAWodGE2CnTxGF3Mnmh07B81Q1YvSJtEu2QEheJKu5k62+YErUYmG
TgDQASA1MVpwzwAAAABJRU5ErkJggg== kcbRDvAhYyZVMgGx7K4NpCGmMW6IFppW2rbWJCta7lGIZachlnmv9wdlw0FH8ToxXgAAAABJRU5ErkJg
gg==
</value> </value>
</data> </data>
<data name="generateBacksidesToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="generateBacksidesToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
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
</value> </value>
</data> </data>
<data name="toolStripButton4.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="toolStripButton4.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAASJSURBVFhHvZfbT2NVFMbxQV/M+Af4SjQxk+ibMUbNaEZj
YmLiwzyMvPgifwGoCQ8TQxwDmImJMcwwoEC5zIgFCqVQWjpTej1tOb339HpKW1raQqEUeP7ce1OYc7AX
KOhOfmn6ZWetL3vttbrbdn4NDw/fGBoauiks37tV0dydPF747P7azIObVLsKo6Oj7dUU9dfAwMCrW1tb
WQJOKbonkYs5zr5fhXQ63VVNVXv19/e3k01s8y4/ilIhjbLtJ5RKpZbgE1ma9IzNzc3paqraixpIpVIo
+pQ4FHWocH04LudxfHzcEo8caQwYBJI4BRq3qQH14+/e2gy7ULL9ggNhFhXxOY6OjlqGGvh0jMf91QDE
ZBKJRKKxgS3F+49Shp9RiBpR4n7F4eHhlXjIpZiBj0cc+FHjQTTawEDf3RtviMpvvo+F/dh2KVAp76FS
qcjYPzihTLiINmjfPDPw4SMrvn3CPSOpXjrJeG7du9P2ijj+ye+RSATb29s4ODiQ4c3u4wt1nvH1aqGu
Fsi90D6fDuH2YwtuPVzHB7+t4b0HK3i3TzVE0tU2MTv0w5uCICCXy6FcLsvYSJdwezbN+GoxU1dzZ15o
X6rScEdE2IMxuIQEvFERQiKFwZGRd6op5au3t7c9GAyyNtzb25ORKZagDOYZS+EC07YkmrqWJpxo5xkf
H69vwO/3I5PJsD7O5PKwuCOw8FfH5omgUNxhcRsa8Hg8rGd3d3ehtwcQS2aQTGdlLJu88IVFmWbmBYZU
k8IH43AF4ixuQwM8z9OBgZ2dHehspCO28ygWizL0RI+KaZnm9EcZBoMBGo2GsbS0xNDpdBDiKTh9MRa3
roGenp52l8sFURRZ0FWr79IG9Ho91Go1Y3FxkaHVapkBhy/K9o7Uu4TUAMdxiMfjKBQKzMC6KwTzBjle
CU+1DnY6Um3hOc+QalJWLT5wXnIPSNyGBqxWK2KxGPL5PLQWL7ykffyRpAzVsw2YnAEYbRsEF9bJJz0V
vd3/r72nWN1h2MlFpHEbGjCbzTgdRtRAvRIYLRytJcbGxhh2t8BKcH7vKbQEdk+YxW1qIBwOI5vNYsXs
qWvAG4yA3pdTaH2bGbARkzTuhQzQYbRi8mBG58Tf5/hDZcaTFU6mKdQ2hlSTMr1sh5UPsbhNDdBxTIfR
ssl96S6gp0HvEcVisTAcDgc7ActGiMVtaiAUCrEXzPL65Q3Mzc1hYmKCoVAoGDMzM1UDQRb3Egb4a21D
s6sFA55Qgo1dKfOGDXKhwjKNGqJINSkWOqpbMXDZEszPz2NqaooxOTnJUCqVrAT/iwF64Uwmkwy73d66
AaXeidk1l4w/SRs+1XIybWLJxpBqUmjbXusJBMJxBAIBBn3EOC8wiK7VQCujuKmBrq6udlqzixjwhaJw
u92g7wf6eZFR3NRAR0fHayqVat/r9bKNnEeA2shDQwaSlL9I/RfIL6JUm6V3hSDVpND9ASHG4g4ODtY2
QFd3d/frTqdzgW78L6CvLfIX8O1qutqL9PJHpBQCmePJ68ZoNC50dna+fJKpre0fl8QCq4d/Y6gAAAAA
SUVORK5CYII=
</value>
</data>
<data name="toolStripButton3.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
......
...@@ -115,6 +115,12 @@ ...@@ -115,6 +115,12 @@
<Compile Include="CSVGeneratorForItemCollectionForm.Designer.cs"> <Compile Include="CSVGeneratorForItemCollectionForm.Designer.cs">
<DependentUpon>CSVGeneratorForItemCollectionForm.cs</DependentUpon> <DependentUpon>CSVGeneratorForItemCollectionForm.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="GetListOfUsersWithUnlinkedPlacesForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GetListOfUsersWithUnlinkedPlacesForm.Designer.cs">
<DependentUpon>GetListOfUsersWithUnlinkedPlacesForm.cs</DependentUpon>
</Compile>
<Compile Include="ImageCropForm.cs"> <Compile Include="ImageCropForm.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
...@@ -209,6 +215,9 @@ ...@@ -209,6 +215,9 @@
<EmbeddedResource Include="CSVGeneratorForItemCollectionForm.resx"> <EmbeddedResource Include="CSVGeneratorForItemCollectionForm.resx">
<DependentUpon>CSVGeneratorForItemCollectionForm.cs</DependentUpon> <DependentUpon>CSVGeneratorForItemCollectionForm.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="GetListOfUsersWithUnlinkedPlacesForm.resx">
<DependentUpon>GetListOfUsersWithUnlinkedPlacesForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="ImageCropForm.resx"> <EmbeddedResource Include="ImageCropForm.resx">
<DependentUpon>ImageCropForm.cs</DependentUpon> <DependentUpon>ImageCropForm.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
......
...@@ -32,5 +32,5 @@ using System.Runtime.InteropServices; ...@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.28")] [assembly: AssemblyVersion("1.0.29")]
[assembly: AssemblyFileVersion("1.0.28")] [assembly: AssemblyFileVersion("1.0.29")]
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
This diff could not be displayed because it is too large.
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<AutoPublishSettings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <AutoPublishSettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<UploadUser>f-solu-06</UploadUser> <UploadUser>f-solu-06</UploadUser>
<PrivateKeyPath />
<UploadPath>/home/f-solu-06/software.f-solutions.fi</UploadPath> <UploadPath>/home/f-solu-06/software.f-solutions.fi</UploadPath>
<UploadHost>www4.f-solutions.fi</UploadHost> <UploadHost>www4.f-solutions.fi</UploadHost>
<ProjectName>MoyaAdminUI</ProjectName> <ProjectName>MoyaAdminUI</ProjectName>
......
namespace MoyaSignup
{
partial class AdvancedMessageBox
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(191, 186);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(35, 13);
this.label1.TabIndex = 1;
this.label1.Text = "label1";
this.label1.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// AdvancedMessageBox
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(469, 221);
this.ControlBox = false;
this.Controls.Add(this.label1);
this.Controls.Add(this.button1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Name = "AdvancedMessageBox";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "AdvancedMessageBox";
this.TopMost = true;
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label1;
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MoyaSignup
{
public partial class AdvancedMessageBox : Form
{
public AdvancedMessageBox(string text)
{
label1.Text = text;
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
...@@ -31,8 +31,6 @@ ...@@ -31,8 +31,6 @@
this.apiURLTextBox = new System.Windows.Forms.TextBox(); this.apiURLTextBox = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.SaveButton = new System.Windows.Forms.Button(); this.SaveButton = new System.Windows.Forms.Button();
this.ApiKeyTextBox = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.usernameTextBox = new System.Windows.Forms.TextBox(); this.usernameTextBox = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
...@@ -79,7 +77,7 @@ ...@@ -79,7 +77,7 @@
// SaveButton // SaveButton
// //
this.SaveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.SaveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.SaveButton.Location = new System.Drawing.Point(257, 655); this.SaveButton.Location = new System.Drawing.Point(257, 595);
this.SaveButton.Name = "SaveButton"; this.SaveButton.Name = "SaveButton";
this.SaveButton.Size = new System.Drawing.Size(75, 23); this.SaveButton.Size = new System.Drawing.Size(75, 23);
this.SaveButton.TabIndex = 2; this.SaveButton.TabIndex = 2;
...@@ -87,23 +85,6 @@ ...@@ -87,23 +85,6 @@
this.SaveButton.UseVisualStyleBackColor = true; this.SaveButton.UseVisualStyleBackColor = true;
this.SaveButton.Click += new System.EventHandler(this.SaveButton_Click); this.SaveButton.Click += new System.EventHandler(this.SaveButton_Click);
// //
// ApiKeyTextBox
//
this.ApiKeyTextBox.Location = new System.Drawing.Point(6, 157);
this.ApiKeyTextBox.Name = "ApiKeyTextBox";
this.ApiKeyTextBox.ReadOnly = true;
this.ApiKeyTextBox.Size = new System.Drawing.Size(260, 20);
this.ApiKeyTextBox.TabIndex = 3;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 141);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(79, 13);
this.label2.TabIndex = 4;
this.label2.Text = "Application key";
//
// label3 // label3
// //
this.label3.AutoSize = true; this.label3.AutoSize = true;
...@@ -160,7 +141,7 @@ ...@@ -160,7 +141,7 @@
// label6 // label6
// //
this.label6.AutoSize = true; this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(15, 449); this.label6.Location = new System.Drawing.Point(18, 380);
this.label6.Name = "label6"; this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(58, 13); this.label6.Size = new System.Drawing.Size(58, 13);
this.label6.TabIndex = 11; this.label6.TabIndex = 11;
...@@ -186,7 +167,7 @@ ...@@ -186,7 +167,7 @@
// //
// textBox1 // textBox1
// //
this.textBox1.Location = new System.Drawing.Point(15, 603); this.textBox1.Location = new System.Drawing.Point(18, 534);
this.textBox1.Multiline = true; this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1"; this.textBox1.Name = "textBox1";
this.textBox1.ReadOnly = true; this.textBox1.ReadOnly = true;
...@@ -199,7 +180,7 @@ ...@@ -199,7 +180,7 @@
// //
this.groupBox1.Controls.Add(this.groupBox3); this.groupBox1.Controls.Add(this.groupBox3);
this.groupBox1.Controls.Add(this.groupBox2); this.groupBox1.Controls.Add(this.groupBox2);
this.groupBox1.Location = new System.Drawing.Point(15, 232); this.groupBox1.Location = new System.Drawing.Point(16, 163);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(316, 214); this.groupBox1.Size = new System.Drawing.Size(316, 214);
this.groupBox1.TabIndex = 16; this.groupBox1.TabIndex = 16;
...@@ -290,20 +271,18 @@ ...@@ -290,20 +271,18 @@
this.groupBox4.Controls.Add(this.usernameTextBox); this.groupBox4.Controls.Add(this.usernameTextBox);
this.groupBox4.Controls.Add(this.pwTextBox); this.groupBox4.Controls.Add(this.pwTextBox);
this.groupBox4.Controls.Add(this.label4); this.groupBox4.Controls.Add(this.label4);
this.groupBox4.Controls.Add(this.label2);
this.groupBox4.Controls.Add(this.label1); this.groupBox4.Controls.Add(this.label1);
this.groupBox4.Controls.Add(this.ApiKeyTextBox);
this.groupBox4.Controls.Add(this.apiURLTextBox); this.groupBox4.Controls.Add(this.apiURLTextBox);
this.groupBox4.Location = new System.Drawing.Point(15, 12); this.groupBox4.Location = new System.Drawing.Point(15, 12);
this.groupBox4.Name = "groupBox4"; this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(282, 211); this.groupBox4.Size = new System.Drawing.Size(282, 145);
this.groupBox4.TabIndex = 18; this.groupBox4.TabIndex = 18;
this.groupBox4.TabStop = false; this.groupBox4.TabStop = false;
// //
// webcamsCheckedListBox // webcamsCheckedListBox
// //
this.webcamsCheckedListBox.FormattingEnabled = true; this.webcamsCheckedListBox.FormattingEnabled = true;
this.webcamsCheckedListBox.Location = new System.Drawing.Point(15, 466); this.webcamsCheckedListBox.Location = new System.Drawing.Point(18, 397);
this.webcamsCheckedListBox.Name = "webcamsCheckedListBox"; this.webcamsCheckedListBox.Name = "webcamsCheckedListBox";
this.webcamsCheckedListBox.Size = new System.Drawing.Size(316, 124); this.webcamsCheckedListBox.Size = new System.Drawing.Size(316, 124);
this.webcamsCheckedListBox.TabIndex = 19; this.webcamsCheckedListBox.TabIndex = 19;
...@@ -312,7 +291,7 @@ ...@@ -312,7 +291,7 @@
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(344, 690); this.ClientSize = new System.Drawing.Size(344, 630);
this.Controls.Add(this.webcamsCheckedListBox); this.Controls.Add(this.webcamsCheckedListBox);
this.Controls.Add(this.groupBox4); this.Controls.Add(this.groupBox4);
this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox1);
...@@ -339,8 +318,6 @@ ...@@ -339,8 +318,6 @@
private System.Windows.Forms.TextBox apiURLTextBox; private System.Windows.Forms.TextBox apiURLTextBox;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button SaveButton; private System.Windows.Forms.Button SaveButton;
private System.Windows.Forms.TextBox ApiKeyTextBox;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox usernameTextBox; private System.Windows.Forms.TextBox usernameTextBox;
private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label4;
......
...@@ -41,7 +41,7 @@ namespace MoyaSignup ...@@ -41,7 +41,7 @@ namespace MoyaSignup
{ {
try try
{ {
apiCredential = RestClient.GetApiCredential(usernameTextBox.Text, pwTextBox.Text, ApiKeyTextBox.Text, apiURLTextBox.Text); apiCredential = RestClient.GetApiCredential(usernameTextBox.Text, pwTextBox.Text, Properties.Settings.Default.ApiApplicationKey, apiURLTextBox.Text);
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -51,7 +51,6 @@ namespace MoyaSignup ...@@ -51,7 +51,6 @@ namespace MoyaSignup
if (apiCredential != null) if (apiCredential != null)
{ {
Properties.Settings.Default.ApiURL = apiURLTextBox.Text; Properties.Settings.Default.ApiURL = apiURLTextBox.Text;
Properties.Settings.Default.ApiApplicationKey = ApiKeyTextBox.Text;
Properties.Settings.Default.ApiUser = apiCredential.authname; Properties.Settings.Default.ApiUser = apiCredential.authname;
Properties.Settings.Default.ApiPass = apiCredential.secret; Properties.Settings.Default.ApiPass = apiCredential.secret;
Properties.Settings.Default.ApiTokenSet = true; Properties.Settings.Default.ApiTokenSet = true;
...@@ -117,7 +116,6 @@ namespace MoyaSignup ...@@ -117,7 +116,6 @@ namespace MoyaSignup
} }
apiURLTextBox.Text = Properties.Settings.Default.ApiURL; apiURLTextBox.Text = Properties.Settings.Default.ApiURL;
ApiKeyTextBox.Text = Properties.Settings.Default.ApiApplicationKey;
//usernameTextBox.Text = Properties.Settings.Default.ApiUser; //usernameTextBox.Text = Properties.Settings.Default.ApiUser;
//pwTextBox.Text = Properties.Settings.Default.ApiPass; //pwTextBox.Text = Properties.Settings.Default.ApiPass;
...@@ -202,13 +200,11 @@ namespace MoyaSignup ...@@ -202,13 +200,11 @@ namespace MoyaSignup
apiURLTextBox.ReadOnly = true; apiURLTextBox.ReadOnly = true;
usernameTextBox.ReadOnly = true; usernameTextBox.ReadOnly = true;
pwTextBox.ReadOnly = true; pwTextBox.ReadOnly = true;
ApiKeyTextBox.ReadOnly = true;
} else } else
{ {
apiURLTextBox.ReadOnly = false; apiURLTextBox.ReadOnly = false;
usernameTextBox.ReadOnly = false; usernameTextBox.ReadOnly = false;
pwTextBox.ReadOnly = false; pwTextBox.ReadOnly = false;
ApiKeyTextBox.ReadOnly = false;
} }
} }
......
...@@ -331,6 +331,7 @@ namespace MoyaSignup ...@@ -331,6 +331,7 @@ namespace MoyaSignup
{ {
userDetailsEditor1.SetUsersImage(image); userDetailsEditor1.SetUsersImage(image);
userDetailsEditor1.LatestFrame = image; userDetailsEditor1.LatestFrame = image;
userDetailsEditor1.ShowSaveButton();
} }
private void btnFinnish_Click_1(object sender, EventArgs e) private void btnFinnish_Click_1(object sender, EventArgs e)
......
...@@ -148,6 +148,12 @@ ...@@ -148,6 +148,12 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="AdvancedMessageBox.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="AdvancedMessageBox.Designer.cs">
<DependentUpon>AdvancedMessageBox.cs</DependentUpon>
</Compile>
<Compile Include="API32.cs" /> <Compile Include="API32.cs" />
<Compile Include="ApiSettings.cs"> <Compile Include="ApiSettings.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
...@@ -202,6 +208,9 @@ ...@@ -202,6 +208,9 @@
<Compile Include="WebCamViewForm.Designer.cs"> <Compile Include="WebCamViewForm.Designer.cs">
<DependentUpon>WebCamViewForm.cs</DependentUpon> <DependentUpon>WebCamViewForm.cs</DependentUpon>
</Compile> </Compile>
<EmbeddedResource Include="AdvancedMessageBox.resx">
<DependentUpon>AdvancedMessageBox.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="ApiSettings.resx"> <EmbeddedResource Include="ApiSettings.resx">
<DependentUpon>ApiSettings.cs</DependentUpon> <DependentUpon>ApiSettings.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
......
...@@ -32,5 +32,5 @@ using System.Runtime.InteropServices; ...@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.45.0")] [assembly: AssemblyVersion("1.0.56.0")]
[assembly: AssemblyFileVersion("1.0.45.0")] [assembly: AssemblyFileVersion("1.0.56.0")]
...@@ -25,7 +25,7 @@ namespace MoyaSignup.Properties { ...@@ -25,7 +25,7 @@ namespace MoyaSignup.Properties {
[global::System.Configuration.UserScopedSettingAttribute()] [global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("myapiclientid")] [global::System.Configuration.DefaultSettingValueAttribute("8krAyTEpzP6QnwzkxGek")]
public string ApiApplicationKey { public string ApiApplicationKey {
get { get {
return ((string)(this["ApiApplicationKey"])); return ((string)(this["ApiApplicationKey"]));
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<Profiles /> <Profiles />
<Settings> <Settings>
<Setting Name="ApiApplicationKey" Type="System.String" Scope="User"> <Setting Name="ApiApplicationKey" Type="System.String" Scope="User">
<Value Profile="(Default)">myapiclientid</Value> <Value Profile="(Default)">8krAyTEpzP6QnwzkxGek</Value>
</Setting> </Setting>
<Setting Name="ApiUser" Type="System.String" Scope="User"> <Setting Name="ApiUser" Type="System.String" Scope="User">
<Value Profile="(Default)">myapiuser</Value> <Value Profile="(Default)">myapiuser</Value>
......
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
// //
// selectCamTimer // selectCamTimer
// //
this.selectCamTimer.Interval = 10000; this.selectCamTimer.Interval = 5000;
this.selectCamTimer.Tick += new System.EventHandler(this.selectCamTimer_Tick); this.selectCamTimer.Tick += new System.EventHandler(this.selectCamTimer_Tick);
// //
// TakePictureForm // TakePictureForm
...@@ -103,8 +103,13 @@ ...@@ -103,8 +103,13 @@
this.Controls.Add(this.pictureTakenLabel); this.Controls.Add(this.pictureTakenLabel);
this.Controls.Add(this.btnTakePic); this.Controls.Add(this.btnTakePic);
this.Controls.Add(this.pictureBox); this.Controls.Add(this.pictureBox);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "TakePictureForm"; this.Name = "TakePictureForm";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Ota kuva"; this.Text = "Ota kuva";
this.TopMost = true;
this.Load += new System.EventHandler(this.TakePictureForm_Load); this.Load += new System.EventHandler(this.TakePictureForm_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
......
...@@ -25,6 +25,8 @@ namespace MoyaSignup ...@@ -25,6 +25,8 @@ namespace MoyaSignup
int DefaultCropWidth = 263; int DefaultCropWidth = 263;
int DefaultCropHeight = 360; int DefaultCropHeight = 360;
int camHeight = 720;
//bool freeze; //bool freeze;
// bool pictureTaken = false; // bool pictureTaken = false;
//bool cameraOpen = false; //bool cameraOpen = false;
...@@ -40,6 +42,8 @@ namespace MoyaSignup ...@@ -40,6 +42,8 @@ namespace MoyaSignup
HaarCascade face; HaarCascade face;
Image<Gray, byte> gray = null; Image<Gray, byte> gray = null;
Rectangle cropRectangle = new Rectangle();
List<Capture> webCams; List<Capture> webCams;
...@@ -58,6 +62,10 @@ namespace MoyaSignup ...@@ -58,6 +62,10 @@ namespace MoyaSignup
private void TakePictureForm_Load(object sender, EventArgs e) private void TakePictureForm_Load(object sender, EventArgs e)
{ {
startCapturing(); startCapturing();
cropRectangle.X = 189;
cropRectangle.Y = 0;
cropRectangle.Width = DefaultCropWidth;
cropRectangle.Height = DefaultCropHeight;
} }
private void startCapturing() private void startCapturing()
...@@ -173,6 +181,7 @@ namespace MoyaSignup ...@@ -173,6 +181,7 @@ namespace MoyaSignup
{ {
//Debug.WriteLine("[takepictureform] Trying to find a face in the frames from the webcams"); //Debug.WriteLine("[takepictureform] Trying to find a face in the frames from the webcams");
Dictionary<Image<Bgr, byte>, decimal> croppedImages = new Dictionary<Image<Bgr, byte>, decimal>(); Dictionary<Image<Bgr, byte>, decimal> croppedImages = new Dictionary<Image<Bgr, byte>, decimal>();
Dictionary<Image<Bgr, byte>, Rectangle> cropRectangles = new Dictionary<Image<Bgr, byte>, Rectangle>();
List<Image<Bgr, byte>> fullFrames = new List<Image<Bgr, byte>>(); List<Image<Bgr, byte>> fullFrames = new List<Image<Bgr, byte>>();
lock(camScores) lock(camScores)
...@@ -185,9 +194,15 @@ namespace MoyaSignup ...@@ -185,9 +194,15 @@ namespace MoyaSignup
decimal score = 0; decimal score = 0;
Capture grabber = webCams[i]; Capture grabber = webCams[i];
currentFullFrame = grabber.QueryFrame(); try
currentFrame = currentFullFrame.Resize(640, 360, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC); //640x360 {
currentFullFrame = grabber.QueryFrame();
currentFrame = currentFullFrame.Resize(640, 360, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC); //640x360
}catch(Exception ex)
{
Debug.WriteLine("[takepictureform] Could not get frame from camera. Ex: " + ex.Message);
return;
}
gray = currentFrame.Convert<Gray, Byte>(); gray = currentFrame.Convert<Gray, Byte>();
MCvAvgComp[][] facesDetected = null; MCvAvgComp[][] facesDetected = null;
...@@ -197,17 +212,18 @@ namespace MoyaSignup ...@@ -197,17 +212,18 @@ namespace MoyaSignup
//Face Detector //Face Detector
facesDetected = gray.DetectHaarCascade( facesDetected = gray.DetectHaarCascade(
face, face,
1.2, 1.1,
10, 10,
Emgu.CV.CvEnum.HAAR_DETECTION_TYPE.DO_CANNY_PRUNING, Emgu.CV.CvEnum.HAAR_DETECTION_TYPE.DO_CANNY_PRUNING,
new Size(100, 100)); new Size(50, 50));
} }
//Action for each element detected //Action for each element detected
if (facesDetected != null && facesDetected[0].Length > 0) if (facesDetected != null && facesDetected[0].Length > 0)
{ {
MCvAvgComp f = facesDetected[0][0]; MCvAvgComp f = facesDetected[0][0];
decimal width = ((decimal)f.rect.Width) * 3.1M; //decimal width = ((decimal)f.rect.Width) * 3.1M;
decimal width = ((decimal)f.rect.Width) * 2.8M;
decimal height = width * 1.36774193548M; decimal height = width * 1.36774193548M;
int x = (f.rect.X + f.rect.Width / 2) * 2; int x = (f.rect.X + f.rect.Width / 2) * 2;
...@@ -227,29 +243,37 @@ namespace MoyaSignup ...@@ -227,29 +243,37 @@ namespace MoyaSignup
score += distance; score += distance;
if (x + width <= 1280 && y + height <= 720 && x >= 0 && y >= 0) // allow offset
if (y < 0 && y > -50)
y = 0;
if (y + height > camHeight && y + height < camHeight + 150)
y = camHeight - (int)height - 1;
if (x + width <= 1280 && y + height <= camHeight && x >= 0 && y >= 0)
{ {
Rectangle cropRectangle = new Rectangle(x, y, (int)width, (int)height); Rectangle cropRect = new Rectangle(x, y, (int)width, (int)height);
Image<Bgr, byte> croppedImage = currentFullFrame.Copy(cropRectangle); Image<Bgr, byte> croppedImage = currentFullFrame.Copy(cropRect);
croppedImage = croppedImage.Resize(310, 424, INTER.CV_INTER_CUBIC); croppedImage = croppedImage.Resize(310, 424, INTER.CV_INTER_CUBIC);
Debug.WriteLine("[takepictureform] Adding score '" + score + "' to croppedImageDictionary."); //Debug.WriteLine("[takepictureform] Adding score '" + score + "' to croppedImageDictionary.");
croppedImages.Add(croppedImage, score); croppedImages.Add(croppedImage, score);
cropRectangles.Add(croppedImage, cropRect);
lock (camScores) lock (camScores)
{ {
camScores.Add(score, webCams[i]); camScores.Add(score, webCams[i]);
} }
currentFullFrame.Draw(cropRectangle, new Bgr(Color.Red), 2); currentFullFrame.Draw(cropRect, new Bgr(Color.Green), 2);
fullFrames.Add(currentFullFrame.Resize(640, 360, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC)); fullFrames.Add(currentFullFrame.Resize(640, 360, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC));
} }
} }
} }
decimal bestScore = 1000; decimal bestScore = 300;
Image<Bgr, byte> bestImage = null; Image<Bgr, byte> bestImage = null;
int bestImageIdx = 0; int bestImageIdx = 0;
int j = 0; int j = 0;
...@@ -294,7 +318,12 @@ namespace MoyaSignup ...@@ -294,7 +318,12 @@ namespace MoyaSignup
selectedCam = camScores[score]; selectedCam = camScores[score];
} }
} }
Rectangle rect = cropRectangles[bestImage];
int x = (int) rect.X / 2;
int y = (int)rect.Y / 2;
int width = (int)rect.Width / 2;
int height = (int)rect.Height / 2;
cropRectangle = new Rectangle( x, y, width, height);
latestFrame = BitmapFilter.Crop(bestImage.Bitmap, RetangleWidth, RetangleHeight, ImageFilters.BitmapFilter.AnchorPosition.Free); latestFrame = BitmapFilter.Crop(bestImage.Bitmap, RetangleWidth, RetangleHeight, ImageFilters.BitmapFilter.AnchorPosition.Free);
if (fullFrames.Count > bestImageIdx) if (fullFrames.Count > bestImageIdx)
pictureBox.Image = fullFrames[bestImageIdx].Bitmap; pictureBox.Image = fullFrames[bestImageIdx].Bitmap;
...@@ -308,10 +337,11 @@ namespace MoyaSignup ...@@ -308,10 +337,11 @@ namespace MoyaSignup
fullFrame = selectedCam.QueryFrame().Resize(640, 360, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC); fullFrame = selectedCam.QueryFrame().Resize(640, 360, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC);
else else
fullFrame = webCams[0].QueryFrame().Resize(640, 360, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC); fullFrame = webCams[0].QueryFrame().Resize(640, 360, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC);
latestFrame = BitmapFilter.Crop(fullFrame.Bitmap, DefaultCropWidth, DefaultCropHeight, ImageFilters.BitmapFilter.AnchorPosition.Free); latestFrame = BitmapFilter.Crop(fullFrame.Bitmap, cropRectangle.Width, cropRectangle.Height, ImageFilters.BitmapFilter.AnchorPosition.Free);
int x = (640 - DefaultCropWidth) / 2; //int x = (640 - DefaultCropWidth) / 2;
int y = (360 - DefaultCropHeight) / 2; //int y = (360 - DefaultCropHeight) / 2;
Rectangle cropRectangle = new Rectangle(x, y, DefaultCropWidth, DefaultCropHeight);
//cropRectangle = new Rectangle(x, y, DefaultCropWidth, DefaultCropHeight);
fullFrame.Draw(cropRectangle, new Bgr(Color.Red), 2); fullFrame.Draw(cropRectangle, new Bgr(Color.Red), 2);
//pbIncoming.Image = latestFrame; //pbIncoming.Image = latestFrame;
......
...@@ -126,4 +126,7 @@ ...@@ -126,4 +126,7 @@
<metadata name="selectCamTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="selectCamTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>284, 17</value> <value>284, 17</value>
</metadata> </metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root> </root>
\ No newline at end of file
...@@ -360,7 +360,7 @@ ...@@ -360,7 +360,7 @@
this.btnStartCapture.Name = "btnStartCapture"; this.btnStartCapture.Name = "btnStartCapture";
this.btnStartCapture.Size = new System.Drawing.Size(271, 30); this.btnStartCapture.Size = new System.Drawing.Size(271, 30);
this.btnStartCapture.TabIndex = 26; this.btnStartCapture.TabIndex = 26;
this.btnStartCapture.Text = "Aloita kuvanotto"; this.btnStartCapture.Text = "Ota uusi kuva";
this.btnStartCapture.UseVisualStyleBackColor = true; this.btnStartCapture.UseVisualStyleBackColor = true;
this.btnStartCapture.Click += new System.EventHandler(this.btnStartCapture_Click); this.btnStartCapture.Click += new System.EventHandler(this.btnStartCapture_Click);
// //
...@@ -395,7 +395,7 @@ ...@@ -395,7 +395,7 @@
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.Controls.Add(this.txtFirstName); this.Controls.Add(this.txtFirstName);
this.Name = "UserDetailsEditor"; this.Name = "UserDetailsEditor";
this.Size = new System.Drawing.Size(875, 524); this.Size = new System.Drawing.Size(875, 491);
this.Load += new System.EventHandler(this.UserDetailsEditor_Load); this.Load += new System.EventHandler(this.UserDetailsEditor_Load);
this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.UserDetailsEditor_KeyUp); this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.UserDetailsEditor_KeyUp);
((System.ComponentModel.ISupportInitialize)(this.usersPictureBox)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.usersPictureBox)).EndInit();
......
...@@ -124,6 +124,7 @@ namespace MoyaSignup ...@@ -124,6 +124,7 @@ namespace MoyaSignup
txtZip.ReadOnly = false; txtZip.ReadOnly = false;
txtCity.ReadOnly = false; txtCity.ReadOnly = false;
txtPhone.ReadOnly = false; txtPhone.ReadOnly = false;
this.usersPictureBox.Image = null;
if (txtEmail.Text.Length > 0) if (txtEmail.Text.Length > 0)
{ {
...@@ -172,6 +173,7 @@ namespace MoyaSignup ...@@ -172,6 +173,7 @@ namespace MoyaSignup
txtZip.Text = ""; txtZip.Text = "";
txtAge.Text = ""; txtAge.Text = "";
//this.takePictureControl1.Clear(); //this.takePictureControl1.Clear();
this.usersPictureBox.Image = null;
currentUser = null; currentUser = null;
latestFrame = null; latestFrame = null;
PictureTaken = false; PictureTaken = false;
...@@ -327,6 +329,8 @@ namespace MoyaSignup ...@@ -327,6 +329,8 @@ namespace MoyaSignup
userId = euser.eventuserId; userId = euser.eventuserId;
currentUser = new User(euser); currentUser = new User(euser);
//takePictureControl1.SaveUserImage(currentUser); //takePictureControl1.SaveUserImage(currentUser);
if(PictureTaken)
SaveUserImage(currentUser);
name = euser.firstname + " " + euser.lastname; name = euser.firstname + " " + euser.lastname;
} }
else else
...@@ -690,7 +694,10 @@ namespace MoyaSignup ...@@ -690,7 +694,10 @@ namespace MoyaSignup
frm.StartPosition = FormStartPosition.CenterScreen; frm.StartPosition = FormStartPosition.CenterScreen;
frm.ShowDialog(); frm.ShowDialog();
} }
public void ShowSaveButton()
{
btnSaveData.Visible = true;
}
public void SetUsersImage(Bitmap image) public void SetUsersImage(Bitmap image)
{ {
usersPictureBox.Image = image; usersPictureBox.Image = image;
......
...@@ -93,9 +93,10 @@ ...@@ -93,9 +93,10 @@
// //
// loginButton // loginButton
// //
this.loginButton.Location = new System.Drawing.Point(148, 86); this.loginButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.loginButton.Location = new System.Drawing.Point(195, 86);
this.loginButton.Name = "loginButton"; this.loginButton.Name = "loginButton";
this.loginButton.Size = new System.Drawing.Size(118, 26); this.loginButton.Size = new System.Drawing.Size(212, 26);
this.loginButton.TabIndex = 94; this.loginButton.TabIndex = 94;
this.loginButton.Text = "Kirjaudu tapahtumaan"; this.loginButton.Text = "Kirjaudu tapahtumaan";
this.loginButton.UseVisualStyleBackColor = true; this.loginButton.UseVisualStyleBackColor = true;
...@@ -104,9 +105,10 @@ ...@@ -104,9 +105,10 @@
// //
// forgottenPasswordButton // forgottenPasswordButton
// //
this.forgottenPasswordButton.Location = new System.Drawing.Point(272, 86); this.forgottenPasswordButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.forgottenPasswordButton.Location = new System.Drawing.Point(413, 86);
this.forgottenPasswordButton.Name = "forgottenPasswordButton"; this.forgottenPasswordButton.Name = "forgottenPasswordButton";
this.forgottenPasswordButton.Size = new System.Drawing.Size(139, 26); this.forgottenPasswordButton.Size = new System.Drawing.Size(214, 26);
this.forgottenPasswordButton.TabIndex = 95; this.forgottenPasswordButton.TabIndex = 95;
this.forgottenPasswordButton.Text = "En muista salasanaani"; this.forgottenPasswordButton.Text = "En muista salasanaani";
this.forgottenPasswordButton.UseVisualStyleBackColor = true; this.forgottenPasswordButton.UseVisualStyleBackColor = true;
...@@ -114,9 +116,10 @@ ...@@ -114,9 +116,10 @@
// //
// btnNewProfile // btnNewProfile
// //
this.btnNewProfile.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnNewProfile.Location = new System.Drawing.Point(16, 86); this.btnNewProfile.Location = new System.Drawing.Point(16, 86);
this.btnNewProfile.Name = "btnNewProfile"; this.btnNewProfile.Name = "btnNewProfile";
this.btnNewProfile.Size = new System.Drawing.Size(126, 26); this.btnNewProfile.Size = new System.Drawing.Size(173, 26);
this.btnNewProfile.TabIndex = 96; this.btnNewProfile.TabIndex = 96;
this.btnNewProfile.Text = "Lisää omat tiedot"; this.btnNewProfile.Text = "Lisää omat tiedot";
this.btnNewProfile.UseVisualStyleBackColor = true; this.btnNewProfile.UseVisualStyleBackColor = true;
...@@ -135,7 +138,7 @@ ...@@ -135,7 +138,7 @@
this.Controls.Add(this.label4); this.Controls.Add(this.label4);
this.Controls.Add(this.txtEmail); this.Controls.Add(this.txtEmail);
this.Name = "UserLoginControl"; this.Name = "UserLoginControl";
this.Size = new System.Drawing.Size(420, 126); this.Size = new System.Drawing.Size(632, 126);
this.Load += new System.EventHandler(this.UserLoginControl_Load); this.Load += new System.EventHandler(this.UserLoginControl_Load);
this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.UserLoginControl_KeyUp); this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.UserLoginControl_KeyUp);
this.ResumeLayout(false); this.ResumeLayout(false);
......
...@@ -60,6 +60,7 @@ namespace MoyaSignup ...@@ -60,6 +60,7 @@ namespace MoyaSignup
timer1.Stop(); timer1.Stop();
CurrentUser = null; CurrentUser = null;
btnNewProfile.Visible = false; btnNewProfile.Visible = false;
showLogin(false);
infoLabel.Text = "Hei! Kirjoita sähköpostiosoitteesi"; infoLabel.Text = "Hei! Kirjoita sähköpostiosoitteesi";
} }
} }
...@@ -109,6 +110,10 @@ namespace MoyaSignup ...@@ -109,6 +110,10 @@ namespace MoyaSignup
CurrentUser = new User(euser); CurrentUser = new User(euser);
infoLabel.Text = "Hei! " + CurrentUser.ToString() + " Kirjoita salasanasi ja kirjaudu"; infoLabel.Text = "Hei! " + CurrentUser.ToString() + " Kirjoita salasanasi ja kirjaudu";
showLogin(true); showLogin(true);
} else
{
showLogin(false);
ClearText();
} }
} }
catch (Exception ex) catch (Exception ex)
...@@ -194,9 +199,13 @@ namespace MoyaSignup ...@@ -194,9 +199,13 @@ namespace MoyaSignup
passwordTextBox.Text = ""; passwordTextBox.Text = "";
SetStyle(ControlStyles.SupportsTransparentBackColor, true); SetStyle(ControlStyles.SupportsTransparentBackColor, true);
this.BackColor = Color.Transparent; this.BackColor = Color.Transparent;
ClearText();
Debug.WriteLine("[userlogincontrol] Cleared login info");
}
internal void ClearText()
{
infoLabel.Text = "Hei! Kirjoita sähköpostiosoitteesi"; infoLabel.Text = "Hei! Kirjoita sähköpostiosoitteesi";
loginButton.Visible = false; loginButton.Visible = false;
Debug.WriteLine("[userlogincontrol] Cleared login info");
} }
private void UserLoginControl_KeyUp(object sender, KeyEventArgs e) private void UserLoginControl_KeyUp(object sender, KeyEventArgs e)
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0); this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.flowLayoutPanel1.Name = "flowLayoutPanel1"; this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(640, 480); this.flowLayoutPanel1.Size = new System.Drawing.Size(640, 869);
this.flowLayoutPanel1.TabIndex = 0; this.flowLayoutPanel1.TabIndex = 0;
// //
// timer1 // timer1
...@@ -53,14 +53,14 @@ ...@@ -53,14 +53,14 @@
this.flowLayoutPanel2.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; this.flowLayoutPanel2.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowLayoutPanel2.Location = new System.Drawing.Point(640, 0); this.flowLayoutPanel2.Location = new System.Drawing.Point(640, 0);
this.flowLayoutPanel2.Name = "flowLayoutPanel2"; this.flowLayoutPanel2.Name = "flowLayoutPanel2";
this.flowLayoutPanel2.Size = new System.Drawing.Size(424, 480); this.flowLayoutPanel2.Size = new System.Drawing.Size(424, 869);
this.flowLayoutPanel2.TabIndex = 1; this.flowLayoutPanel2.TabIndex = 1;
// //
// WebCamViewForm // WebCamViewForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1064, 480); this.ClientSize = new System.Drawing.Size(1064, 869);
this.Controls.Add(this.flowLayoutPanel2); this.Controls.Add(this.flowLayoutPanel2);
this.Controls.Add(this.flowLayoutPanel1); this.Controls.Add(this.flowLayoutPanel1);
this.Name = "WebCamViewForm"; this.Name = "WebCamViewForm";
......
...@@ -21,6 +21,8 @@ namespace MoyaSignup ...@@ -21,6 +21,8 @@ namespace MoyaSignup
int RetangleHeight = 410; int RetangleHeight = 410;
int RetangleWidth = 280; int RetangleWidth = 280;
int camHeight = 720;
List<Capture> webCams; List<Capture> webCams;
Dictionary<Capture, Image<Bgr, byte>> currentFrames = new Dictionary<Emgu.CV.Capture, Image<Bgr, byte>>(); Dictionary<Capture, Image<Bgr, byte>> currentFrames = new Dictionary<Emgu.CV.Capture, Image<Bgr, byte>>();
...@@ -94,7 +96,7 @@ namespace MoyaSignup ...@@ -94,7 +96,7 @@ namespace MoyaSignup
currentFrame = currentFullFrame.Resize(640, 360, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC); //640x360 currentFrame = currentFullFrame.Resize(640, 360, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC); //640x360
ImageBox box = (ImageBox)flowLayoutPanel1.Controls[i]; ImageBox box = (ImageBox)flowLayoutPanel1.Controls[i];
box.Image = currentFrame;
//Dictionary<Image<Bgr, byte>, decimal> croppedImages = new Dictionary<Image<Bgr, byte>, decimal>(); //Dictionary<Image<Bgr, byte>, decimal> croppedImages = new Dictionary<Image<Bgr, byte>, decimal>();
...@@ -109,45 +111,80 @@ namespace MoyaSignup ...@@ -109,45 +111,80 @@ namespace MoyaSignup
//Face Detector //Face Detector
facesDetected = gray.DetectHaarCascade( facesDetected = gray.DetectHaarCascade(
face, face,
1.2, 1.1,
10, 10,
Emgu.CV.CvEnum.HAAR_DETECTION_TYPE.DO_CANNY_PRUNING, Emgu.CV.CvEnum.HAAR_DETECTION_TYPE.DO_CANNY_PRUNING,
new Size(100, 100)); new Size(50, 50));
} }
//Action for each element detected //Action for each element detected
if (facesDetected != null && facesDetected[0].Length > 0) if (facesDetected != null && facesDetected[0].Length > 0)
{ {
MCvAvgComp f = facesDetected[0][0]; MCvAvgComp f = facesDetected[0][0];
decimal width = ((decimal)f.rect.Width) * 2.9M; //decimal width = ((decimal)f.rect.Width) * 2.9M;
//decimal height = width * 1.464285M;
decimal width = ((decimal)f.rect.Width) * 2.8M;
decimal height = width * 1.464285M; decimal height = width * 1.464285M;
int x = (f.rect.X + f.rect.Width / 2) * 2; int x = (f.rect.X + f.rect.Width / 2) * 2;
x = (int)(x - width / 2); x = (int)(x - width / 2);
int y = (f.rect.Y + f.rect.Height / 2) * 2; int y = (f.rect.Y + f.rect.Height / 2) * 2;
y = (int)(y - height / 2); y = (int)(y - height / 2);
int x1 = (int)(x + width / 2); int x1 = (int)(x + width / 2);
if (x1 >= 1280) if (x1 >= 1280)
x1 = 1279; x1 = 1279;
int y1 = (int)(y + height / 2); int y1 = (int)(y + height / 2);
if (y1 >= 720) if (y1 >= camHeight)
y1 = 719; y1 = 719;
decimal distance = (decimal)Math.Sqrt(Math.Pow((double)(x1 - 640), 2) + Math.Pow((double)(y1 - 360), 2)); decimal distance = (decimal)Math.Sqrt(Math.Pow((double)(x1 - 640), 2) + Math.Pow((double)(y1 - 360), 2));
score += distance; score += distance;
if (x + width <= 1280 && y + height <= 720 && x >= 0 && y >= 0) /*
Rectangle cropRectangle2 = new Rectangle(x, y, (int)width, (int)height);
currentFullFrame.Draw(cropRectangle, new Bgr(Color.Red), 2);
currentFrame = currentFullFrame.Resize(640, 360, INTER.CV_INTER_CUBIC);
Image<Bgr, byte> croppedImage = currentFullFrame.Copy(cropRectangle);
croppedImage = croppedImage.Resize(280, 410, INTER.CV_INTER_CUBIC);
*/
currentFullFrame.Draw(new Rectangle(x, y, (int)width, (int)height), new Bgr(Color.Blue), 2);
// allow offset
if (y < 0 && y > -50)
y = 0;
if (y + height > camHeight && y + height < camHeight + 150)
y = camHeight - (int)height -1 ;
if (x + width <= 1280 && y + height <= camHeight && x >= 0 && y >= 0)
{ {
Debug.WriteLine("[webcamviewform] Found a face in frame"); Debug.WriteLine("[webcamviewform] Found a face in frame");
Rectangle cropRectangle = new Rectangle(x, y, (int)width, (int)height); Rectangle cropRectangle = new Rectangle(x, y, (int)width, (int)height);
currentFullFrame.Draw(cropRectangle, new Bgr(Color.Red), 2); currentFullFrame.Draw(cropRectangle, new Bgr(Color.Red), 2);
currentFrame = currentFullFrame.Resize(640, 360, INTER.CV_INTER_CUBIC);
Image<Bgr, byte> croppedImage = currentFullFrame.Copy(cropRectangle); Image<Bgr, byte> croppedImage = currentFullFrame.Copy(cropRectangle);
croppedImage = croppedImage.Resize(280, 410, INTER.CV_INTER_CUBIC); croppedImage = croppedImage.Resize(280, 410, INTER.CV_INTER_CUBIC);
//Bitmap latestFrame = BitmapFilter.Crop(croppedImage.Bitmap, RetangleWidth, RetangleHeight, ImageFilters.BitmapFilter.AnchorPosition.Free); //Bitmap latestFrame = BitmapFilter.Crop(croppedImage.Bitmap, RetangleWidth, RetangleHeight, ImageFilters.BitmapFilter.AnchorPosition.Free);
if(flowLayoutPanel2.Controls != null && flowLayoutPanel2.Controls.Count > i && flowLayoutPanel2.Controls[i] is CroppedImageControl) if(flowLayoutPanel2.Controls != null && flowLayoutPanel2.Controls.Count > i && flowLayoutPanel2.Controls[i] is CroppedImageControl)
{ {
...@@ -157,8 +194,13 @@ namespace MoyaSignup ...@@ -157,8 +194,13 @@ namespace MoyaSignup
} }
} }
//draw face box to image
currentFrame.Draw(f.rect, new Bgr(Color.Green), 2);
} }
box.Image = currentFrame;
} }
} }
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<userSettings> <userSettings>
<MoyaSignup.Properties.Settings> <MoyaSignup.Properties.Settings>
<setting name="ApiApplicationKey" serializeAs="String"> <setting name="ApiApplicationKey" serializeAs="String">
<value>myapiclientid</value> <value>8krAyTEpzP6QnwzkxGek</value>
</setting> </setting>
<setting name="ApiUser" serializeAs="String"> <setting name="ApiUser" serializeAs="String">
<value>myapiuser</value> <value>myapiuser</value>
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
Name "MoyaSignup moya v1_00_45" Name "MoyaSignup moya v1_00_56"
; DO NOT CHANGE OutFile "installer_temp.exe" !!! AutoPublish requires this. ; DO NOT CHANGE OutFile "installer_temp.exe" !!! AutoPublish requires this.
...@@ -198,7 +198,7 @@ FunctionEnd ...@@ -198,7 +198,7 @@ FunctionEnd
Section "!MoyaSignup moya stable v1_00_45" SecMain Section "!MoyaSignup moya stable v1_00_56" SecMain
SetShellVarContext current SetShellVarContext current
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<AutoPublishSettings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <AutoPublishSettings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<UploadUser>f-solu-06</UploadUser> <UploadUser>f-solu-06</UploadUser>
<UploadPath>/home/f-solu-06/software.f-solutions.fi</UploadPath> <UploadPath>/home/f-solu-06/software.f-solutions.fi</UploadPath>
<UploadHost>software.f-solutions.fi</UploadHost> <UploadHost>www4.f-solutions.fi</UploadHost>
<ProjectName>MoyaPrintServer</ProjectName> <ProjectName>MoyaPrintServer</ProjectName>
<Customers> <Customers>
<Customer> <Customer>
......
...@@ -107,7 +107,7 @@ Section "!<$PROJECTNAME$> <$CUSTOMER$> <$VERSIONGROUP$> v<$VERSION$>" SecMain ...@@ -107,7 +107,7 @@ Section "!<$PROJECTNAME$> <$CUSTOMER$> <$VERSIONGROUP$> v<$VERSION$>" SecMain
SetOverwrite On SetOverwrite On
File /oname=autoupdate.xml "<$BINARYDIR$>\autoupdate.<$CUSTOMER$>.xml" File /oname=autoupdate.xml "<$BINARYDIR$>\autoupdate.<$CUSTOMER$>.xml"
File /oname=<$BINARYNAMEORIG$> "<$BINARYDIR$>\<$BINARYNAMEOBF$>" File /oname=<$BINARYNAMEORIG$> "<$BINARYDIR$>\<$BINARYNAMEOBF$>"
File autoupdate.crt ; File autoupdate.crt
; this line will be replicated for every non-default existing assembly ; this line will be replicated for every non-default existing assembly
; that is referenced to the main project. ; that is referenced to the main project.
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MoyaAdminLib
{
public class ApiCredential
{
public string authname;
public DateTime created;
public bool enabled;
public string secret;
}
}
...@@ -28,124 +28,132 @@ ...@@ -28,124 +28,132 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.label4 = new System.Windows.Forms.Label();
this.ApiPassTextBox = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.ApiUserTextBox = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.ApiKeyTextBox = new System.Windows.Forms.TextBox();
this.SaveButton = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.apiURLTextBox = new System.Windows.Forms.TextBox(); this.apiURLTextBox = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.SaveButton = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.usernameTextBox = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.pwTextBox = new System.Windows.Forms.TextBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.resetApiTokenCheckBox = new System.Windows.Forms.CheckBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// label4 // apiURLTextBox
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(12, 148);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(48, 13);
this.label4.TabIndex = 35;
this.label4.Text = "Api Pass";
//
// ApiPassTextBox
//
this.ApiPassTextBox.Location = new System.Drawing.Point(12, 164);
this.ApiPassTextBox.Name = "ApiPassTextBox";
this.ApiPassTextBox.PasswordChar = 'ῷ';
this.ApiPassTextBox.Size = new System.Drawing.Size(260, 20);
this.ApiPassTextBox.TabIndex = 34;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(12, 109);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(47, 13);
this.label3.TabIndex = 33;
this.label3.Text = "Api User";
//
// ApiUserTextBox
//
this.ApiUserTextBox.Location = new System.Drawing.Point(12, 125);
this.ApiUserTextBox.Name = "ApiUserTextBox";
this.ApiUserTextBox.Size = new System.Drawing.Size(260, 20);
this.ApiUserTextBox.TabIndex = 32;
//
// label2
// //
this.label2.AutoSize = true; this.apiURLTextBox.Location = new System.Drawing.Point(6, 113);
this.label2.Location = new System.Drawing.Point(12, 70); this.apiURLTextBox.Name = "apiURLTextBox";
this.label2.Name = "label2"; this.apiURLTextBox.ReadOnly = true;
this.label2.Size = new System.Drawing.Size(79, 13); this.apiURLTextBox.Size = new System.Drawing.Size(260, 20);
this.label2.TabIndex = 31; this.apiURLTextBox.TabIndex = 0;
this.label2.Text = "Application key";
// //
// ApiKeyTextBox // label1
// //
this.ApiKeyTextBox.Location = new System.Drawing.Point(12, 86); this.label1.AutoSize = true;
this.ApiKeyTextBox.Name = "ApiKeyTextBox"; this.label1.Location = new System.Drawing.Point(6, 97);
this.ApiKeyTextBox.Size = new System.Drawing.Size(260, 20); this.label1.Name = "label1";
this.ApiKeyTextBox.TabIndex = 30; this.label1.Size = new System.Drawing.Size(47, 13);
this.label1.TabIndex = 1;
this.label1.Text = "Moya url";
// //
// SaveButton // SaveButton
// //
this.SaveButton.Location = new System.Drawing.Point(197, 210); this.SaveButton.Location = new System.Drawing.Point(226, 163);
this.SaveButton.Name = "SaveButton"; this.SaveButton.Name = "SaveButton";
this.SaveButton.Size = new System.Drawing.Size(75, 23); this.SaveButton.Size = new System.Drawing.Size(75, 23);
this.SaveButton.TabIndex = 29; this.SaveButton.TabIndex = 2;
this.SaveButton.Text = "Save"; this.SaveButton.Text = "Save";
this.SaveButton.UseVisualStyleBackColor = true; this.SaveButton.UseVisualStyleBackColor = true;
this.SaveButton.Click += new System.EventHandler(this.SaveButton_Click); this.SaveButton.Click += new System.EventHandler(this.SaveButton_Click);
// //
// label1 // label3
// //
this.label1.AutoSize = true; this.label3.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 27); this.label3.Location = new System.Drawing.Point(6, 19);
this.label1.Name = "label1"; this.label3.Name = "label3";
this.label1.Size = new System.Drawing.Size(47, 13); this.label3.Size = new System.Drawing.Size(55, 13);
this.label1.TabIndex = 28; this.label3.TabIndex = 6;
this.label1.Text = "Moya url"; this.label3.Text = "Username";
// //
// apiURLTextBox // usernameTextBox
// //
this.apiURLTextBox.Location = new System.Drawing.Point(12, 43); this.usernameTextBox.Location = new System.Drawing.Point(6, 35);
this.apiURLTextBox.Name = "apiURLTextBox"; this.usernameTextBox.Name = "usernameTextBox";
this.apiURLTextBox.Size = new System.Drawing.Size(260, 20); this.usernameTextBox.ReadOnly = true;
this.apiURLTextBox.TabIndex = 27; this.usernameTextBox.Size = new System.Drawing.Size(260, 20);
this.usernameTextBox.TabIndex = 5;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(6, 58);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(53, 13);
this.label4.TabIndex = 8;
this.label4.Text = "Password";
//
// pwTextBox
//
this.pwTextBox.Location = new System.Drawing.Point(6, 74);
this.pwTextBox.Name = "pwTextBox";
this.pwTextBox.PasswordChar = 'ῷ';
this.pwTextBox.ReadOnly = true;
this.pwTextBox.Size = new System.Drawing.Size(260, 20);
this.pwTextBox.TabIndex = 7;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.pwTextBox);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.usernameTextBox);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.apiURLTextBox);
this.groupBox1.Controls.Add(this.resetApiTokenCheckBox);
this.groupBox1.Location = new System.Drawing.Point(13, 13);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(288, 144);
this.groupBox1.TabIndex = 9;
this.groupBox1.TabStop = false;
//
// resetApiTokenCheckBox
//
this.resetApiTokenCheckBox.AutoSize = true;
this.resetApiTokenCheckBox.Location = new System.Drawing.Point(6, -1);
this.resetApiTokenCheckBox.Name = "resetApiTokenCheckBox";
this.resetApiTokenCheckBox.Size = new System.Drawing.Size(101, 17);
this.resetApiTokenCheckBox.TabIndex = 0;
this.resetApiTokenCheckBox.Text = "Reset api token";
this.resetApiTokenCheckBox.UseVisualStyleBackColor = true;
this.resetApiTokenCheckBox.CheckedChanged += new System.EventHandler(this.resetApiTokenCheckBox_CheckedChanged);
// //
// ApiSettings // ApiSettings
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 261); this.ClientSize = new System.Drawing.Size(310, 197);
this.Controls.Add(this.label4);
this.Controls.Add(this.ApiPassTextBox);
this.Controls.Add(this.label3);
this.Controls.Add(this.ApiUserTextBox);
this.Controls.Add(this.label2);
this.Controls.Add(this.ApiKeyTextBox);
this.Controls.Add(this.SaveButton); this.Controls.Add(this.SaveButton);
this.Controls.Add(this.label1); this.Controls.Add(this.groupBox1);
this.Controls.Add(this.apiURLTextBox);
this.Name = "ApiSettings"; this.Name = "ApiSettings";
this.Text = "ApiSettings"; this.Text = "ApiSettings";
this.Load += new System.EventHandler(this.ApiSettings_Load); this.Load += new System.EventHandler(this.ApiSettings_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout();
} }
#endregion #endregion
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox ApiPassTextBox;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox ApiUserTextBox;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox ApiKeyTextBox;
private System.Windows.Forms.Button SaveButton;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox apiURLTextBox; private System.Windows.Forms.TextBox apiURLTextBox;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button SaveButton;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox usernameTextBox;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox pwTextBox;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.CheckBox resetApiTokenCheckBox;
} }
} }
\ No newline at end of file
using System; using MoyaAdminLib;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace moyaPrintServer namespace moyaPrintServer
...@@ -18,21 +20,67 @@ namespace moyaPrintServer ...@@ -18,21 +20,67 @@ namespace moyaPrintServer
private void SaveButton_Click(object sender, EventArgs e) private void SaveButton_Click(object sender, EventArgs e)
{ {
Properties.Settings.Default.ApiURL = apiURLTextBox.Text; ApiCredential apiCredential = null;
Properties.Settings.Default.ApiKey = ApiKeyTextBox.Text;
Properties.Settings.Default.ApiUser = ApiUserTextBox.Text;
Properties.Settings.Default.ApiPass = ApiPassTextBox.Text;
Properties.Settings.Default.Save();
if (resetApiTokenCheckBox.Checked)
{
try
{
apiCredential = RestClient.GetApiCredential(usernameTextBox.Text, pwTextBox.Text, Properties.Settings.Default.ApiApplicationKey, apiURLTextBox.Text);
}
catch (Exception ex)
{
MessageBox.Show("Failed to get api credentials: " + ex.Message);
}
if (apiCredential != null)
{
Properties.Settings.Default.ApiURL = apiURLTextBox.Text;
Properties.Settings.Default.ApiApplicationKey = Properties.Settings.Default.ApiApplicationKey;
Properties.Settings.Default.ApiUser = apiCredential.authname;
Properties.Settings.Default.ApiPass = apiCredential.secret;
Properties.Settings.Default.ApiTokenSet = true;
Properties.Settings.Default.Save();
}
}
RestClient.ApiApplicationKey = Properties.Settings.Default.ApiApplicationKey;
RestClient.ApiPass = Properties.Settings.Default.ApiPass;
RestClient.ApiUser = Properties.Settings.Default.ApiUser;
RestClient.ApiURL = Properties.Settings.Default.ApiURL;
this.DialogResult = System.Windows.Forms.DialogResult.OK; this.DialogResult = System.Windows.Forms.DialogResult.OK;
} }
private void ApiSettings_Load(object sender, EventArgs e) private void ApiSettings_Load(object sender, EventArgs e)
{ {
resetApiTokenCheckBox.Checked = !Properties.Settings.Default.ApiTokenSet;
apiURLTextBox.Text = Properties.Settings.Default.ApiURL; apiURLTextBox.Text = Properties.Settings.Default.ApiURL;
ApiKeyTextBox.Text = Properties.Settings.Default.ApiKey; //ApiKeyTextBox.Text = Properties.Settings.Default.ApiApplicationKey;
ApiUserTextBox.Text = Properties.Settings.Default.ApiUser; //textBox1.Text =Properties.Settings.Default.ApiApplicationKey;
ApiPassTextBox.Text = Properties.Settings.Default.ApiPass; //usernameTextBox.Text = Properties.Settings.Default.ApiUser;
//pwTextBox.Text = Properties.Settings.Default.ApiPass;
}
private void resetApiTokenCheckBox_CheckedChanged(object sender, EventArgs e)
{
if (!resetApiTokenCheckBox.Checked)
{
apiURLTextBox.ReadOnly = true;
usernameTextBox.ReadOnly = true;
pwTextBox.ReadOnly = true;
//ApiKeyTextBox.ReadOnly = true;
}
else
{
apiURLTextBox.ReadOnly = false;
usernameTextBox.ReadOnly = false;
pwTextBox.ReadOnly = false;
//ApiKeyTextBox.ReadOnly = false;
}
} }
} }
} }
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.setPrintedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.printButton = new System.Windows.Forms.Button(); this.printButton = new System.Windows.Forms.Button();
this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.statusStrip1 = new System.Windows.Forms.StatusStrip();
...@@ -49,18 +51,17 @@ ...@@ -49,18 +51,17 @@
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.CardFilterTextBox = new System.Windows.Forms.TextBox(); this.CardFilterTextBox = new System.Windows.Forms.TextBox();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.sortByFirstnameCheckBox = new System.Windows.Forms.CheckBox();
this.setPrintedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.contextMenuStrip1.SuspendLayout();
this.statusStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout();
this.toolStrip1.SuspendLayout(); this.toolStrip1.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// autoPrintCheckBox // autoPrintCheckBox
// //
this.autoPrintCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.autoPrintCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.autoPrintCheckBox.AutoSize = true; this.autoPrintCheckBox.AutoSize = true;
this.autoPrintCheckBox.Location = new System.Drawing.Point(12, 313); this.autoPrintCheckBox.Location = new System.Drawing.Point(12, 324);
this.autoPrintCheckBox.Name = "autoPrintCheckBox"; this.autoPrintCheckBox.Name = "autoPrintCheckBox";
this.autoPrintCheckBox.Size = new System.Drawing.Size(69, 17); this.autoPrintCheckBox.Size = new System.Drawing.Size(69, 17);
this.autoPrintCheckBox.TabIndex = 4; this.autoPrintCheckBox.TabIndex = 4;
...@@ -81,7 +82,7 @@ ...@@ -81,7 +82,7 @@
this.listView.FullRowSelect = true; this.listView.FullRowSelect = true;
this.listView.Location = new System.Drawing.Point(11, 84); this.listView.Location = new System.Drawing.Point(11, 84);
this.listView.Name = "listView"; this.listView.Name = "listView";
this.listView.Size = new System.Drawing.Size(406, 223); this.listView.Size = new System.Drawing.Size(468, 234);
this.listView.TabIndex = 5; this.listView.TabIndex = 5;
this.listView.UseCompatibleStateImageBehavior = false; this.listView.UseCompatibleStateImageBehavior = false;
this.listView.View = System.Windows.Forms.View.Details; this.listView.View = System.Windows.Forms.View.Details;
...@@ -102,6 +103,20 @@ ...@@ -102,6 +103,20 @@
this.columnHeader3.Text = "Name"; this.columnHeader3.Text = "Name";
this.columnHeader3.Width = 192; this.columnHeader3.Width = 192;
// //
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.setPrintedToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(132, 26);
//
// setPrintedToolStripMenuItem
//
this.setPrintedToolStripMenuItem.Name = "setPrintedToolStripMenuItem";
this.setPrintedToolStripMenuItem.Size = new System.Drawing.Size(131, 22);
this.setPrintedToolStripMenuItem.Text = "Set printed";
this.setPrintedToolStripMenuItem.Click += new System.EventHandler(this.setPrintedToolStripMenuItem_Click);
//
// label3 // label3
// //
this.label3.AutoSize = true; this.label3.AutoSize = true;
...@@ -114,7 +129,7 @@ ...@@ -114,7 +129,7 @@
// printButton // printButton
// //
this.printButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.printButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.printButton.Location = new System.Drawing.Point(357, 313); this.printButton.Location = new System.Drawing.Point(419, 324);
this.printButton.Name = "printButton"; this.printButton.Name = "printButton";
this.printButton.Size = new System.Drawing.Size(60, 23); this.printButton.Size = new System.Drawing.Size(60, 23);
this.printButton.TabIndex = 7; this.printButton.TabIndex = 7;
...@@ -126,9 +141,9 @@ ...@@ -126,9 +141,9 @@
// //
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripStatusLabel1}); this.toolStripStatusLabel1});
this.statusStrip1.Location = new System.Drawing.Point(0, 345); this.statusStrip1.Location = new System.Drawing.Point(0, 356);
this.statusStrip1.Name = "statusStrip1"; this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(429, 22); this.statusStrip1.Size = new System.Drawing.Size(491, 22);
this.statusStrip1.TabIndex = 8; this.statusStrip1.TabIndex = 8;
this.statusStrip1.Text = "statusStrip1"; this.statusStrip1.Text = "statusStrip1";
// //
...@@ -140,8 +155,6 @@ ...@@ -140,8 +155,6 @@
// //
// PrintersComboBox // PrintersComboBox
// //
this.PrintersComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.PrintersComboBox.FormattingEnabled = true; this.PrintersComboBox.FormattingEnabled = true;
this.PrintersComboBox.Location = new System.Drawing.Point(11, 44); this.PrintersComboBox.Location = new System.Drawing.Point(11, 44);
this.PrintersComboBox.Name = "PrintersComboBox"; this.PrintersComboBox.Name = "PrintersComboBox";
...@@ -161,7 +174,7 @@ ...@@ -161,7 +174,7 @@
// refreshButton // refreshButton
// //
this.refreshButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.refreshButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.refreshButton.Location = new System.Drawing.Point(290, 313); this.refreshButton.Location = new System.Drawing.Point(352, 324);
this.refreshButton.Name = "refreshButton"; this.refreshButton.Name = "refreshButton";
this.refreshButton.Size = new System.Drawing.Size(61, 23); this.refreshButton.Size = new System.Drawing.Size(61, 23);
this.refreshButton.TabIndex = 12; this.refreshButton.TabIndex = 12;
...@@ -180,7 +193,7 @@ ...@@ -180,7 +193,7 @@
this.settingsToolStripButton}); this.settingsToolStripButton});
this.toolStrip1.Location = new System.Drawing.Point(0, 0); this.toolStrip1.Location = new System.Drawing.Point(0, 0);
this.toolStrip1.Name = "toolStrip1"; this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(429, 25); this.toolStrip1.Size = new System.Drawing.Size(491, 25);
this.toolStrip1.TabIndex = 13; this.toolStrip1.TabIndex = 13;
this.toolStrip1.Text = "toolStrip1"; this.toolStrip1.Text = "toolStrip1";
// //
...@@ -198,17 +211,18 @@ ...@@ -198,17 +211,18 @@
// //
this.sortByNameCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.sortByNameCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.sortByNameCheckBox.AutoSize = true; this.sortByNameCheckBox.AutoSize = true;
this.sortByNameCheckBox.Location = new System.Drawing.Point(87, 313); this.sortByNameCheckBox.Location = new System.Drawing.Point(87, 324);
this.sortByNameCheckBox.Name = "sortByNameCheckBox"; this.sortByNameCheckBox.Name = "sortByNameCheckBox";
this.sortByNameCheckBox.Size = new System.Drawing.Size(88, 17); this.sortByNameCheckBox.Size = new System.Drawing.Size(108, 17);
this.sortByNameCheckBox.TabIndex = 14; this.sortByNameCheckBox.TabIndex = 14;
this.sortByNameCheckBox.Text = "Sort by name"; this.sortByNameCheckBox.Text = "Sort by username";
this.sortByNameCheckBox.UseVisualStyleBackColor = true; this.sortByNameCheckBox.UseVisualStyleBackColor = true;
this.sortByNameCheckBox.CheckedChanged += new System.EventHandler(this.sortByNameCheckBox_CheckedChanged);
// //
// label1 // label1
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(314, 29); this.label1.Location = new System.Drawing.Point(316, 28);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(54, 13); this.label1.Size = new System.Drawing.Size(54, 13);
this.label1.TabIndex = 15; this.label1.TabIndex = 15;
...@@ -216,31 +230,32 @@ ...@@ -216,31 +230,32 @@
// //
// CardFilterTextBox // CardFilterTextBox
// //
this.CardFilterTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.CardFilterTextBox.Location = new System.Drawing.Point(317, 45); this.CardFilterTextBox.Location = new System.Drawing.Point(317, 45);
this.CardFilterTextBox.Name = "CardFilterTextBox"; this.CardFilterTextBox.Name = "CardFilterTextBox";
this.CardFilterTextBox.Size = new System.Drawing.Size(100, 20); this.CardFilterTextBox.Size = new System.Drawing.Size(162, 20);
this.CardFilterTextBox.TabIndex = 16; this.CardFilterTextBox.TabIndex = 16;
this.toolTip1.SetToolTip(this.CardFilterTextBox, "By default print all cards. With this you can limit name of printed card types"); this.toolTip1.SetToolTip(this.CardFilterTextBox, "By default print all cards. With this you can limit name of printed card types");
// //
// contextMenuStrip1 // sortByFirstnameCheckBox
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.setPrintedToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(153, 48);
//
// setPrintedToolStripMenuItem
// //
this.setPrintedToolStripMenuItem.Name = "setPrintedToolStripMenuItem"; this.sortByFirstnameCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.setPrintedToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.sortByFirstnameCheckBox.AutoSize = true;
this.setPrintedToolStripMenuItem.Text = "Set printed"; this.sortByFirstnameCheckBox.Location = new System.Drawing.Point(201, 324);
this.setPrintedToolStripMenuItem.Click += new System.EventHandler(this.setPrintedToolStripMenuItem_Click); this.sortByFirstnameCheckBox.Name = "sortByFirstnameCheckBox";
this.sortByFirstnameCheckBox.Size = new System.Drawing.Size(107, 17);
this.sortByFirstnameCheckBox.TabIndex = 17;
this.sortByFirstnameCheckBox.Text = "Sort by first name";
this.sortByFirstnameCheckBox.UseVisualStyleBackColor = true;
this.sortByFirstnameCheckBox.CheckedChanged += new System.EventHandler(this.sortByFirstnameCheckBox_CheckedChanged);
// //
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(429, 367); this.ClientSize = new System.Drawing.Size(491, 378);
this.Controls.Add(this.sortByFirstnameCheckBox);
this.Controls.Add(this.CardFilterTextBox); this.Controls.Add(this.CardFilterTextBox);
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.Controls.Add(this.sortByNameCheckBox); this.Controls.Add(this.sortByNameCheckBox);
...@@ -258,11 +273,11 @@ ...@@ -258,11 +273,11 @@
this.Text = "Moya Print server"; this.Text = "Moya Print server";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
this.Load += new System.EventHandler(this.Form1_Load); this.Load += new System.EventHandler(this.Form1_Load);
this.contextMenuStrip1.ResumeLayout(false);
this.statusStrip1.ResumeLayout(false); this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout(); this.statusStrip1.PerformLayout();
this.toolStrip1.ResumeLayout(false); this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout(); this.toolStrip1.PerformLayout();
this.contextMenuStrip1.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
...@@ -291,6 +306,7 @@ ...@@ -291,6 +306,7 @@
private System.Windows.Forms.ToolTip toolTip1; private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem setPrintedToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem setPrintedToolStripMenuItem;
private System.Windows.Forms.CheckBox sortByFirstnameCheckBox;
} }
} }
...@@ -9,7 +9,6 @@ using System.Windows.Forms; ...@@ -9,7 +9,6 @@ using System.Windows.Forms;
using System.Net; using System.Net;
using System.Text; using System.Text;
using System.IO; using System.IO;
using HttpUtils;
using System.Drawing.Printing; using System.Drawing.Printing;
using System.Web.Script.Serialization; using System.Web.Script.Serialization;
using System.Printing; using System.Printing;
...@@ -18,6 +17,7 @@ namespace moyaPrintServer ...@@ -18,6 +17,7 @@ namespace moyaPrintServer
{ {
public partial class Form1 : Form public partial class Form1 : Form
{ {
Random rnd = new Random();
public Form1() public Form1()
{ {
InitializeComponent(); InitializeComponent();
...@@ -37,6 +37,8 @@ namespace moyaPrintServer ...@@ -37,6 +37,8 @@ namespace moyaPrintServer
if (apiUrlTextBox.Text == "") if (apiUrlTextBox.Text == "")
apiUrlTextBox.Text = "https://event.domain.ltd/MoyaWeb/rest"; apiUrlTextBox.Text = "https://event.domain.ltd/MoyaWeb/rest";
*/ */
} }
...@@ -60,6 +62,24 @@ namespace moyaPrintServer ...@@ -60,6 +62,24 @@ namespace moyaPrintServer
refreshList(); refreshList();
} }
private void tryPrintCardFromList(Card card, ListViewItem lvi, bool showDialog)
{
try
{
RestClient client = new RestClient(Properties.Settings.Default.ApiURL);
client.MakeRequest("card/Reserve/" + card.id);
PrintCard(card);
listView.Items.Remove(lvi);
}
catch (Exception ex)
{
//varattu kortti. Skipataan
listView.Items.Remove(lvi);
MessageBox.Show("Kortti on jo tulostettu");
return;
}
}
private void printButton_Click(object sender, EventArgs e) private void printButton_Click(object sender, EventArgs e)
{ {
if (listView.SelectedItems.Count > 0) if (listView.SelectedItems.Count > 0)
...@@ -74,6 +94,7 @@ namespace moyaPrintServer ...@@ -74,6 +94,7 @@ namespace moyaPrintServer
{ {
cards.Add( (Card)lvi.Tag); cards.Add( (Card)lvi.Tag);
} }
cards = cards.OrderBy(c=>c.username).ToList(); cards = cards.OrderBy(c=>c.username).ToList();
foreach (Card card in cards) foreach (Card card in cards)
{ {
...@@ -81,18 +102,18 @@ namespace moyaPrintServer ...@@ -81,18 +102,18 @@ namespace moyaPrintServer
{ {
if ((Card)lvi.Tag == card) if ((Card)lvi.Tag == card)
{ {
PrintCard(card); tryPrintCardFromList(card, lvi, true);
listView.Items.Remove(lvi);
break; break;
} }
} }
} }
} }
else else
{ {
foreach (ListViewItem lvi in items) foreach (ListViewItem lvi in items)
{ {
PrintCard((Card)lvi.Tag); tryPrintCardFromList((Card)lvi.Tag, lvi, true);
listView.Items.Remove(lvi); listView.Items.Remove(lvi);
} }
} }
...@@ -189,9 +210,15 @@ namespace moyaPrintServer ...@@ -189,9 +210,15 @@ namespace moyaPrintServer
} }
if (listView.Items.Count > 0 && GetNumberOfPrintJobs() < 1) if (listView.Items.Count > 0 && GetNumberOfPrintJobs() < 1)
{ {
Card card = (Card)listView.Items[0].Tag; // Idiot fix for double click users & some random race conditions.
System.Threading.Thread.Sleep(rnd.Next(500, 1500));
refreshList();
if (listView.Items.Count == 0)
return;
Card card = (Card)listView.Items[0].Tag;
try try
{ {
RestClient client = new RestClient(Properties.Settings.Default.ApiURL); RestClient client = new RestClient(Properties.Settings.Default.ApiURL);
client.MakeRequest("card/Reserve/" + card.id); client.MakeRequest("card/Reserve/" + card.id);
} }
...@@ -219,7 +246,7 @@ namespace moyaPrintServer ...@@ -219,7 +246,7 @@ namespace moyaPrintServer
var ser = new JavaScriptSerializer(); var ser = new JavaScriptSerializer();
PrintQueueList queuelist = ser.Deserialize<PrintQueueList>(json); PrintQueueList queuelist = ser.Deserialize<PrintQueueList>(json);
if (queuelist == null) if (queuelist == null || queuelist.cards.Count == 0)
{ {
toolStripStatusLabel1.Text = "No new cards"; toolStripStatusLabel1.Text = "No new cards";
return; return;
...@@ -229,10 +256,12 @@ namespace moyaPrintServer ...@@ -229,10 +256,12 @@ namespace moyaPrintServer
listView.Items.Clear(); listView.Items.Clear();
if (sortByNameCheckBox.Checked) if (sortByNameCheckBox.Checked)
queuelist.cards = queuelist.cards.OrderBy(c => c.username).ToList(); queuelist.cards = queuelist.cards.OrderBy(c => c.username).ToList();
if (sortByFirstnameCheckBox.Checked)
queuelist.cards = queuelist.cards.OrderBy(c => c.wholeName).ToList();
foreach (Card card in queuelist.cards) foreach (Card card in queuelist.cards)
{ {
// jos ei ole filtteriä niin tulosta kaikki validoidut kortit. Jos on filtteri niin tulosta vain ne joihin se osuu // jos ei ole filtteriä niin tulosta kaikki validoidut kortit. Jos on filtteri niin tulosta vain ne joihin se osuu
if (card.state == "VALIDATED" && (CardFilterTextBox.Text.Length == 0 || CardFilterTextBox.Text == card.template)) if (card.state == "VALIDATED" && (CardFilterTextBox.Text.Length == 0 || CardFilterTextBox.Text.ToLower().Contains(card.template.ToLower())))
{ {
ListViewItem lvi = listView.Items.Add(card.id.ToString()); ListViewItem lvi = listView.Items.Add(card.id.ToString());
...@@ -255,17 +284,14 @@ namespace moyaPrintServer ...@@ -255,17 +284,14 @@ namespace moyaPrintServer
LocalPrintServer server = new LocalPrintServer(); LocalPrintServer server = new LocalPrintServer();
PrintQueueCollection queueCollection = server.GetPrintQueues(); PrintQueueCollection queueCollection = server.GetPrintQueues();
PrintQueue printQueue = null; PrintQueue printQueue = null;
foreach (PrintQueue pq in queueCollection) foreach (PrintQueue pq in queueCollection)
{ {
if (PrintersComboBox.SelectedItem != null && pq.FullName == PrintersComboBox.SelectedItem.ToString()) if (PrintersComboBox.SelectedItem != null && pq.FullName == PrintersComboBox.SelectedItem.ToString())
printQueue = pq; printQueue = pq;
} }
int numberOfJobs = 0; int numberOfJobs = 0;
if (printQueue != null) if (printQueue != null)
numberOfJobs = printQueue.NumberOfJobs; numberOfJobs = printQueue.NumberOfJobs;
return numberOfJobs; return numberOfJobs;
} }
...@@ -317,6 +343,16 @@ namespace moyaPrintServer ...@@ -317,6 +343,16 @@ namespace moyaPrintServer
} }
} }
private void sortByFirstnameCheckBox_CheckedChanged(object sender, EventArgs e)
{
if(sortByFirstnameCheckBox.Checked)
sortByNameCheckBox.Checked = !sortByFirstnameCheckBox.Checked;
}
private void sortByNameCheckBox_CheckedChanged(object sender, EventArgs e)
{
if (sortByNameCheckBox.Checked)
sortByNameCheckBox.Checked = !sortByFirstnameCheckBox.Checked;
}
} }
} }
...@@ -142,6 +142,9 @@ ...@@ -142,6 +142,9 @@
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>346, 17</value> <value>346, 17</value>
</metadata> </metadata>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>346, 17</value>
</metadata>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
AAABAAgAICAQAAAAAADoAgAAhgAAABAQEAAAAAAAKAEAAG4DAAAwMAAAAQAIAKgOAACWBAAAICAAAAEA AAABAAgAICAQAAAAAADoAgAAhgAAABAQEAAAAAAAKAEAAG4DAAAwMAAAAQAIAKgOAACWBAAAICAAAAEA
......
...@@ -6,7 +6,6 @@ using System.Drawing; ...@@ -6,7 +6,6 @@ using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using HttpUtils;
using System.Net; using System.Net;
using System.IO; using System.IO;
......
...@@ -39,7 +39,20 @@ namespace moyaPrintServer ...@@ -39,7 +39,20 @@ namespace moyaPrintServer
Properties.Settings.Default.ApplicationVersion = appVersionString; Properties.Settings.Default.ApplicationVersion = appVersionString;
} }
//Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
//Application.ThreadException += Application_ThreadException;
Application.Run(new Form1()); Application.Run(new Form1());
} }
private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
{
if (e.Exception.Message.Contains("Could not load file or assembly") && e.Exception.Message.Contains("System.Web.Extensions") && e.Exception.Message.Contains("4.0.0.0"))
{
MessageBox.Show("Cannot find .Net Framework version 4.0 installed on your system. Please install the missing framework. You can download and install it from: http://www.microsoft.com/en-us/download/details.aspx?id=17851");
}
else
throw new Exception(e.Exception.Message, e.Exception);
}
} }
} }
...@@ -32,5 +32,5 @@ using System.Runtime.InteropServices; ...@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.29.0")] [assembly: AssemblyVersion("1.0.36.0")]
[assembly: AssemblyFileVersion("1.0.29.0")] [assembly: AssemblyFileVersion("1.0.36.0")]
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:4.0.30319.18408 // Runtime Version:4.0.30319.42000
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
...@@ -12,7 +12,7 @@ namespace moyaPrintServer.Properties { ...@@ -12,7 +12,7 @@ namespace moyaPrintServer.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
...@@ -61,13 +61,13 @@ namespace moyaPrintServer.Properties { ...@@ -61,13 +61,13 @@ namespace moyaPrintServer.Properties {
[global::System.Configuration.UserScopedSettingAttribute()] [global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")] [global::System.Configuration.DefaultSettingValueAttribute("8krAyTEpzP6QnwzkxGek")]
public string ApiKey { public string ApiApplicationKey {
get { get {
return ((string)(this["ApiKey"])); return ((string)(this["ApiApplicationKey"]));
} }
set { set {
this["ApiKey"] = value; this["ApiApplicationKey"] = value;
} }
} }
...@@ -106,5 +106,17 @@ namespace moyaPrintServer.Properties { ...@@ -106,5 +106,17 @@ namespace moyaPrintServer.Properties {
this["ApplicationVersion"] = value; this["ApplicationVersion"] = value;
} }
} }
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool ApiTokenSet {
get {
return ((bool)(this["ApiTokenSet"]));
}
set {
this["ApiTokenSet"] = value;
}
}
} }
} }
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
<Setting Name="ApiURL" Type="System.String" Scope="User"> <Setting Name="ApiURL" Type="System.String" Scope="User">
<Value Profile="(Default)" /> <Value Profile="(Default)" />
</Setting> </Setting>
<Setting Name="ApiKey" Type="System.String" Scope="User"> <Setting Name="ApiApplicationKey" Type="System.String" Scope="User">
<Value Profile="(Default)" /> <Value Profile="(Default)">8krAyTEpzP6QnwzkxGek</Value>
</Setting> </Setting>
<Setting Name="ApiUser" Type="System.String" Scope="User"> <Setting Name="ApiUser" Type="System.String" Scope="User">
<Value Profile="(Default)" /> <Value Profile="(Default)" />
...@@ -23,5 +23,8 @@ ...@@ -23,5 +23,8 @@
<Setting Name="ApplicationVersion" Type="System.String" Scope="User"> <Setting Name="ApplicationVersion" Type="System.String" Scope="User">
<Value Profile="(Default)" /> <Value Profile="(Default)" />
</Setting> </Setting>
<Setting Name="ApiTokenSet" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings> </Settings>
</SettingsFile> </SettingsFile>
\ No newline at end of file
using System; using MoyaAdminLib;
using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Net; using System.Net;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text; using System.Text;
using System.Diagnostics; using System.Threading.Tasks;
using System.Web.Script.Serialization;
public enum HttpVerb namespace moyaPrintServer
{ {
GET,
POST,
PUT,
DELETE
}
namespace HttpUtils
{ public enum HttpVerb
{
GET,
POST,
PUT,
DELETE
}
public class RestClient public class RestClient
{ {
public string EndPoint { get; set; } public string EndPoint { get; set; }
...@@ -22,10 +28,16 @@ namespace HttpUtils ...@@ -22,10 +28,16 @@ namespace HttpUtils
public string ContentType { get; set; } public string ContentType { get; set; }
public string PostData { get; set; } public string PostData { get; set; }
public static string ApiApplicationKey;
public static string ApiUser;
public static string ApiPass;
public static string ApiURL;
public RestClient() public RestClient()
{ {
EndPoint = ""; EndPoint = ApiURL;
Method = HttpVerb.GET; Method = HttpVerb.GET;
ContentType = "application/json"; ContentType = "application/json";
PostData = ""; PostData = "";
} }
...@@ -53,20 +65,6 @@ namespace HttpUtils ...@@ -53,20 +65,6 @@ namespace HttpUtils
} }
public string MakeRequest()
{
return MakeRequest("");
}
public static string GetRequestURL(string server, string parameters)
{
int timestamp = ConvertToTimestamp(DateTime.Now);
string hash = CalculateSHA1("/" + parameters + "+" + moyaPrintServer.Properties.Settings.Default.ApiKey + "+" + moyaPrintServer.Properties.Settings.Default.ApiUser + "+" + timestamp + "+" + moyaPrintServer.Properties.Settings.Default.ApiPass);
string url = server + "/rest/" + parameters + "?appkey=" + moyaPrintServer.Properties.Settings.Default.ApiKey + "&appuser=" + moyaPrintServer.Properties.Settings.Default.ApiUser + "&appstamp=" + timestamp + "&appmac=" + hash;
Debug.WriteLine(url);
return url;
}
public static string CalculateSHA1(string text) public static string CalculateSHA1(string text)
{ {
// Convert the input string to a byte array // Convert the input string to a byte array
...@@ -83,7 +81,6 @@ namespace HttpUtils ...@@ -83,7 +81,6 @@ namespace HttpUtils
return hash; return hash;
} }
private static int ConvertToTimestamp(DateTime value) private static int ConvertToTimestamp(DateTime value)
{ {
//create Timespan by subtracting the value provided from //create Timespan by subtracting the value provided from
...@@ -94,15 +91,48 @@ namespace HttpUtils ...@@ -94,15 +91,48 @@ namespace HttpUtils
return (int)span.TotalSeconds; return (int)span.TotalSeconds;
} }
public string MakeRequest(string parameters) public static string GetRequestURL(string server, string queryPath)
{ {
var request = (HttpWebRequest)WebRequest.Create(GetRequestURL( EndPoint, parameters)); return GetRequestURL(server, queryPath,null);
}
public static string GetRequestURL(string server, string queryPath, string getparms)
{
int timestamp = ConvertToTimestamp(DateTime.Now);
string hash = CalculateSHA1("/" + queryPath + "+" + Properties.Settings.Default.ApiApplicationKey + "+" + Properties.Settings.Default.ApiUser + "+" + timestamp + "+" + Properties.Settings.Default.ApiPass);
if (getparms != null && getparms.Length > 0)
getparms = getparms + "&";
string url = server + "/rest/" + queryPath + "?";
if (getparms != null)
url += getparms;
url += "appkey=" + Properties.Settings.Default.ApiApplicationKey + "&appuser=" + Properties.Settings.Default.ApiUser + "&appstamp=" + timestamp + "&appmac=" + hash;
Console.WriteLine(url);
return url;
}
public string MakeRequest(string queryPath)
{
return MakeRequest(queryPath, null);
}
public string MakeRequest(string queryPath, string getparms)
{
///placeadmin/places/30+abcdefg+testuser-asdf+1393735570144+acdcabbacd
///
var request = (HttpWebRequest)WebRequest.Create(GetRequestURL(EndPoint,queryPath,getparms));
request.Method = Method.ToString(); request.Method = Method.ToString();
request.ContentLength = 0; request.ContentLength = 0;
request.ContentType = ContentType; request.ContentType = ContentType;
if (!string.IsNullOrEmpty(PostData) && Method == HttpVerb.POST) if (!string.IsNullOrEmpty(PostData) && (Method == HttpVerb.POST || Method == HttpVerb.PUT ))
{ {
var encoding = new UTF8Encoding(); var encoding = new UTF8Encoding();
var bytes = Encoding.GetEncoding("iso-8859-1").GetBytes(PostData); var bytes = Encoding.GetEncoding("iso-8859-1").GetBytes(PostData);
...@@ -113,31 +143,131 @@ namespace HttpUtils ...@@ -113,31 +143,131 @@ namespace HttpUtils
writeStream.Write(bytes, 0, bytes.Length); writeStream.Write(bytes, 0, bytes.Length);
} }
} }
using (var response = (HttpWebResponse)request.GetResponse())
{
var responseValue = string.Empty;
if (response.StatusCode != HttpStatusCode.OK)
try
{
using (var response = (HttpWebResponse)request.GetResponse())
{ {
var message = String.Format("Request failed. Received HTTP {0}", response.StatusCode); var responseValue = string.Empty;
throw new ApplicationException(message);
if ((int)response.StatusCode < 200 && (int)response.StatusCode >= 300)
{
var message = String.Format("Request failed. Received HTTP {0}", response.StatusCode);
throw new ApplicationException(message);
}
// grab the response
//if (response.ContentLength > 0)
//{
using (var responseStream = response.GetResponseStream())
{
if (responseStream != null)
using (var reader = new StreamReader(responseStream))
{
responseValue = reader.ReadToEnd();
}
}
//}
return responseValue;
} }
}
catch (WebException e)
{
if (e.Status == WebExceptionStatus.ConnectFailure)
throw e;
Stream responseStream = ((WebException)e).Response.GetResponseStream();
// grab the response if (responseStream != null)
using (var responseStream = response.GetResponseStream())
{ {
if (responseStream != null) string responseValue = StreamToString(responseStream);
using (var reader = new StreamReader(responseStream)) Console.WriteLine("Response was " + responseValue);
{ throw new Exception(responseValue);
responseValue = reader.ReadToEnd();
}
} }
return responseValue;
throw e;
}
}
/// <summary>
/// Convert streams from web to string
/// </summary>
/// <param name="responseStream">Webresponse stream</param>
/// <returns>string</returns>
private string StreamToString(Stream responseStream)
{
StreamReader reader = new StreamReader(responseStream);
string responseString = reader.ReadToEnd();
responseStream.Close();
reader.Close();
return responseString;
}
public static ApiCredential GetApiCredential(string username, string pw, string apiKey, string url)
{
var request = (HttpWebRequest)WebRequest.Create(url+"/rest/apiapp/v1/createInstance/"+apiKey);
/*
NetworkCredential credentials = new NetworkCredential();
credentials.UserName = username;
credentials.Password = pw;
CredentialCache credentialCache = new CredentialCache();
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
credentialCache.Add(new System.Uri(url), "Basic", credentials);
request.Credentials = credentialCache;
request.PreAuthenticate = true;
*/
string encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(username + ":" + pw));
request.Headers.Add("Authorization", "Basic " + encoded);
request.Method = "POST";
try
{
using (var response = (HttpWebResponse)request.GetResponse())
{
var responseValue = string.Empty;
if ((int)response.StatusCode < 200 && (int)response.StatusCode >= 300)
{
var message = String.Format("Request failed. Received HTTP {0}", response.StatusCode);
throw new ApplicationException(message);
}
// grab the response
//if (response.ContentLength > 0)
//{
using (var responseStream = response.GetResponseStream())
{
if (responseStream != null)
using (var reader = new StreamReader(responseStream))
{
responseValue = reader.ReadToEnd();
}
}
//}
JavaScriptSerializer ser = new JavaScriptSerializer();
try
{
ApiCredential credential = ser.Deserialize<ApiCredential>(responseValue);
return credential;
} catch(Exception ex)
{
throw ex;
}
}
}
catch (WebException e)
{
throw e;
} }
} }
} // class } // class
} }
\ No newline at end of file
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
<setting name="ApiURL" serializeAs="String"> <setting name="ApiURL" serializeAs="String">
<value /> <value />
</setting> </setting>
<setting name="ApiKey" serializeAs="String"> <setting name="ApiApplicationKey" serializeAs="String">
<value /> <value>8krAyTEpzP6QnwzkxGek</value>
</setting> </setting>
<setting name="ApiUser" serializeAs="String"> <setting name="ApiUser" serializeAs="String">
<value /> <value />
...@@ -28,6 +28,9 @@ ...@@ -28,6 +28,9 @@
<setting name="ApplicationVersion" serializeAs="String"> <setting name="ApplicationVersion" serializeAs="String">
<value /> <value />
</setting> </setting>
<setting name="ApiTokenSet" serializeAs="String">
<value>False</value>
</setting>
</moyaPrintServer.Properties.Settings> </moyaPrintServer.Properties.Settings>
</userSettings> </userSettings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<ItemGroup> <ItemGroup>
<Reference Include="AutoUpdateLib, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="AutoUpdateLib, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\AutoUpdate\src\AutoUpdateLib\bin\Debug\AutoUpdateLib.dll</HintPath> <HintPath>..\res\AutoUpdateLib.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="ApiCredential.cs" />
<Compile Include="ApiSettings.cs"> <Compile Include="ApiSettings.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
Name "MoyaPrintServer moya v1_00_29" Name "MoyaPrintServer moya v1_00_36"
; DO NOT CHANGE OutFile "installer_temp.exe" !!! AutoPublish requires this. ; DO NOT CHANGE OutFile "installer_temp.exe" !!! AutoPublish requires this.
...@@ -198,7 +198,7 @@ FunctionEnd ...@@ -198,7 +198,7 @@ FunctionEnd
Section "!MoyaPrintServer moya stable v1_00_29" SecMain Section "!MoyaPrintServer moya stable v1_00_36" SecMain
SetShellVarContext current SetShellVarContext current
...@@ -212,11 +212,11 @@ Section "!MoyaPrintServer moya stable v1_00_29" SecMain ...@@ -212,11 +212,11 @@ Section "!MoyaPrintServer moya stable v1_00_29" SecMain
SetOverwrite On SetOverwrite On
File /oname=autoupdate.xml "I:\devel\proj\moya-info-tools\PrintServer\moyaPrintServer\moyaPrintServer\bin\Debug\autoupdate.moya.xml" File /oname=autoupdate.xml "C:\devel\proj\moya-info-tools\PrintServer\moyaPrintServer\moyaPrintServer\bin\Debug\autoupdate.moya.xml"
File /oname=moyaPrintServer.exe "I:\devel\proj\moya-info-tools\PrintServer\moyaPrintServer\moyaPrintServer\bin\Debug\moyaPrintServer.exe" File /oname=moyaPrintServer.exe "C:\devel\proj\moya-info-tools\PrintServer\moyaPrintServer\moyaPrintServer\bin\Debug\moyaPrintServer.exe"
File autoupdate.crt ; File autoupdate.crt
...@@ -224,10 +224,10 @@ Section "!MoyaPrintServer moya stable v1_00_29" SecMain ...@@ -224,10 +224,10 @@ Section "!MoyaPrintServer moya stable v1_00_29" SecMain
; that is referenced to the main project. ; that is referenced to the main project.
File "I:\devel\proj\moya-info-tools\PrintServer\moyaPrintServer\moyaPrintServer\bin\Debug\AutoUpdateLib.dll" File "C:\devel\proj\moya-info-tools\PrintServer\moyaPrintServer\moyaPrintServer\bin\Debug\AutoUpdateLib.dll"
File "I:\devel\proj\moya-info-tools\PrintServer\moyaPrintServer\moyaPrintServer\bin\Debug\moyaPrintServer.pdb" File "C:\devel\proj\moya-info-tools\PrintServer\moyaPrintServer\moyaPrintServer\bin\Debug\moyaPrintServer.pdb"
File "I:\devel\proj\moya-info-tools\PrintServer\moyaPrintServer\moyaPrintServer\bin\Debug\AutoUpdateLib.pdb" File "C:\devel\proj\moya-info-tools\PrintServer\moyaPrintServer\moyaPrintServer\bin\Debug\AutoUpdateLib.pdb"
...@@ -315,10 +315,10 @@ Section "Uninstall" ...@@ -315,10 +315,10 @@ Section "Uninstall"
; that is referenced to the main project. ; that is referenced to the main project.
Delete "$INSTDIR\I:\devel\proj\moya-info-tools\PrintServer\moyaPrintServer\moyaPrintServer\bin\Debug\AutoUpdateLib.dll" Delete "$INSTDIR\C:\devel\proj\moya-info-tools\PrintServer\moyaPrintServer\moyaPrintServer\bin\Debug\AutoUpdateLib.dll"
Delete "$INSTDIR\I:\devel\proj\moya-info-tools\PrintServer\moyaPrintServer\moyaPrintServer\bin\Debug\moyaPrintServer.pdb" Delete "$INSTDIR\C:\devel\proj\moya-info-tools\PrintServer\moyaPrintServer\moyaPrintServer\bin\Debug\moyaPrintServer.pdb"
Delete "$INSTDIR\I:\devel\proj\moya-info-tools\PrintServer\moyaPrintServer\moyaPrintServer\bin\Debug\AutoUpdateLib.pdb" Delete "$INSTDIR\C:\devel\proj\moya-info-tools\PrintServer\moyaPrintServer\moyaPrintServer\bin\Debug\AutoUpdateLib.pdb"
......
...@@ -34,12 +34,22 @@ namespace QrCodeScannerFrm ...@@ -34,12 +34,22 @@ namespace QrCodeScannerFrm
private void Form1_Load(object sender, EventArgs e) private void Form1_Load(object sender, EventArgs e)
{ {
DsDevice[] _SystemCamereas = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice); if (TrayForm.CaptureDevice != null)
foreach(DsDevice device in _SystemCamereas)
{ {
webcamsComboBox.Items.Add(device.Name); webcamsComboBox.Enabled = false;
//if (Properties.Settings.Default.WebCam != "" && Properties.Settings.Default.WebCam == device.Name) capture = TrayForm.CaptureDevice;
// webcamsComboBox.SelectedItem = device.Name;
}
else
{
DsDevice[] _SystemCamereas = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice);
foreach (DsDevice device in _SystemCamereas)
{
webcamsComboBox.Items.Add(device.Name);
//if (Properties.Settings.Default.WebCam != "" && Properties.Settings.Default.WebCam == device.Name)
// webcamsComboBox.SelectedItem = device.Name;
}
} }
hostTextBox.Text = Properties.Settings.Default.Host; hostTextBox.Text = Properties.Settings.Default.Host;
...@@ -48,7 +58,14 @@ namespace QrCodeScannerFrm ...@@ -48,7 +58,14 @@ namespace QrCodeScannerFrm
barcodereader = new BarcodeReader(); barcodereader = new BarcodeReader();
qrCodeReader = new ZXing.QrCode.QRCodeReader(); qrCodeReader = new ZXing.QrCode.QRCodeReader();
timer1.Enabled = false; if (TrayForm.CaptureDevice == null)
{
timer1.Enabled = false;
} else
{
timer1.Enabled = true;
timer1.Start();
}
} }
private void setRet() private void setRet()
...@@ -89,18 +106,32 @@ namespace QrCodeScannerFrm ...@@ -89,18 +106,32 @@ namespace QrCodeScannerFrm
else else
{ {
Debug.WriteLine("Couldn't dedect qr code, trying to dedect barcode."); Debug.WriteLine("Couldn't dedect qr code, trying to dedect barcode.");
result = barcodereader.Decode(image); for (int i = 0; i < 3; i++)
if (result != null)
{ {
Debug.WriteLine(result.BarcodeFormat.ToString()); if (i > 0)
Debug.WriteLine(result.Text); {
if (codeTextBox.Text != result.Text || timeCodeSent.AddSeconds(30) < DateTime.Now) Debug.WriteLine("Couldn't dedect barcode, trying to rotate picture 90 degrees.");
image.RotateFlip(RotateFlipType.Rotate90FlipNone);
}
pictureBox1.Image = image;
source = new BitmapLuminanceSource(image);
bimage = new BinaryBitmap(new HybridBinarizer(source));
result = new MultiFormatReader().decode(bimage);
result = barcodereader.Decode(image);
if (result != null)
{ {
codeTextBox.Text = result.Text; Debug.WriteLine(result.BarcodeFormat.ToString());
sendCode(result.Text); Debug.WriteLine(result.Text);
if (codeTextBox.Text != result.Text || timeCodeSent.AddSeconds(30) < DateTime.Now)
{
codeTextBox.Text = result.Text;
sendCode(result.Text);
}
if (codeTypeTextBox.Text != result.BarcodeFormat.ToString())
codeTypeTextBox.Text = result.BarcodeFormat.ToString();
break;
} }
if (codeTypeTextBox.Text != result.BarcodeFormat.ToString())
codeTypeTextBox.Text = result.BarcodeFormat.ToString();
} }
} }
} }
......
...@@ -32,5 +32,5 @@ using System.Runtime.InteropServices; ...@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.14.0")] [assembly: AssemblyVersion("1.0.16.0")]
[assembly: AssemblyFileVersion("1.0.14.0")] [assembly: AssemblyFileVersion("1.0.16.0")]
...@@ -32,9 +32,10 @@ ...@@ -32,9 +32,10 @@
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TrayForm)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TrayForm));
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components); this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.scanCodeTimer = new System.Windows.Forms.Timer(this.components);
this.apiSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.apiSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.scanCodeTimer = new System.Windows.Forms.Timer(this.components);
this.videoFormToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.contextMenuStrip1.SuspendLayout(); this.contextMenuStrip1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
...@@ -48,30 +49,38 @@ ...@@ -48,30 +49,38 @@
// contextMenuStrip1 // contextMenuStrip1
// //
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.videoFormToolStripMenuItem,
this.apiSettingsToolStripMenuItem, this.apiSettingsToolStripMenuItem,
this.exitToolStripMenuItem}); this.exitToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1"; this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(153, 70); this.contextMenuStrip1.Size = new System.Drawing.Size(154, 92);
this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening); this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening);
// //
// scanCodeTimer
//
this.scanCodeTimer.Tick += new System.EventHandler(this.scanCodeTimer_Tick);
//
// apiSettingsToolStripMenuItem // apiSettingsToolStripMenuItem
// //
this.apiSettingsToolStripMenuItem.Name = "apiSettingsToolStripMenuItem"; this.apiSettingsToolStripMenuItem.Name = "apiSettingsToolStripMenuItem";
this.apiSettingsToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.apiSettingsToolStripMenuItem.Size = new System.Drawing.Size(153, 22);
this.apiSettingsToolStripMenuItem.Text = "Settings"; this.apiSettingsToolStripMenuItem.Text = "Settings";
this.apiSettingsToolStripMenuItem.Click += new System.EventHandler(this.apiSettingsToolStripMenuItem_Click); this.apiSettingsToolStripMenuItem.Click += new System.EventHandler(this.apiSettingsToolStripMenuItem_Click);
// //
// exitToolStripMenuItem // exitToolStripMenuItem
// //
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.exitToolStripMenuItem.Size = new System.Drawing.Size(153, 22);
this.exitToolStripMenuItem.Text = "Exit"; this.exitToolStripMenuItem.Text = "Exit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
// //
// scanCodeTimer
//
this.scanCodeTimer.Tick += new System.EventHandler(this.scanCodeTimer_Tick);
//
// videoFormToolStripMenuItem
//
this.videoFormToolStripMenuItem.Name = "videoFormToolStripMenuItem";
this.videoFormToolStripMenuItem.Size = new System.Drawing.Size(153, 22);
this.videoFormToolStripMenuItem.Text = "Live video feed";
this.videoFormToolStripMenuItem.Click += new System.EventHandler(this.videoFormToolStripMenuItem_Click);
//
// TrayForm // TrayForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
...@@ -93,5 +102,6 @@ ...@@ -93,5 +102,6 @@
private System.Windows.Forms.Timer scanCodeTimer; private System.Windows.Forms.Timer scanCodeTimer;
private System.Windows.Forms.ToolStripMenuItem apiSettingsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem apiSettingsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem videoFormToolStripMenuItem;
} }
} }
\ No newline at end of file
...@@ -19,7 +19,7 @@ namespace QrCodeScannerFrm ...@@ -19,7 +19,7 @@ namespace QrCodeScannerFrm
{ {
public partial class TrayForm : Form public partial class TrayForm : Form
{ {
Capture capture = null; public static Capture CaptureDevice = null;
IBarcodeReader barcodereader = null; IBarcodeReader barcodereader = null;
ZXing.QrCode.QRCodeReader qrCodeReader = null; ZXing.QrCode.QRCodeReader qrCodeReader = null;
...@@ -76,7 +76,7 @@ namespace QrCodeScannerFrm ...@@ -76,7 +76,7 @@ namespace QrCodeScannerFrm
{ {
try try
{ {
capture = new Emgu.CV.Capture(Properties.Settings.Default.WebCam); CaptureDevice = new Emgu.CV.Capture(Properties.Settings.Default.WebCam);
scanCodeTimer.Enabled = true; scanCodeTimer.Enabled = true;
scanCodeTimer.Start(); scanCodeTimer.Start();
} }
...@@ -94,11 +94,11 @@ namespace QrCodeScannerFrm ...@@ -94,11 +94,11 @@ namespace QrCodeScannerFrm
{ {
try try
{ {
Image<Bgr, byte> frame = capture.QueryFrame(); Image<Bgr, byte> frame = CaptureDevice.QueryFrame();
Image<Gray, byte> gray = frame.Convert<Gray, Byte>(); //Image<Gray, byte> gray = frame.Convert<Gray, byte>();
if (frame != null) if (frame != null)
{ {
Bitmap image = gray.Bitmap; Bitmap image = frame.Bitmap;
//pictureBox1.Image = image; //pictureBox1.Image = image;
LuminanceSource source = new BitmapLuminanceSource(image); LuminanceSource source = new BitmapLuminanceSource(image);
BinaryBitmap bimage = new BinaryBitmap(new HybridBinarizer(source)); BinaryBitmap bimage = new BinaryBitmap(new HybridBinarizer(source));
...@@ -120,21 +120,34 @@ namespace QrCodeScannerFrm ...@@ -120,21 +120,34 @@ namespace QrCodeScannerFrm
else else
{ {
Debug.WriteLine("Couldn't dedect qr code, trying to dedect barcode."); Debug.WriteLine("Couldn't dedect qr code, trying to dedect barcode.");
result = barcodereader.Decode(image); Debug.WriteLine("Couldn't dedect qr code, trying to dedect barcode.");
if (result != null) for (int i = 0; i < 3; i++)
{ {
Debug.WriteLine(result.BarcodeFormat.ToString()); if (i > 0)
Debug.WriteLine(result.Text); {
if (lastCode != result.Text || timeCodeSent.AddSeconds(30) < DateTime.Now) Debug.WriteLine("Couldn't dedect barcode, trying to rotate picture 90 degrees.");
image.RotateFlip(RotateFlipType.Rotate90FlipNone);
}
source = new BitmapLuminanceSource(image);
bimage = new BinaryBitmap(new HybridBinarizer(source));
result = new MultiFormatReader().decode(bimage);
result = barcodereader.Decode(image);
if (result != null && !result.BarcodeFormat.ToString().Contains("UPC"))
{ {
lastCode = result.Text; Debug.WriteLine(result.BarcodeFormat.ToString());
lastCodeType = result.BarcodeFormat.ToString(); Debug.WriteLine(result.Text);
sendCode(lastCode, lastCodeType); if (lastCode != result.Text || timeCodeSent.AddSeconds(30) < DateTime.Now)
{
lastCode = result.Text;
lastCodeType = result.BarcodeFormat.ToString();
sendCode(lastCode, lastCodeType);
}
break;
/*
if (codeTypeTextBox.Text != result.BarcodeFormat.ToString())
codeTypeTextBox.Text = result.BarcodeFormat.ToString();
*/
} }
/*
if (codeTypeTextBox.Text != result.BarcodeFormat.ToString())
codeTypeTextBox.Text = result.BarcodeFormat.ToString();
*/
} }
} }
} }
...@@ -190,7 +203,7 @@ namespace QrCodeScannerFrm ...@@ -190,7 +203,7 @@ namespace QrCodeScannerFrm
if(form.ShowDialog() == DialogResult.OK) if(form.ShowDialog() == DialogResult.OK)
{ try { try
{ {
capture = new Emgu.CV.Capture(Properties.Settings.Default.WebCam); CaptureDevice = new Emgu.CV.Capture(Properties.Settings.Default.WebCam);
scanCodeTimer.Enabled = true; scanCodeTimer.Enabled = true;
scanCodeTimer.Start(); scanCodeTimer.Start();
} catch(Exception ex) } catch(Exception ex)
...@@ -214,5 +227,11 @@ namespace QrCodeScannerFrm ...@@ -214,5 +227,11 @@ namespace QrCodeScannerFrm
{ {
notifyIcon1.Dispose(); notifyIcon1.Dispose();
} }
private void videoFormToolStripMenuItem_Click(object sender, EventArgs e)
{
Form1 frm = new Form1();
frm.Show();
}
} }
} }
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
Name "QrCodeScannerFrm moya v1_00_14" Name "QrCodeScannerFrm moya v1_00_16"
; DO NOT CHANGE OutFile "installer_temp.exe" !!! AutoPublish requires this. ; DO NOT CHANGE OutFile "installer_temp.exe" !!! AutoPublish requires this.
...@@ -198,7 +198,7 @@ FunctionEnd ...@@ -198,7 +198,7 @@ FunctionEnd
Section "!QrCodeScannerFrm moya stable v1_00_14" SecMain Section "!QrCodeScannerFrm moya stable v1_00_16" SecMain
SetShellVarContext current SetShellVarContext current
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!