Skip to content

Commit

Permalink
Main window
Browse files Browse the repository at this point in the history
  • Loading branch information
AjaxTheGod committed Dec 10, 2017
1 parent fcef4a2 commit b97b6b9
Show file tree
Hide file tree
Showing 10 changed files with 6,509 additions and 29 deletions.
15 changes: 13 additions & 2 deletions Hawkchat/Client/Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<HintPath>..\packages\SimpleTCP.1.0.24\lib\net45\SimpleTCP.dll</HintPath>
</Reference>
<Reference Include="SUF">
<HintPath>..\..\..\..\..\..\Documents\BUF\BUF\bin\Debug\SUF.dll</HintPath>
<HintPath>..\..\..\..\..\Desktop\SUF.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down Expand Up @@ -90,6 +90,12 @@
<Compile Include="LoginWindow.Designer.cs">
<DependentUpon>LoginWindow.cs</DependentUpon>
</Compile>
<Compile Include="MainWindow.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainWindow.Designer.cs">
<DependentUpon>MainWindow.cs</DependentUpon>
</Compile>
<Compile Include="models\ReportMessage.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand All @@ -106,6 +112,9 @@
<EmbeddedResource Include="LoginWindow.resx">
<DependentUpon>LoginWindow.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainWindow.resx">
<DependentUpon>MainWindow.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
Expand Down Expand Up @@ -133,6 +142,8 @@
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<None Include="Resources\test.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
46 changes: 26 additions & 20 deletions Hawkchat/Client/LoginWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ public LoginWindow()

}
}

public static SimpleTcpClient client;

private void btnLogin_Click(object sender, EventArgs e)
{

dynamic authJson = new JObject();

authJson.command = "AUTH";
Expand Down Expand Up @@ -80,31 +80,37 @@ private void btnLogin_Click(object sender, EventArgs e)
btnLogin.Enabled = false;
#endif

authJson = new JObject();
//authJson = new JObject();

//authJson.command = "REPORT";
//authJson.reporterid = ACCOUNTID.ToString();

//authJson.reportedid = "123456789";
//authJson.category = "SPAM";

authJson.command = "REPORT";
authJson.reporterid = ACCOUNTID.ToString();
//var helpfulMessages = new List<ReportMessage>();

authJson.reportedid = "123456789";
authJson.category = "SPAM";
//helpfulMessages.Add(new ReportMessage { Message = "This is a test2", Sender = "0987654321", Timestamp = "1512928834" });
//helpfulMessages.Add(new ReportMessage { Message = "This is a test", Sender = "123456789", Timestamp = "1512928821" });

var helpfulMessages = new List<ReportMessage>();
//string msgs = JsonConvert.SerializeObject(helpfulMessages);
//JArray jArray = JArray.Parse(msgs);

helpfulMessages.Add(new ReportMessage { Message = "This is a test2", Sender = "0987654321", Timestamp = "1512928834" });
helpfulMessages.Add(new ReportMessage { Message = "This is a test", Sender = "123456789", Timestamp = "1512928821" });
//Console.WriteLine(jArray.ToString());

string msgs = JsonConvert.SerializeObject(helpfulMessages);
JArray jArray = JArray.Parse(msgs);
//authJson.messages = jArray;

Console.WriteLine(jArray.ToString());
//client.WriteLine(authJson.ToString(Formatting.None));

authJson.messages = jArray;

client.WriteLine(authJson.ToString(Formatting.None));
//MessageBox.Show("Your report about this user has been sent. You will receive information once this matter has been resolved.", "Hawkchat", MessageBoxButtons.OK, MessageBoxIcon.Information);

MessageBox.Show("Your report about this user has been sent. You will receive information once this matter has been resolved.", "Hawkchat", MessageBoxButtons.OK, MessageBoxIcon.Information);
MainWindow mainWindow = new MainWindow();

} else
mainWindow.Show();
this.Hide();

}
else
{

string reason = returnedJson["reason"].ToString();
Expand All @@ -125,7 +131,7 @@ private void btnLogin_Click(object sender, EventArgs e)

bannedWindow.Show();
this.Hide();

break;

case "CREDENTIALS":
Expand Down Expand Up @@ -158,7 +164,7 @@ private void btnRegister_Click(object sender, EventArgs e)
{

RegisterForm registerForm = new RegisterForm();

registerForm.ShowDialog();

}
Expand Down
Loading

0 comments on commit b97b6b9

Please sign in to comment.