button undo unvisible at app start and only be visible for 1 undo where possible so far #32
improved handling with undo #26 improved handling for autoload and fixed button "load api" #34 implemented checking of valid api before saving #33
This commit is contained in:
parent
33941b3518
commit
be84e1e144
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Mk0.Software.Bildduplikate
|
||||
@ -16,6 +17,12 @@ namespace Mk0.Software.Bildduplikate
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!CheckWebsite(textBoxApiUrl.Text.Trim() + "?test"))
|
||||
{
|
||||
MessageBox.Show("The URL of the API is not valid!" + Environment.NewLine + "Settings not saved!", "No valid API", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
else
|
||||
{
|
||||
Properties.Settings.Default.ApiUrl = textBoxApiUrl.Text.Trim();
|
||||
Properties.Settings.Default.ReplacePath = textBoxPath1.Text.Trim();
|
||||
@ -25,4 +32,23 @@ namespace Mk0.Software.Bildduplikate
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
|
||||
public bool CheckWebsite(string URL)
|
||||
{
|
||||
try
|
||||
{
|
||||
WebClient wc = new WebClient();
|
||||
string HTMLSource = wc.DownloadString(URL);
|
||||
if (HTMLSource.Contains("API is working properly"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
4
Mk0.Software.Bildduplikate/Main.Designer.cs
generated
4
Mk0.Software.Bildduplikate/Main.Designer.cs
generated
@ -241,6 +241,7 @@ namespace Mk0.Software.Bildduplikate
|
||||
this.buttonAPILoad.TabIndex = 14;
|
||||
this.buttonAPILoad.Text = "Load API";
|
||||
this.buttonAPILoad.UseVisualStyleBackColor = true;
|
||||
this.buttonAPILoad.Visible = false;
|
||||
this.buttonAPILoad.Click += new System.EventHandler(this.ButtonAPILoad_Click);
|
||||
//
|
||||
// buttonUndo
|
||||
@ -252,6 +253,7 @@ namespace Mk0.Software.Bildduplikate
|
||||
this.buttonUndo.TabIndex = 15;
|
||||
this.buttonUndo.Text = "undo";
|
||||
this.buttonUndo.UseVisualStyleBackColor = true;
|
||||
this.buttonUndo.Visible = false;
|
||||
this.buttonUndo.Click += new System.EventHandler(this.ButtonUndo_Click);
|
||||
//
|
||||
// Main
|
||||
@ -273,7 +275,7 @@ namespace Mk0.Software.Bildduplikate
|
||||
this.MinimumSize = new System.Drawing.Size(1000, 590);
|
||||
this.Name = "Main";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Bildduplikate v1.9 by kmpr.at";
|
||||
this.Text = "Bildduplikate v1.10 by kmpr.at";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Main_FormClosing);
|
||||
this.Shown += new System.EventHandler(this.Main_Shown);
|
||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown);
|
||||
|
@ -415,6 +415,7 @@ namespace Mk0.Software.Bildduplikate
|
||||
{
|
||||
MessageBox.Show("Fehler bei der Kommunikation mit der API:" + Environment.NewLine + ex.ToString(), "API Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
buttonUndo.Visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -450,6 +451,8 @@ namespace Mk0.Software.Bildduplikate
|
||||
LoadDuplicates(line, api);
|
||||
lastStep = 2;
|
||||
}
|
||||
//todo erst einkommentieren, wenn es die möglichkeit gibt, gelöschte wiederherzustellen
|
||||
//buttonUndo.Visible = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -491,6 +494,8 @@ namespace Mk0.Software.Bildduplikate
|
||||
LoadDuplicates(line, api);
|
||||
lastStep = 2;
|
||||
}
|
||||
//todo erst einkommentieren, wenn es die möglichkeit gibt, gelöschte wiederherzustellen
|
||||
//buttonUndo.Visible = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -596,6 +601,18 @@ namespace Mk0.Software.Bildduplikate
|
||||
{
|
||||
API api = new API();
|
||||
api.ShowDialog();
|
||||
if (Properties.Settings.Default.ApiUrl != String.Empty)
|
||||
{
|
||||
buttonAPILoad.Visible = true;
|
||||
if (Properties.Settings.Default.autoload)
|
||||
{
|
||||
ButtonAPILoad_Click(null, null);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
buttonAPILoad.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -705,11 +722,15 @@ namespace Mk0.Software.Bildduplikate
|
||||
}
|
||||
}
|
||||
|
||||
if (Properties.Settings.Default.autoload && Properties.Settings.Default.ApiUrl != String.Empty)
|
||||
if (Properties.Settings.Default.ApiUrl != String.Empty)
|
||||
{
|
||||
buttonAPILoad.Visible = true;
|
||||
if (Properties.Settings.Default.autoload)
|
||||
{
|
||||
ButtonAPILoad_Click(null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Undo last processing step
|
||||
@ -741,6 +762,7 @@ namespace Mk0.Software.Bildduplikate
|
||||
{
|
||||
MessageBox.Show("Fehler bei der Kommunikation mit der API:" + Environment.NewLine + ex.ToString(), "API Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
buttonUndo.Visible = false;
|
||||
}
|
||||
else if (lastStep == 2)
|
||||
{
|
||||
|
@ -24,7 +24,7 @@
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.9.0.0</ApplicationVersion>
|
||||
<ApplicationVersion>1.10.0.0</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
|
||||
// indem Sie "*" wie unten gezeigt eingeben:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.9.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.9.0.0")]
|
||||
[assembly: AssemblyVersion("1.10.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.10.0.0")]
|
||||
|
Loading…
Reference in New Issue
Block a user