diff --git a/Homologador/ConfigurationForm.cs b/Homologador/ConfigurationForm.cs index 7ce64f7..8acb204 100644 --- a/Homologador/ConfigurationForm.cs +++ b/Homologador/ConfigurationForm.cs @@ -39,7 +39,7 @@ private void ConfigurationForm_Load(object sender, EventArgs e) private void btnCertificate_Click(object sender, EventArgs e) { - var open = new OpenFileDialog {Filter = @"Pfx Files (*.pfx)|*.pfx"}; + var open = new OpenFileDialog {Filter = Resources.SettingFilterFilesPfx}; if (open.ShowDialog() != DialogResult.OK) return; @@ -85,12 +85,12 @@ private bool ValidarCredenciales() try { if (RucAuth.Validate(txtRuc.Text, txtUser.Text, txtClave.Text)) return true; - MetroMessageBox.Show(this, "Credenciales invalidas", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + MetroMessageBox.Show(this, "Credenciales invalidas", Resources.SettingTitleError, MessageBoxButtons.OK, MessageBoxIcon.Error); txtRuc.Focus(); } catch (Exception e) { - MetroMessageBox.Show(this, e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + MetroMessageBox.Show(this, e.Message, Resources.SettingTitleError, MessageBoxButtons.OK, MessageBoxIcon.Error); } return false; } @@ -107,7 +107,29 @@ private void btnLoadConfig_Click(object sender, EventArgs e) return; } - var jsonText = File.ReadAllText(dialog.FileName); + try + { + LoadConfig(dialog.FileName); + MetroMessageBox.Show(this, + Resources.SettingMsgLoadSuccess, + Resources.SettingTitleSucces, + MessageBoxButtons.OK, + MessageBoxIcon.Information); + } + catch (Exception) + { + MetroMessageBox.Show(this, + Resources.SettingMsgLoadError, + Resources.SettingTitleError, + MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + } + + + private void LoadConfig(string filename) + { + var jsonText = File.ReadAllText(filename); dynamic obj = JObject.Parse(jsonText); txtRuc.Text = obj.Ruc; @@ -123,9 +145,9 @@ private void btnLoadConfig_Click(object sender, EventArgs e) txtClave.Text = obj.Clave; txtClaveCert.Text = obj.ClaveCert; chkProveedor.Checked = obj.EsProveedor; - if (!string.IsNullOrEmpty(obj.Certificado)) + if (!string.IsNullOrEmpty((string)obj.Certificado)) { - txtPathCertify.Tag = obj.Certificado; + txtPathCertify.Tag = obj.Certificado.ToString(); txtPathCertify.Text = @"Certificado Cargado"; } } @@ -135,7 +157,7 @@ private void btnSaveConfig_Click(object sender, EventArgs e) var dialog = new SaveFileDialog { Filter = Resources.FileFilterJson, - FileName = "homologador_settings.json" + FileName = Resources.SettingFilenamDefault }; if (dialog.ShowDialog() != DialogResult.OK) @@ -169,7 +191,11 @@ private void btnSaveConfig_Click(object sender, EventArgs e) } File.WriteAllText(dialog.FileName, obj.ToString()); - MetroMessageBox.Show(this, "Configuracion Guardada", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); + MetroMessageBox.Show(this, + Resources.SettingMsgSaved, + Resources.SettingTitleSucces, + MessageBoxButtons.OK, + MessageBoxIcon.Information); } } } diff --git a/Homologador/Homologador.UI.csproj b/Homologador/Homologador.UI.csproj index 11dfe2d..99662c3 100644 --- a/Homologador/Homologador.UI.csproj +++ b/Homologador/Homologador.UI.csproj @@ -125,6 +125,7 @@ + diff --git a/Homologador/MainForm.Designer.cs b/Homologador/MainForm.Designer.cs index 659ee1d..9455ba8 100644 --- a/Homologador/MainForm.Designer.cs +++ b/Homologador/MainForm.Designer.cs @@ -76,6 +76,7 @@ private void InitializeComponent() this.btnSync = new System.Windows.Forms.PictureBox(); this.btnSetting = new System.Windows.Forms.PictureBox(); this.btnRun = new System.Windows.Forms.PictureBox(); + this.pictGithub = new System.Windows.Forms.PictureBox(); this.tbDocs.SuspendLayout(); this.mtabFacturas.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.gridFacturas)).BeginInit(); @@ -88,6 +89,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.btnSync)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.btnSetting)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.btnRun)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictGithub)).BeginInit(); this.SuspendLayout(); // // tbDocs @@ -624,11 +626,25 @@ private void InitializeComponent() this.btnRun.TabStop = false; this.btnRun.Click += new System.EventHandler(this.btnRun_Click); // + // pictGithub + // + this.pictGithub.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.pictGithub.Cursor = System.Windows.Forms.Cursors.Hand; + this.pictGithub.Image = global::Homologador.Properties.Resources.github; + this.pictGithub.Location = new System.Drawing.Point(346, 20); + this.pictGithub.Name = "pictGithub"; + this.pictGithub.Size = new System.Drawing.Size(32, 33); + this.pictGithub.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictGithub.TabIndex = 7; + this.pictGithub.TabStop = false; + this.pictGithub.Click += new System.EventHandler(this.pictGithub_Click); + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(661, 436); + this.Controls.Add(this.pictGithub); this.Controls.Add(this.btnSync); this.Controls.Add(this.btnSetting); this.Controls.Add(this.spinner); @@ -654,6 +670,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.btnSync)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.btnSetting)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.btnRun)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictGithub)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -701,5 +718,6 @@ private void InitializeComponent() private System.Windows.Forms.DataGridViewCheckBoxColumn bnotacr; private System.Windows.Forms.DataGridViewCheckBoxColumn bnotadb; private System.Windows.Forms.DataGridViewTextBoxColumn bestado; + private System.Windows.Forms.PictureBox pictGithub; } } \ No newline at end of file diff --git a/Homologador/MainForm.cs b/Homologador/MainForm.cs index 6068c6f..3e8af94 100644 --- a/Homologador/MainForm.cs +++ b/Homologador/MainForm.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; @@ -513,6 +514,11 @@ private void btnSync_Click(object sender, EventArgs e) Init(); } + private void pictGithub_Click(object sender, EventArgs e) + { + Process.Start(Resources.GibhubLinkProject); + } + #region Notas private async void menuNota_Click(object sender, EventArgs e) diff --git a/Homologador/Properties/Resources.Designer.cs b/Homologador/Properties/Resources.Designer.cs index 9e8699f..226c37a 100644 --- a/Homologador/Properties/Resources.Designer.cs +++ b/Homologador/Properties/Resources.Designer.cs @@ -89,6 +89,25 @@ internal static string FileFilterJson { } } + /// + /// Busca una cadena traducida similar a https://github.com/giansalex/homologadorSunat. + /// + internal static string GibhubLinkProject { + get { + return ResourceManager.GetString("GibhubLinkProject", resourceCulture); + } + } + + /// + /// Busca un recurso adaptado de tipo System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap github { + get { + object obj = ResourceManager.GetObject("github", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Busca un recurso adaptado de tipo System.Drawing.Bitmap. /// @@ -99,6 +118,69 @@ internal static System.Drawing.Bitmap play { } } + /// + /// Busca una cadena traducida similar a homologador_settings.json. + /// + internal static string SettingFilenamDefault { + get { + return ResourceManager.GetString("SettingFilenamDefault", resourceCulture); + } + } + + /// + /// Busca una cadena traducida similar a Pfx Files (*.pfx)|*.pfx. + /// + internal static string SettingFilterFilesPfx { + get { + return ResourceManager.GetString("SettingFilterFilesPfx", resourceCulture); + } + } + + /// + /// Busca una cadena traducida similar a No se pudo cargar la configuracion. + /// + internal static string SettingMsgLoadError { + get { + return ResourceManager.GetString("SettingMsgLoadError", resourceCulture); + } + } + + /// + /// Busca una cadena traducida similar a Configuración Cargada. + /// + internal static string SettingMsgLoadSuccess { + get { + return ResourceManager.GetString("SettingMsgLoadSuccess", resourceCulture); + } + } + + /// + /// Busca una cadena traducida similar a Configuracion Guardada. + /// + internal static string SettingMsgSaved { + get { + return ResourceManager.GetString("SettingMsgSaved", resourceCulture); + } + } + + /// + /// Busca una cadena traducida similar a Error. + /// + internal static string SettingTitleError { + get { + return ResourceManager.GetString("SettingTitleError", resourceCulture); + } + } + + /// + /// Busca una cadena traducida similar a Exito. + /// + internal static string SettingTitleSucces { + get { + return ResourceManager.GetString("SettingTitleSucces", resourceCulture); + } + } + /// /// Busca un recurso adaptado de tipo System.Drawing.Bitmap. /// diff --git a/Homologador/Properties/Resources.resx b/Homologador/Properties/Resources.resx index 9d1dfd0..838b51c 100644 --- a/Homologador/Properties/Resources.resx +++ b/Homologador/Properties/Resources.resx @@ -117,20 +117,47 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\Factura50.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + homologador_settings.json + ..\Resources\play.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\ajustes.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + Pfx Files (*.pfx)|*.pfx + + + Error + + + Configuración Cargada + + + Configuracion Guardada + + + Exito ..\Resources\Sincronizar.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Factura50.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + Json Files (*.json)|*.json|All Files (*.*)|*.* + + ..\Resources\ajustes.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + No se pudo cargar la configuracion + + + ..\Resources\github.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + https://github.com/giansalex/homologadorSunat + \ No newline at end of file diff --git a/Homologador/Resources/github.png b/Homologador/Resources/github.png new file mode 100644 index 0000000..4bc259d Binary files /dev/null and b/Homologador/Resources/github.png differ diff --git a/Third/formulario.png b/Third/formulario.png index 1ddca5c..ce4ea84 100644 Binary files a/Third/formulario.png and b/Third/formulario.png differ