Skip to content

Commit

Permalink
Created Parent interface to concentrate various issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Cris Silva Jr committed Apr 15, 2018
1 parent 26735a1 commit 30319de
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 31 deletions.
6 changes: 3 additions & 3 deletions Assets/translation.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ID Language File Edit Help Quit Preferences Help Start Next Name Results Contact Finish Save Cancel Docs All
EN English File Edit Hep Quit Preferences Help Start Next Name Results saved Contact the test's applicator Finish Save Cancel Documentation Answer all questions
PT-BR Português Brasileiro Arquivo Editar Ajuda Sair Preferências Ajuda Sair Continuar Nome Resultados salvos com sucesso! Contate o aplicador do teste. Finalizar Salvar Cancelar Documentação Responda todas as perguntas.
ID Language File Edit Help Quit Preferences Help Start Next Name Results Contact Finish Save Cancel Docs All Instruct Data
EN English File Edit Hep Quit Preferences Help Start Next Name Results saved Contact the test's applicator Finish Save Cancel Documentation Answer all questions Click the button below to proceed Data
PT-BR Português Brasileiro Arquivo Editar Ajuda Sair Preferências Ajuda Sair Continuar Nome Resultados salvos com sucesso! Contate o aplicador do teste. Finalizar Salvar Cancelar Documentação Responda todas as perguntas. Aperte o botão abaixo para continuar. Dados
1 change: 1 addition & 0 deletions Scalemate/ScalemateForms/ScalemateForms.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
<Compile Include="View\FormResult.Designer.cs">
<DependentUpon>FormResult.cs</DependentUpon>
</Compile>
<Compile Include="View\IParent.cs" />
<Compile Include="View\Util\PreferenceManager.cs" />
<Compile Include="View\Util\TranslationManager.cs" />
<EmbeddedResource Include="View\FormDocs.resx">
Expand Down
4 changes: 2 additions & 2 deletions Scalemate/ScalemateForms/View/FormData.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions Scalemate/ScalemateForms/View/FormData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ public partial class FormData : Form
public bool Ended { get; set; }
public bool Completed { get; set; }
public string[] Survey { get; private set; }
private PreferenceManager Prefs;
private TranslationManager Translator;
private IParent Mother;

public FormData()
public FormData(IParent mother)
{
Prefs = new PreferenceManager();
Translator = new TranslationManager(Prefs.GetLanguage());
Mother = mother;
InitializeComponent();
WindowState = FormWindowState.Maximized;
Ended = false;
Expand All @@ -37,7 +35,7 @@ private void buttonContinue_Click(object sender, EventArgs e)
}
else
{
MessageBox.Show(Translator.Get("All"), "!!!");
MessageBox.Show(Mother.Get("All"), "!!!");
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Scalemate/ScalemateForms/View/FormInstructions.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions Scalemate/ScalemateForms/View/FormInstructions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
using ScalemateForms.Model;
using ScalemateForms.View.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
Expand All @@ -14,9 +16,11 @@ public partial class FormInstructions : Form
{
public bool Ended = false;
public bool Completed = false;
public IParent Mother;

public FormInstructions()
public FormInstructions(IParent mother)
{
Mother = mother;
InitializeComponent();
WindowState = FormWindowState.Maximized;
}
Expand Down
11 changes: 8 additions & 3 deletions Scalemate/ScalemateForms/View/FormInventory.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions Scalemate/ScalemateForms/View/FormInventory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
using System.Windows.Forms;
using System.Linq;
using Scalemate;
using ScalemateForms.View.Util;

namespace ScalemateForms.View
{
public partial class FormInventory : Form
public partial class FormInventory : Form, IParent
{
public Form Mother { get; set; }
public IParent Mother { get; set; }
public Tester Mate { get; private set; }
private int NoOptions { get; set; }
private int CurrentQuestion { get; set; }
Expand All @@ -20,8 +21,9 @@ public partial class FormInventory : Form
/// `Instruct()`before beginning to better interact with user.
/// </summary>
/// <param name="mate">A ScalemateForms controller to this test</param>
public FormInventory(Tester mate)
public FormInventory(IParent mother, Tester mate)
{
Mother = mother;
Mate = mate;
InitializeComponent();
}
Expand Down Expand Up @@ -77,8 +79,7 @@ private void buttonContinue_Click(object sender, EventArgs e)

private void ShowResults()
{
var form = new FormResult(Mate);
form.Mother = Mother;
var form = new FormResult(Mother, Mate);
form.Show();
this.Close();
}
Expand Down
10 changes: 7 additions & 3 deletions Scalemate/ScalemateForms/View/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace ScalemateForms.View
{
public partial class FormMain : Form
public partial class FormMain : Form, IParent
{
public string[] Tests { get; private set; }
public DataAccessLayer DAL { get; set; }
Expand Down Expand Up @@ -53,8 +53,7 @@ public FormMain()
private async void buttonStart_Click(object sender, EventArgs e)
{
Tester mate = new Tester(DAL, Tests[listKind.SelectedIndex], textPatient.Text);
FormInventory form = new FormInventory(mate);
form.Mother = this;
FormInventory form = new FormInventory(this, mate);

// Conduct survey
bool ok = await form.CollectInformation();
Expand Down Expand Up @@ -92,5 +91,10 @@ private void docsStripMenuItem_Click(object sender, EventArgs e)
FormDocs form = new FormDocs();
form.Show();
}

public string Get(string tag)
{
return Translator.Get(tag);
}
}
}
6 changes: 3 additions & 3 deletions Scalemate/ScalemateForms/View/FormResult.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions Scalemate/ScalemateForms/View/FormResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@
using System.Threading.Tasks;
using System.Windows.Forms;
using Scalemate;
using ScalemateForms.View.Util;

namespace ScalemateForms.View
{
public partial class FormResult : Form
{
public Form Mother { get; set; }
public IParent Mother { get; set; }
public Tester Mate { get; set; }

public FormResult(Tester mate)
public FormResult(IParent mother, Tester mate)
{
Mother = mother;
InitializeComponent();
WindowState = FormWindowState.Maximized;
Mate = mate;
Expand Down
15 changes: 15 additions & 0 deletions Scalemate/ScalemateForms/View/IParent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ScalemateForms.View
{
public interface IParent
{
void Show();
void Hide();
string Get(string tag);
}
}

0 comments on commit 30319de

Please sign in to comment.