Implemented First Currency Game - Stock Market

Reworked `GatewayService` To Use New Hub Command Set
Implemented User Directory
Changed Icon On Users Online Tab
This commit is contained in:
Alan Moon 2025-06-26 16:14:44 -07:00
parent 82c66aad44
commit eac4631e12
20 changed files with 1217 additions and 255 deletions

View File

@ -0,0 +1,8 @@
namespace QtCNETAPI.Dtos.User
{
public class UserStockActionResultDto
{
public int StockAmount { get; set; }
public int CurrencyAmount { get; set; }
}
}

View File

@ -13,6 +13,7 @@
public DateTime CreatedAt { get; set; }
public int Status { get; set; } = 0;
public int CurrencyAmount { get; set; } = 0;
public int StockAmount { get; set; } = 0;
public DateTime LastCurrencySpin { get; set; }
public virtual IEnumerable<RefreshToken>? RefreshTokens { get; }

View File

@ -3,6 +3,7 @@ using QtCNETAPI.Dtos.User;
using QtCNETAPI.Models;
using RestSharp;
using System.IdentityModel.Tokens.Jwt;
using System.Resources;
using System.Text.Json;
namespace QtCNETAPI.Services.ApiService
@ -56,6 +57,32 @@ namespace QtCNETAPI.Services.ApiService
return serviceResponse;
}
public async Task<ServiceResponse<List<UserInformationDto>>> GetAllUsersAsync()
{
await RefreshSessionIfInvalid();
var serviceResponse = new ServiceResponse<List<UserInformationDto>>();
if (SessionToken == null) throw new NullReferenceException("Function Was Called Before A Session Was Made.");
var request = new RestRequest("users/all")
.AddHeader("Authorization", $"Bearer {SessionToken}");
var response = await _client.GetAsync<ServiceResponse<List<UserInformationDto>>>(request);
if (response != null || response!.Data != null)
{
serviceResponse.Success = true;
serviceResponse.Data = response.Data;
}
else
{
serviceResponse.Success = false;
serviceResponse.Message = "API didn't respond with users.";
}
return serviceResponse;
}
public async Task<ServiceResponse<List<UserInformationDto>>> GetOnlineUsersAsync()
{
await RefreshSessionIfInvalid();
@ -566,5 +593,76 @@ namespace QtCNETAPI.Services.ApiService
return serviceResponse;
}
public async Task<ServiceResponse<int>> GetCurrentStockPrice()
{
await RefreshSessionIfInvalid();
var serviceResponse = new ServiceResponse<int>();
if (SessionToken == null) throw new NullReferenceException("Function Was Called Before A Session Was Made.");
var restRequest = new RestRequest("games/stock-market/current-price")
.AddHeader("Authorization", $"Bearer {SessionToken}");
var response = await _client.GetAsync<ServiceResponse<int>>(restRequest);
if (response == null) { serviceResponse.Success = false; serviceResponse.Message = "API did not respond."; return serviceResponse; }
if (response.Success)
{
serviceResponse.Success = true;
serviceResponse.Data = response.Data;
}
return serviceResponse;
}
public async Task<ServiceResponse<UserStockActionResultDto>> BuyStock(int amount)
{
await RefreshSessionIfInvalid();
var serviceResponse = new ServiceResponse<UserStockActionResultDto>();
if (SessionToken == null) throw new NullReferenceException("Function Was Called Before A Session Was Made.");
var restRequest = new RestRequest("games/stock-market/buy-stock")
.AddHeader("Authorization", $"Bearer {SessionToken}")
.AddQueryParameter("amount", amount);
var response = await _client.PostAsync<ServiceResponse<UserStockActionResultDto>>(restRequest);
if (response == null) { serviceResponse.Success = false; serviceResponse.Message = "API did not respond."; return serviceResponse; }
if (response.Success)
{
serviceResponse.Success = true;
serviceResponse.Data = response.Data;
}
return serviceResponse;
}
public async Task<ServiceResponse<UserStockActionResultDto>> SellStock(int amount)
{
await RefreshSessionIfInvalid();
var serviceResponse = new ServiceResponse<UserStockActionResultDto>();
if (SessionToken == null) throw new NullReferenceException("Function Was Called Before A Session Was Made.");
var restRequest = new RestRequest("games/stock-market/sell-stock")
.AddHeader("Authorization", $"Bearer {SessionToken}")
.AddQueryParameter("amount", amount);
var response = await _client.PostAsync<ServiceResponse<UserStockActionResultDto>>(restRequest);
if (response == null) { serviceResponse.Success = false; serviceResponse.Message = "API did not respond."; return serviceResponse; }
if (response.Success)
{
serviceResponse.Success = true;
serviceResponse.Data = response.Data;
}
return serviceResponse;
}
}
}

View File

@ -17,6 +17,7 @@ namespace QtCNETAPI.Services.ApiService
public Task<ServiceResponse<string>> PingServerAsync();
public Task<ServiceResponse<List<UserInformationDto>>> GetOnlineUsersAsync();
public Task<ServiceResponse<List<UserInformationDto>>> GetAllUsersAsync();
public Task<ServiceResponse<User>> LoginAsync(UserLoginDto userLoginDto);
public Task<ServiceResponse<User>> RefreshLogin(string refreshToken);
public Task<ServiceResponse<string>> RefreshSessionIfInvalid();
@ -33,5 +34,8 @@ namespace QtCNETAPI.Services.ApiService
public Task<ServiceResponse<bool>> AcceptContactRequest(string userId);
public Task<ServiceResponse<Contact>> RemoveContactFromCurrentUser(string userId);
public Task<ServiceResponse<int>> AddCurrencyToCurrentUser(int amount, bool isSpinClaim);
public Task<ServiceResponse<int>> GetCurrentStockPrice();
public Task<ServiceResponse<UserStockActionResultDto>> BuyStock(int amount);
public Task<ServiceResponse<UserStockActionResultDto>> SellStock(int amount);
}
}

View File

@ -15,7 +15,10 @@ namespace QtCNETAPI.Services.GatewayService
public HubConnection? HubConnection { get; private set; }
public event EventHandler OnServerMessageReceived;
public event EventHandler OnRoomMessageReceived;
public event EventHandler OnRefreshUserListReceived;
public event EventHandler OnRefreshRoomListReceived;
public event EventHandler OnRefreshContactsListReceived;
public event EventHandler OnClientFunctionReceived;
public event EventHandler OnDirectMessageReceived;
public event EventHandler OnServerConfigReceived;
@ -45,21 +48,25 @@ namespace QtCNETAPI.Services.GatewayService
});
HubConnection = gwConBuilder.Build();
// start connection
await HubConnection.StartAsync();
// register events
HubConnection.On<string>("rm", (serverMessage) => OnServerMessageReceived?.Invoke(this, new ServerMessageEventArgs{Message = serverMessage}));
HubConnection.On<string>("cf", (function) => OnClientFunctionReceived?.Invoke(this, new ClientFunctionEventArgs{Function = function}));
HubConnection.On<Message, UserInformationDto>("rdm", (message, user) => OnDirectMessageReceived?.Invoke(this, new DirectMessageEventArgs { Message = message, User = user }));
HubConnection.On<ServerConfig>("rc", (serverConfig) => OnServerConfigReceived?.Invoke(this, new ServerConfigEventArgs{ServerConfig = serverConfig}));
HubConnection.On<string>("RoomMessage", (serverMessage) => OnRoomMessageReceived?.Invoke(this, new ServerMessageEventArgs { Message = serverMessage }));
HubConnection.On<string>("cf", (function) => OnClientFunctionReceived?.Invoke(this, new ClientFunctionEventArgs { Function = function }));
HubConnection.On<Message, UserInformationDto>("ReceiveDirectMessage", (message, user) => OnDirectMessageReceived?.Invoke(this, new DirectMessageEventArgs { Message = message, User = user }));
HubConnection.On("RefreshUserList", () => OnRefreshUserListReceived?.Invoke(this, EventArgs.Empty));
HubConnection.On("RefreshRoomList", () => OnRefreshRoomListReceived?.Invoke(this, EventArgs.Empty));
HubConnection.On("RefreshContactsList", () => OnRefreshContactsListReceived?.Invoke(this, EventArgs.Empty));
HubConnection.On<ServerConfig>("ReceiveServerConfig", (serverConfig) => OnServerConfigReceived?.Invoke(this, new ServerConfigEventArgs { ServerConfig = serverConfig }));
HubConnection.Closed += HubConnection_Closed;
HubConnection.Reconnecting += HubConnection_Reconnecting;
HubConnection.Reconnected += HubConnection_Reconnected;
// start connection
await HubConnection.StartAsync();
if (HubConnection != null && HubConnection.State == HubConnectionState.Connected)
await HubConnection.SendAsync("l", _apiService.CurrentUser);
// send login hub method
await HubConnection.SendAsync("LoginHub", _apiService.CurrentUser);
}
public async Task StopAsync()
@ -87,7 +94,7 @@ namespace QtCNETAPI.Services.GatewayService
if (HubConnection == null || HubConnection.State != HubConnectionState.Connected) throw new InvalidOperationException("Function was called before connection was made.");
await HubConnection.SendAsync("jl", _apiService.CurrentUser);
await HubConnection.SendAsync("JoinLobby", _apiService.CurrentUser);
InLobby = true;
CurrentRoom = null;
}
@ -100,15 +107,15 @@ namespace QtCNETAPI.Services.GatewayService
if (InLobby == true)
{
await HubConnection.SendAsync("ll", _apiService.CurrentUser);
await HubConnection.SendAsync("LeaveLobby", _apiService.CurrentUser);
InLobby = false;
}
else if (CurrentRoom != null)
{
await HubConnection.SendAsync("lr", _apiService.CurrentUser, CurrentRoom);
await HubConnection.SendAsync("LeaveRoom", _apiService.CurrentUser, CurrentRoom);
}
await HubConnection.SendAsync("jr", _apiService.CurrentUser, room);
await HubConnection.SendAsync("JoinRoom", _apiService.CurrentUser, room);
CurrentRoom = room;
}
@ -120,12 +127,12 @@ namespace QtCNETAPI.Services.GatewayService
if (InLobby)
{
await HubConnection.SendAsync("ll", _apiService.CurrentUser);
await HubConnection.SendAsync("LeaveLobby", _apiService.CurrentUser);
InLobby = false;
}
else
{
await HubConnection.SendAsync("lr", _apiService.CurrentUser, CurrentRoom);
await HubConnection.SendAsync("LeaveRoom", _apiService.CurrentUser, CurrentRoom);
CurrentRoom = null;
}
}
@ -136,7 +143,7 @@ namespace QtCNETAPI.Services.GatewayService
if (HubConnection == null || HubConnection.State != HubConnectionState.Connected) throw new InvalidOperationException("Function was called before connection was made.");
await HubConnection.SendAsync("rcl", user, _apiService.CurrentUser);
await HubConnection.SendAsync("RefreshContactsListOnUser", user, _apiService.CurrentUser);
}
public async Task PostMessageAsync(Message message)
@ -145,7 +152,7 @@ namespace QtCNETAPI.Services.GatewayService
if (HubConnection == null || HubConnection.State != HubConnectionState.Connected) throw new InvalidOperationException("Function was called before connection was made.");
await HubConnection.SendAsync("s", _apiService.CurrentUser, message, InLobby, CurrentRoom);
await HubConnection.SendAsync("SendMessage", _apiService.CurrentUser, message, InLobby, CurrentRoom);
}
public async Task SendDirectMessageAsync(UserInformationDto user, Message message)
@ -154,7 +161,7 @@ namespace QtCNETAPI.Services.GatewayService
if (HubConnection == null || HubConnection.State != HubConnectionState.Connected) throw new InvalidOperationException("Function was called before connection was made.");
await HubConnection.SendAsync("sdm", _apiService.CurrentUser, user, message);
await HubConnection.SendAsync("SendDirectMessage", _apiService.CurrentUser, user, message);
}
public async Task UpdateStatus(int status)
@ -163,7 +170,7 @@ namespace QtCNETAPI.Services.GatewayService
if (HubConnection == null || HubConnection.State != HubConnectionState.Connected) throw new InvalidOperationException("Function was called before connection was made.");
await HubConnection.SendAsync("us", _apiService.CurrentUser, status);
await HubConnection.SendAsync("UpdateStatus", _apiService.CurrentUser, status);
}

View File

@ -103,9 +103,9 @@ namespace QtCNETAPI.Services.GatewayService
// EVENTS
/// <summary>
/// When A Server Message Is Received, This Event Fires
/// When A Room Message Is Received, This Event Fires
/// </summary>
public event EventHandler OnServerMessageReceived;
public event EventHandler OnRoomMessageReceived;
/// <summary>
/// When A Client Function/Event Is Received, This Event Fires
@ -117,6 +117,21 @@ namespace QtCNETAPI.Services.GatewayService
/// </summary>
public event EventHandler OnDirectMessageReceived;
/// <summary>
/// Fires When The Client Receives The Request To Refresh Its User List
/// </summary>
public event EventHandler OnRefreshUserListReceived;
/// <summary>
/// Fires When The Client Receives The Request To Refresh Its Room List
/// </summary>
public event EventHandler OnRefreshRoomListReceived;
/// <summary>
/// Fires When The Client Receives The Request To Refresh Its Contacts List
/// </summary>
public event EventHandler OnRefreshContactsListReceived;
/// <summary>
/// When The Server Config Is Received, This Event Fires
/// </summary>

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

View File

@ -32,6 +32,7 @@
rtxtChatbox = new RichTextBox();
btnSend = new Button();
rtxtChat = new RichTextBox();
lblRoomName = new Label();
SuspendLayout();
//
// rtxtChatbox
@ -58,19 +59,32 @@
// rtxtChat
//
rtxtChat.HideSelection = false;
rtxtChat.Location = new Point(12, 12);
rtxtChat.Location = new Point(12, 43);
rtxtChat.Name = "rtxtChat";
rtxtChat.ReadOnly = true;
rtxtChat.Size = new Size(593, 250);
rtxtChat.Size = new Size(593, 219);
rtxtChat.TabIndex = 3;
rtxtChat.Text = "";
//
// lblRoomName
//
lblRoomName.AutoSize = true;
lblRoomName.Font = new Font("Segoe UI", 25F, FontStyle.Bold | FontStyle.Italic);
lblRoomName.ForeColor = Color.White;
lblRoomName.Location = new Point(6, -4);
lblRoomName.Margin = new Padding(4, 0, 4, 0);
lblRoomName.Name = "lblRoomName";
lblRoomName.Size = new Size(113, 46);
lblRoomName.TabIndex = 8;
lblRoomName.Text = "Room";
//
// Chat
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
BackColor = Color.DodgerBlue;
ClientSize = new Size(617, 334);
Controls.Add(lblRoomName);
Controls.Add(rtxtChat);
Controls.Add(btnSend);
Controls.Add(rtxtChatbox);
@ -83,11 +97,13 @@
FormClosing += frmChat_FormClosing;
Load += frmChat_Load;
ResumeLayout(false);
PerformLayout();
}
#endregion
private RichTextBox rtxtChatbox;
private Button btnSend;
private RichTextBox rtxtChat;
private Label lblRoomName;
}
}

View File

@ -30,16 +30,16 @@ namespace qtc_net_client_2.Forms
private void frmChat_Load(object sender, EventArgs e)
{
// subscribe to server message event
_gatewayService.OnServerMessageReceived += _gatewayService_OnServerMessageReceived;
_gatewayService.OnRoomMessageReceived += _gatewayService_OnServerMessageReceived;
if (_gatewayService.CurrentRoom != null) Text = $"QtC.NET Client - Chat Room - {_gatewayService.CurrentRoom.Name}";
else if (_gatewayService.InLobby) Text = $"QtC.NET Client - Chat Room - Lobby";
if (_gatewayService.CurrentRoom != null) { Text = $"QtC.NET Client - Chat Room - {_gatewayService.CurrentRoom.Name}"; lblRoomName.Text = _gatewayService.CurrentRoom.Name; }
else if (_gatewayService.InLobby) { Text = $"QtC.NET Client - Chat Room - Lobby"; lblRoomName.Text = "Lobby"; }
}
private async void frmChat_FormClosing(object sender, FormClosingEventArgs e)
{
// unsubscribe from server message event
_gatewayService.OnServerMessageReceived -= _gatewayService_OnServerMessageReceived;
_gatewayService.OnRoomMessageReceived -= _gatewayService_OnServerMessageReceived;
if (_gatewayService.CurrentRoom != null || _gatewayService.InLobby)
{

View File

@ -38,11 +38,11 @@
// rtxtChat
//
rtxtChat.HideSelection = false;
rtxtChat.Location = new Point(12, 56);
rtxtChat.Location = new Point(12, 48);
rtxtChat.Margin = new Padding(4, 3, 4, 3);
rtxtChat.Name = "rtxtChat";
rtxtChat.ReadOnly = true;
rtxtChat.Size = new Size(593, 317);
rtxtChat.Size = new Size(593, 325);
rtxtChat.TabIndex = 6;
rtxtChat.Text = "";
//
@ -74,7 +74,7 @@
//
lblUsername.AutoSize = true;
lblUsername.Font = new Font("Segoe UI", 25F, FontStyle.Bold | FontStyle.Italic);
lblUsername.Location = new Point(6, 7);
lblUsername.Location = new Point(6, 0);
lblUsername.Margin = new Padding(4, 0, 4, 0);
lblUsername.Name = "lblUsername";
lblUsername.Size = new Size(181, 46);
@ -86,7 +86,7 @@
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
BackColor = Color.DodgerBlue;
ClientSize = new Size(618, 450);
ClientSize = new Size(618, 443);
Controls.Add(lblUsername);
Controls.Add(rtxtChat);
Controls.Add(btnSend);

View File

@ -51,14 +51,14 @@ namespace qtc_net_client_2.Forms
private async void btnSend_Click(object sender, EventArgs e)
{
if (InvokeRequired)
if (rtxtChatbox.InvokeRequired)
{
await Invoke(async delegate ()
await rtxtChatbox.Invoke(async delegate ()
{
if (!string.IsNullOrEmpty(rtxtChatbox.Text))
{
await _gatewayService.SendDirectMessageAsync(User, new QtCNETAPI.Models.Message { Content = rtxtChatbox.Text, AuthorId = _apiService.CurrentUser.Id });
Messages.Add($"[{_apiService.CurrentUser.Username}] {rtxtChatbox.Text}\n");
Messages.Add($"[{_apiService.CurrentUser.Username}] {rtxtChatbox.Text}");
rtxtChatbox.Clear();
AudioService.PlaySoundEffect("sndSendClick");
}
@ -69,8 +69,8 @@ namespace qtc_net_client_2.Forms
if (!string.IsNullOrEmpty(rtxtChatbox.Text))
{
await _gatewayService.SendDirectMessageAsync(User, new QtCNETAPI.Models.Message { Content = rtxtChatbox.Text, AuthorId = _apiService.CurrentUser.Id });
BeginInvoke(delegate () { Messages.Add($"[{_apiService.CurrentUser.Username}] {rtxtChatbox.Text}\n"); });
BeginInvoke(delegate () { rtxtChatbox.Clear(); });
Messages.Add($"[{_apiService.CurrentUser.Username}] {rtxtChatbox.Text}");
rtxtChatbox.Clear();
AudioService.PlaySoundEffect("sndSendClick");
}
}

View File

@ -29,52 +29,67 @@
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
ListViewItem listViewItem1 = new ListViewItem("Stock Market", 0);
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Main));
tbcMain = new TabControl();
tbpContacts = new TabPage();
lvContacts = new ListView();
ilProfilePics = new ImageList(components);
tbpRooms = new TabPage();
btnAddRoom = new Button();
lbRooms = new ListBox();
tbpOnlineUsers = new TabPage();
lbOnlineUsers = new ListBox();
tbpUserDirectory = new TabPage();
lbUserDirectory = new ListBox();
tbpGames = new TabPage();
lvGames = new ListView();
ilGames = new ImageList(components);
ilTabIcons = new ImageList(components);
pbUserPfp = new PictureBox();
ctxmChangeStatus = new ContextMenuStrip(components);
onlineToolStripMenuItem = new ToolStripMenuItem();
awayToolStripMenuItem = new ToolStripMenuItem();
doNotDisturbToolStripMenuItem = new ToolStripMenuItem();
invisibleToolStripMenuItem = new ToolStripMenuItem();
lblWelcome = new Label();
llblSignIn = new LinkLabel();
llblSignOut = new LinkLabel();
llblEditProfile = new LinkLabel();
lblRequestNotif = new Label();
niMain = new NotifyIcon(components);
btnAddRoom = new Button();
llblClaimSpin = new LinkLabel();
pCurrencyArea = new Panel();
pbCurrencyIcon = new PictureBox();
lblCurrencyAmount = new Label();
llblClaimSpin = new LinkLabel();
pCurrentUser = new Panel();
llblEditProfile = new LinkLabel();
llblSignOut = new LinkLabel();
llblSignIn = new LinkLabel();
lblWelcome = new Label();
pbUserPfp = new PictureBox();
tbcMain.SuspendLayout();
tbpContacts.SuspendLayout();
tbpRooms.SuspendLayout();
tbpOnlineUsers.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pbUserPfp).BeginInit();
tbpUserDirectory.SuspendLayout();
tbpGames.SuspendLayout();
ctxmChangeStatus.SuspendLayout();
pCurrencyArea.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pbCurrencyIcon).BeginInit();
pCurrentUser.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pbUserPfp).BeginInit();
SuspendLayout();
//
// tbcMain
//
tbcMain.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
tbcMain.Controls.Add(tbpContacts);
tbcMain.Controls.Add(tbpRooms);
tbcMain.Controls.Add(tbpOnlineUsers);
tbcMain.Controls.Add(tbpUserDirectory);
tbcMain.Controls.Add(tbpGames);
tbcMain.Enabled = false;
tbcMain.ImageList = ilTabIcons;
tbcMain.Location = new Point(12, 66);
tbcMain.Name = "tbcMain";
tbcMain.SelectedIndex = 0;
tbcMain.Size = new Size(258, 535);
tbcMain.Size = new Size(439, 535);
tbcMain.TabIndex = 0;
//
// tbpContacts
@ -84,18 +99,19 @@
tbpContacts.Location = new Point(4, 24);
tbpContacts.Name = "tbpContacts";
tbpContacts.Padding = new Padding(3);
tbpContacts.Size = new Size(250, 507);
tbpContacts.Size = new Size(431, 507);
tbpContacts.TabIndex = 0;
tbpContacts.Text = "Contacts";
tbpContacts.UseVisualStyleBackColor = true;
//
// lvContacts
//
lvContacts.Anchor = AnchorStyles.Left | AnchorStyles.Right;
lvContacts.LargeImageList = ilProfilePics;
lvContacts.Location = new Point(0, 0);
lvContacts.MultiSelect = false;
lvContacts.Name = "lvContacts";
lvContacts.Size = new Size(250, 507);
lvContacts.Size = new Size(431, 514);
lvContacts.SmallImageList = ilProfilePics;
lvContacts.TabIndex = 1;
lvContacts.UseCompatibleStateImageBehavior = false;
@ -110,68 +126,126 @@
//
// tbpRooms
//
tbpRooms.Controls.Add(btnAddRoom);
tbpRooms.Controls.Add(lbRooms);
tbpRooms.ImageKey = "RoomsChatIcon.png";
tbpRooms.Location = new Point(4, 24);
tbpRooms.Name = "tbpRooms";
tbpRooms.Padding = new Padding(3);
tbpRooms.Size = new Size(250, 507);
tbpRooms.Size = new Size(431, 507);
tbpRooms.TabIndex = 1;
tbpRooms.Text = "Rooms";
tbpRooms.UseVisualStyleBackColor = true;
//
// btnAddRoom
//
btnAddRoom.FlatAppearance.BorderSize = 0;
btnAddRoom.FlatStyle = FlatStyle.Flat;
btnAddRoom.Location = new Point(342, 485);
btnAddRoom.Name = "btnAddRoom";
btnAddRoom.Size = new Size(20, 22);
btnAddRoom.TabIndex = 7;
btnAddRoom.UseVisualStyleBackColor = true;
btnAddRoom.Click += btnAddRoom_Click;
//
// lbRooms
//
lbRooms.Anchor = AnchorStyles.Left | AnchorStyles.Right;
lbRooms.FormattingEnabled = true;
lbRooms.ItemHeight = 15;
lbRooms.Location = new Point(0, 0);
lbRooms.Name = "lbRooms";
lbRooms.Size = new Size(250, 514);
lbRooms.Size = new Size(431, 514);
lbRooms.TabIndex = 0;
lbRooms.DoubleClick += lbRooms_DoubleClick;
//
// tbpOnlineUsers
//
tbpOnlineUsers.Controls.Add(lbOnlineUsers);
tbpOnlineUsers.ImageIndex = 0;
tbpOnlineUsers.ImageIndex = 1;
tbpOnlineUsers.Location = new Point(4, 24);
tbpOnlineUsers.Name = "tbpOnlineUsers";
tbpOnlineUsers.Padding = new Padding(3);
tbpOnlineUsers.Size = new Size(250, 507);
tbpOnlineUsers.Size = new Size(431, 507);
tbpOnlineUsers.TabIndex = 2;
tbpOnlineUsers.Text = "Online Users";
tbpOnlineUsers.UseVisualStyleBackColor = true;
//
// lbOnlineUsers
//
lbOnlineUsers.Anchor = AnchorStyles.Left | AnchorStyles.Right;
lbOnlineUsers.FormattingEnabled = true;
lbOnlineUsers.ItemHeight = 15;
lbOnlineUsers.Location = new Point(0, 0);
lbOnlineUsers.Name = "lbOnlineUsers";
lbOnlineUsers.Size = new Size(250, 514);
lbOnlineUsers.Size = new Size(431, 514);
lbOnlineUsers.TabIndex = 0;
lbOnlineUsers.DoubleClick += lbOnlineUsers_DoubleClick;
//
// tbpUserDirectory
//
tbpUserDirectory.Controls.Add(lbUserDirectory);
tbpUserDirectory.ImageIndex = 1;
tbpUserDirectory.Location = new Point(4, 24);
tbpUserDirectory.Name = "tbpUserDirectory";
tbpUserDirectory.Size = new Size(431, 507);
tbpUserDirectory.TabIndex = 3;
tbpUserDirectory.Text = "User Directory";
tbpUserDirectory.UseVisualStyleBackColor = true;
//
// lbUserDirectory
//
lbUserDirectory.Anchor = AnchorStyles.Left | AnchorStyles.Right;
lbUserDirectory.FormattingEnabled = true;
lbUserDirectory.ItemHeight = 15;
lbUserDirectory.Location = new Point(0, 0);
lbUserDirectory.Name = "lbUserDirectory";
lbUserDirectory.Size = new Size(431, 514);
lbUserDirectory.TabIndex = 1;
lbUserDirectory.DoubleClick += lbUserDirectory_DoubleClick;
//
// tbpGames
//
tbpGames.Controls.Add(lvGames);
tbpGames.ImageIndex = 3;
tbpGames.Location = new Point(4, 24);
tbpGames.Name = "tbpGames";
tbpGames.Size = new Size(431, 507);
tbpGames.TabIndex = 4;
tbpGames.Text = "Games";
tbpGames.UseVisualStyleBackColor = true;
//
// lvGames
//
lvGames.Anchor = AnchorStyles.Left | AnchorStyles.Right;
listViewItem1.Tag = "StockMarketGame";
lvGames.Items.AddRange(new ListViewItem[] { listViewItem1 });
lvGames.LargeImageList = ilGames;
lvGames.Location = new Point(0, 0);
lvGames.MultiSelect = false;
lvGames.Name = "lvGames";
lvGames.Size = new Size(431, 514);
lvGames.SmallImageList = ilGames;
lvGames.TabIndex = 2;
lvGames.UseCompatibleStateImageBehavior = false;
lvGames.DoubleClick += lvGames_DoubleClick;
//
// ilGames
//
ilGames.ColorDepth = ColorDepth.Depth32Bit;
ilGames.ImageStream = (ImageListStreamer)resources.GetObject("ilGames.ImageStream");
ilGames.TransparentColor = Color.Transparent;
ilGames.Images.SetKeyName(0, "dollar-money.gif");
//
// ilTabIcons
//
ilTabIcons.ColorDepth = ColorDepth.Depth32Bit;
ilTabIcons.ImageStream = (ImageListStreamer)resources.GetObject("ilTabIcons.ImageStream");
ilTabIcons.TransparentColor = Color.Transparent;
ilTabIcons.Images.SetKeyName(0, "ContactsIcon.png");
ilTabIcons.Images.SetKeyName(1, "RoomsChatIcon.png");
//
// pbUserPfp
//
pbUserPfp.BorderStyle = BorderStyle.FixedSingle;
pbUserPfp.ContextMenuStrip = ctxmChangeStatus;
pbUserPfp.Image = Properties.Resources.DefaultPfp;
pbUserPfp.Location = new Point(12, 10);
pbUserPfp.Name = "pbUserPfp";
pbUserPfp.Size = new Size(51, 50);
pbUserPfp.SizeMode = PictureBoxSizeMode.StretchImage;
pbUserPfp.TabIndex = 1;
pbUserPfp.TabStop = false;
pbUserPfp.Click += pbUserPfp_Click;
ilTabIcons.Images.SetKeyName(1, "UserIcon.png");
ilTabIcons.Images.SetKeyName(2, "RoomsChatIcon.png");
ilTabIcons.Images.SetKeyName(3, "CurrencyIcon.png");
//
// ctxmChangeStatus
//
@ -208,63 +282,12 @@
invisibleToolStripMenuItem.Size = new Size(153, 22);
invisibleToolStripMenuItem.Text = "Invisible";
//
// lblWelcome
//
lblWelcome.AutoSize = true;
lblWelcome.Font = new Font("Segoe UI Light", 9F);
lblWelcome.ForeColor = SystemColors.ControlLightLight;
lblWelcome.Location = new Point(65, 17);
lblWelcome.Name = "lblWelcome";
lblWelcome.Size = new Size(60, 15);
lblWelcome.TabIndex = 2;
lblWelcome.Text = "Welcome, ";
//
// llblSignIn
//
llblSignIn.AutoSize = true;
llblSignIn.Font = new Font("Segoe UI Light", 9F);
llblSignIn.LinkColor = Color.White;
llblSignIn.Location = new Point(118, 17);
llblSignIn.Name = "llblSignIn";
llblSignIn.Size = new Size(40, 15);
llblSignIn.TabIndex = 3;
llblSignIn.TabStop = true;
llblSignIn.Text = "Sign In";
llblSignIn.LinkClicked += llblSignIn_LinkClicked;
//
// llblSignOut
//
llblSignOut.AutoSize = true;
llblSignOut.Font = new Font("Segoe UI Light", 9F);
llblSignOut.LinkColor = Color.White;
llblSignOut.Location = new Point(65, 35);
llblSignOut.Name = "llblSignOut";
llblSignOut.Size = new Size(50, 15);
llblSignOut.TabIndex = 4;
llblSignOut.TabStop = true;
llblSignOut.Text = "Sign Out";
llblSignOut.Visible = false;
llblSignOut.LinkClicked += llblSignOut_LinkClicked;
//
// llblEditProfile
//
llblEditProfile.AutoSize = true;
llblEditProfile.Font = new Font("Segoe UI Light", 9F);
llblEditProfile.LinkColor = Color.White;
llblEditProfile.Location = new Point(113, 35);
llblEditProfile.Name = "llblEditProfile";
llblEditProfile.Size = new Size(60, 15);
llblEditProfile.TabIndex = 5;
llblEditProfile.TabStop = true;
llblEditProfile.Text = "Edit Profile";
llblEditProfile.Visible = false;
llblEditProfile.LinkClicked += llblEditProfile_LinkClicked;
//
// lblRequestNotif
//
lblRequestNotif.Anchor = AnchorStyles.Top | AnchorStyles.Right;
lblRequestNotif.AutoSize = true;
lblRequestNotif.Font = new Font("Segoe UI", 7F, FontStyle.Bold);
lblRequestNotif.Location = new Point(128, 54);
lblRequestNotif.Location = new Point(309, 54);
lblRequestNotif.Name = "lblRequestNotif";
lblRequestNotif.Size = new Size(138, 12);
lblRequestNotif.TabIndex = 6;
@ -277,48 +300,11 @@
niMain.Text = "QtC.NET Client";
niMain.DoubleClick += niMain_DoubleClick;
//
// btnAddRoom
//
btnAddRoom.FlatAppearance.BorderSize = 0;
btnAddRoom.FlatStyle = FlatStyle.Flat;
btnAddRoom.Location = new Point(260, 1);
btnAddRoom.Name = "btnAddRoom";
btnAddRoom.Size = new Size(20, 22);
btnAddRoom.TabIndex = 7;
btnAddRoom.UseVisualStyleBackColor = true;
btnAddRoom.Click += btnAddRoom_Click;
//
// pbCurrencyIcon
//
pbCurrencyIcon.Image = Properties.Resources.CurrencyIcon;
pbCurrencyIcon.Location = new Point(223, 5);
pbCurrencyIcon.Name = "pbCurrencyIcon";
pbCurrencyIcon.Size = new Size(15, 14);
pbCurrencyIcon.SizeMode = PictureBoxSizeMode.StretchImage;
pbCurrencyIcon.TabIndex = 9;
pbCurrencyIcon.TabStop = false;
pbCurrencyIcon.Visible = false;
//
// lblCurrencyAmount
//
lblCurrencyAmount.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
lblCurrencyAmount.AutoSize = true;
lblCurrencyAmount.BackColor = Color.Transparent;
lblCurrencyAmount.Font = new Font("Segoe UI", 9F, FontStyle.Bold);
lblCurrencyAmount.ForeColor = Color.White;
lblCurrencyAmount.Location = new Point(239, 5);
lblCurrencyAmount.Name = "lblCurrencyAmount";
lblCurrencyAmount.Size = new Size(14, 15);
lblCurrencyAmount.TabIndex = 10;
lblCurrencyAmount.Text = "0";
lblCurrencyAmount.TextAlign = ContentAlignment.MiddleCenter;
lblCurrencyAmount.Visible = false;
//
// llblClaimSpin
//
llblClaimSpin.AutoSize = true;
llblClaimSpin.Font = new Font("Segoe UI", 9F, FontStyle.Bold);
llblClaimSpin.Location = new Point(185, 35);
llblClaimSpin.Location = new Point(12, 24);
llblClaimSpin.Name = "llblClaimSpin";
llblClaimSpin.Size = new Size(94, 15);
llblClaimSpin.TabIndex = 11;
@ -327,22 +313,125 @@
llblClaimSpin.Visible = false;
llblClaimSpin.LinkClicked += llblClaimSpin_LinkClicked;
//
// pCurrencyArea
//
pCurrencyArea.Anchor = AnchorStyles.Top | AnchorStyles.Right;
pCurrencyArea.BorderStyle = BorderStyle.FixedSingle;
pCurrencyArea.Controls.Add(llblClaimSpin);
pCurrencyArea.Controls.Add(pbCurrencyIcon);
pCurrencyArea.Controls.Add(lblCurrencyAmount);
pCurrencyArea.Location = new Point(336, 5);
pCurrencyArea.Name = "pCurrencyArea";
pCurrencyArea.Size = new Size(116, 46);
pCurrencyArea.TabIndex = 12;
//
// pbCurrencyIcon
//
pbCurrencyIcon.Image = Properties.Resources.CurrencyIcon;
pbCurrencyIcon.Location = new Point(33, 6);
pbCurrencyIcon.Name = "pbCurrencyIcon";
pbCurrencyIcon.Size = new Size(15, 14);
pbCurrencyIcon.SizeMode = PictureBoxSizeMode.StretchImage;
pbCurrencyIcon.TabIndex = 18;
pbCurrencyIcon.TabStop = false;
pbCurrencyIcon.Visible = false;
//
// lblCurrencyAmount
//
lblCurrencyAmount.BackColor = Color.Transparent;
lblCurrencyAmount.Font = new Font("Segoe UI", 9F, FontStyle.Bold);
lblCurrencyAmount.ForeColor = Color.White;
lblCurrencyAmount.Location = new Point(48, 3);
lblCurrencyAmount.Name = "lblCurrencyAmount";
lblCurrencyAmount.Size = new Size(69, 20);
lblCurrencyAmount.TabIndex = 19;
lblCurrencyAmount.Text = "99999";
lblCurrencyAmount.TextAlign = ContentAlignment.MiddleLeft;
lblCurrencyAmount.Visible = false;
//
// pCurrentUser
//
pCurrentUser.BorderStyle = BorderStyle.FixedSingle;
pCurrentUser.Controls.Add(llblEditProfile);
pCurrentUser.Controls.Add(llblSignOut);
pCurrentUser.Controls.Add(llblSignIn);
pCurrentUser.Controls.Add(lblWelcome);
pCurrentUser.Controls.Add(pbUserPfp);
pCurrentUser.Location = new Point(5, 4);
pCurrentUser.Name = "pCurrentUser";
pCurrentUser.Size = new Size(298, 59);
pCurrentUser.TabIndex = 13;
//
// llblEditProfile
//
llblEditProfile.AutoSize = true;
llblEditProfile.Font = new Font("Segoe UI Light", 9F);
llblEditProfile.LinkColor = Color.White;
llblEditProfile.Location = new Point(104, 29);
llblEditProfile.Name = "llblEditProfile";
llblEditProfile.Size = new Size(60, 15);
llblEditProfile.TabIndex = 10;
llblEditProfile.TabStop = true;
llblEditProfile.Text = "Edit Profile";
llblEditProfile.Visible = false;
//
// llblSignOut
//
llblSignOut.AutoSize = true;
llblSignOut.Font = new Font("Segoe UI Light", 9F);
llblSignOut.LinkColor = Color.White;
llblSignOut.Location = new Point(56, 29);
llblSignOut.Name = "llblSignOut";
llblSignOut.Size = new Size(50, 15);
llblSignOut.TabIndex = 9;
llblSignOut.TabStop = true;
llblSignOut.Text = "Sign Out";
llblSignOut.Visible = false;
//
// llblSignIn
//
llblSignIn.AutoSize = true;
llblSignIn.Font = new Font("Segoe UI Light", 9F);
llblSignIn.LinkColor = Color.White;
llblSignIn.Location = new Point(109, 11);
llblSignIn.Name = "llblSignIn";
llblSignIn.Size = new Size(40, 15);
llblSignIn.TabIndex = 8;
llblSignIn.TabStop = true;
llblSignIn.Text = "Sign In";
//
// lblWelcome
//
lblWelcome.AutoSize = true;
lblWelcome.Font = new Font("Segoe UI Light", 9F);
lblWelcome.ForeColor = SystemColors.ControlLightLight;
lblWelcome.Location = new Point(56, 11);
lblWelcome.Name = "lblWelcome";
lblWelcome.Size = new Size(60, 15);
lblWelcome.TabIndex = 7;
lblWelcome.Text = "Welcome, ";
//
// pbUserPfp
//
pbUserPfp.BorderStyle = BorderStyle.FixedSingle;
pbUserPfp.ContextMenuStrip = ctxmChangeStatus;
pbUserPfp.Image = Properties.Resources.DefaultPfp;
pbUserPfp.Location = new Point(3, 4);
pbUserPfp.Name = "pbUserPfp";
pbUserPfp.Size = new Size(51, 50);
pbUserPfp.SizeMode = PictureBoxSizeMode.StretchImage;
pbUserPfp.TabIndex = 6;
pbUserPfp.TabStop = false;
//
// Main
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
BackColor = Color.DodgerBlue;
ClientSize = new Size(282, 613);
Controls.Add(llblClaimSpin);
Controls.Add(pbCurrencyIcon);
Controls.Add(lblCurrencyAmount);
Controls.Add(btnAddRoom);
ClientSize = new Size(463, 613);
Controls.Add(pCurrentUser);
Controls.Add(pCurrencyArea);
Controls.Add(lblRequestNotif);
Controls.Add(llblEditProfile);
Controls.Add(llblSignOut);
Controls.Add(llblSignIn);
Controls.Add(lblWelcome);
Controls.Add(pbUserPfp);
Controls.Add(tbcMain);
FormBorderStyle = FormBorderStyle.FixedDialog;
Icon = (Icon)resources.GetObject("$this.Icon");
@ -357,9 +446,15 @@
tbpContacts.ResumeLayout(false);
tbpRooms.ResumeLayout(false);
tbpOnlineUsers.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)pbUserPfp).EndInit();
tbpUserDirectory.ResumeLayout(false);
tbpGames.ResumeLayout(false);
ctxmChangeStatus.ResumeLayout(false);
pCurrencyArea.ResumeLayout(false);
pCurrencyArea.PerformLayout();
((System.ComponentModel.ISupportInitialize)pbCurrencyIcon).EndInit();
pCurrentUser.ResumeLayout(false);
pCurrentUser.PerformLayout();
((System.ComponentModel.ISupportInitialize)pbUserPfp).EndInit();
ResumeLayout(false);
PerformLayout();
}
@ -370,13 +465,8 @@
private TabPage tbpContacts;
private TabPage tbpRooms;
private ListBox lbRooms;
private PictureBox pbUserPfp;
private Label lblWelcome;
private LinkLabel llblSignIn;
private LinkLabel llblSignOut;
private TabPage tbpOnlineUsers;
private ListBox lbOnlineUsers;
private LinkLabel llblEditProfile;
private Label lblRequestNotif;
private ListView lvContacts;
private ImageList ilProfilePics;
@ -388,8 +478,20 @@
private ToolStripMenuItem doNotDisturbToolStripMenuItem;
private ToolStripMenuItem invisibleToolStripMenuItem;
private Button btnAddRoom;
private LinkLabel llblClaimSpin;
private TabPage tbpUserDirectory;
private ListBox lbUserDirectory;
private Panel pCurrencyArea;
private Panel pCurrentUser;
private LinkLabel llblEditProfile;
private LinkLabel llblSignOut;
private LinkLabel llblSignIn;
private Label lblWelcome;
private PictureBox pbUserPfp;
private TabPage tbpGames;
private ListView lvGames;
private ImageList ilGames;
private PictureBox pbCurrencyIcon;
private Label lblCurrencyAmount;
private LinkLabel llblClaimSpin;
}
}

View File

@ -18,6 +18,7 @@ namespace qtc_net_client_2
private List<Room> RoomList = [];
private List<UserInformationDto> OnlineUsers = [];
private List<UserInformationDto> UserDirectory = [];
private List<UserInformationDto> Contacts = [];
private bool FirstMinimize = true;
@ -193,21 +194,15 @@ namespace qtc_net_client_2
}
}
private async void btnRefresh_Click(object sender, EventArgs e)
{
// refresh all
await RefreshContactsList();
await RefreshRoomsList();
await RefreshOnlineUsersList();
}
private void frmMain_Resize(object sender, EventArgs e)
{
if (WindowState == FormWindowState.Minimized && _config.MinimizeToTray)
{
Hide();
niMain.Visible = true;
if (FirstMinimize) { niMain.ShowBalloonTip(10,
if (FirstMinimize)
{
niMain.ShowBalloonTip(10,
"I'm over here!",
"QtC.NET Mimimizes To Tray By Default. To Change This Behaviour, Refer To config.json",
ToolTipIcon.Info);
@ -298,6 +293,44 @@ namespace qtc_net_client_2
}
}
private async void lbUserDirectory_DoubleClick(object sender, EventArgs e)
{
if (lbUserDirectory.SelectedItems.Count > 0)
{
string? selectedUser = (string?)lbUserDirectory.SelectedItems[lbUserDirectory.SelectedItems.Count - 1];
if (selectedUser != null)
{
// get user info and open profile dialog
var user = UserDirectory.FirstOrDefault(e => e.Username == selectedUser);
var res = await _apiService.GetUserInformationAsync(user!.Id);
var pfpRes = await _apiService.GetUserProfilePic(user!.Id);
if (res.Data != null && res.Success)
{
Profile frmProfile = new Profile(res.Data, pfpRes, _apiService, _gatewayService);
frmProfile.ShowDialog();
}
}
}
}
private void lvGames_DoubleClick(object sender, EventArgs e)
{
if (lvGames.SelectedItems.Count > 0)
{
string? gameSelected = (string?)lvGames.SelectedItems[lvGames.SelectedItems.Count - 1].Tag;
switch (gameSelected)
{
case "StockMarketGame":
StockMarketGame stockMarketGame = new StockMarketGame(_apiService);
stockMarketGame.Show();
break;
}
}
}
private async Task OnSuccessfulLogin()
{
// double check
@ -310,8 +343,10 @@ namespace qtc_net_client_2
_gatewayService.OnServerReconnecting += _gatewayService_OnServerReconnecting;
_gatewayService.OnServerReconnected += _gatewayService_OnServerReconnected;
_gatewayService.OnServerDisconnect += _gatewayService_OnServerDisconnect;
_gatewayService.OnClientFunctionReceived += _gatewayService_OnClientFunctionReceived;
_gatewayService.OnDirectMessageReceived += _gatewayService_OnDirectMessageReceived;
_gatewayService.OnRefreshUserListReceived += _gatewayService_OnRefreshUserListReceived;
_gatewayService.OnRefreshRoomListReceived += _gatewayService_OnRefreshRoomListReceived;
_gatewayService.OnRefreshContactsListReceived += _gatewayService_OnRefreshContactsListReceived;
_gatewayService.OnServerConfigReceived += _gatewayService_OnServerConfigReceived;
if (_gatewayService.HubConnection != null && _gatewayService.HubConnection.State == Microsoft.AspNetCore.SignalR.Client.HubConnectionState.Connected)
@ -339,6 +374,7 @@ namespace qtc_net_client_2
await RefreshContactsList();
await RefreshRoomsList();
await RefreshOnlineUsersList();
await RefreshUserDirectory();
// TODO - figure out server side why online status is invisible on login
_apiService.CurrentUser.Status = 1;
@ -380,7 +416,7 @@ namespace qtc_net_client_2
if (current > _apiService.CurrentUser.LastCurrencySpin.ToUniversalTime() || _apiService.CurrentUser.LastCurrencySpin == new DateTime()) llblClaimSpin.Visible = true;
else llblClaimSpin.Visible = false;
if(_config.StartMinimized) WindowState = FormWindowState.Minimized;
if (_config.StartMinimized) WindowState = FormWindowState.Minimized;
}
}
}
@ -418,6 +454,34 @@ namespace qtc_net_client_2
}
}
private async Task RefreshUserDirectory()
{
// get all users on server
var userList = await _apiService.GetAllUsersAsync();
if (userList != null && userList.Success && userList.Data != null)
{
// clear the list
if (lbUserDirectory.InvokeRequired) lbUserDirectory.BeginInvoke(lbUserDirectory.Items.Clear);
else lbUserDirectory.Items.Clear();
UserDirectory.Clear();
// populate list
foreach (var user in userList.Data)
{
if (lbUserDirectory.InvokeRequired)
{
lbUserDirectory.BeginInvoke(delegate () { lbUserDirectory.Items.Add(user.Username); });
}
else
{
lbUserDirectory.Items.Add(user.Username);
}
UserDirectory.Add(user);
}
}
}
private async Task RefreshRoomsList()
{
if (InvokeRequired)
@ -622,6 +686,20 @@ namespace qtc_net_client_2
}
}
public void RefreshCurrencyCounter()
{
if (lblCurrencyAmount.InvokeRequired)
{
lblCurrencyAmount.BeginInvoke(delegate ()
{
lblCurrencyAmount.Text = _apiService.CurrentUser.CurrencyAmount.ToString();
});
} else
{
lblCurrencyAmount.Text = _apiService.CurrentUser.CurrencyAmount.ToString();
}
}
private async void _gatewayService_OnServerDisconnect(object? sender, EventArgs e)
{
if (DialogResult == DialogResult.OK) return;
@ -669,24 +747,6 @@ namespace qtc_net_client_2
private void _gatewayService_OnServerReconnecting(object? sender, EventArgs e) => BeginInvoke(delegate () { Enabled = false; });
private void _gatewayService_OnServerReconnected(object? sender, EventArgs e) => BeginInvoke(delegate () { Enabled = true; });
private async void _gatewayService_OnClientFunctionReceived(object? sender, EventArgs e)
{
var args = (ClientFunctionEventArgs)e;
switch (args.Function)
{
case "rul":
await RefreshOnlineUsersList();
break;
case "rr":
await RefreshRoomsList();
break;
case "rcl":
await RefreshContactsList();
break;
}
}
private async void _gatewayService_OnServerConfigReceived(object? sender, EventArgs e)
{
var args = (ServerConfigEventArgs)e;
@ -704,8 +764,6 @@ namespace qtc_net_client_2
}
Environment.Exit(0);
}
BeginInvoke(delegate () { Text = $"QtC.NET Client = Connected To {args.ServerConfig.Name}"; });
}
}
@ -726,5 +784,9 @@ namespace qtc_net_client_2
Task.Run(frmDirectMessage.ShowDialog);
}
}
private async void _gatewayService_OnRefreshContactsListReceived(object? sender, EventArgs e) => await RefreshContactsList();
private async void _gatewayService_OnRefreshRoomListReceived(object? sender, EventArgs e) => await RefreshRoomsList();
private async void _gatewayService_OnRefreshUserListReceived(object? sender, EventArgs e) => await RefreshOnlineUsersList();
}
}

View File

@ -120,6 +120,96 @@
<metadata name="ilProfilePics.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="ilGames.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>451, 21</value>
</metadata>
<data name="ilGames.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAEZTeXN0ZW0uV2luZG93cy5Gb3JtcywgQ3VsdHVyZT1uZXV0cmFs
LCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAmU3lzdGVtLldpbmRvd3MuRm9ybXMu
SW1hZ2VMaXN0U3RyZWFtZXIBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAuBIAAAJNU0Z0AUkBTAMBAQAB
aAEAAWgBAAEgAQABIAEABP8BIQEACP8BQgFNATYHAAE2AwABKAMAAYADAAEgAwABAQEAASAGAAFAegAD
XAHnAQgBCgEAAf8DKgFA/wDVAAMhATADRgGAFAABFQEfAQQB/wENARUBAAH/AQgBCgEAAf8BCAEKAQAB
//8AyQADWgG/AQgBCgEAAf8BCAEKAQAB/wEIAQoBAAH/AQgBCgEAAf8BCAEKAQAB/wEIA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EAH/AVoBlAEQAf8BWgGcARAB
/wFaAZwBEAH/AVoBnAEQAf8BWgGcARAB/wFaAZQBGAH/AVoBlAEYAf8BYwGlARcB/wEZASwBAwH//wDF
AAEsAVUBAAH/AVIBjAEIAf8BUgGMAQgB/wFSAYwBEAH/AVIBjAEQAf8BWgGUARAB/wFaAZQBEAH/AVoB
nAEQAf8BWgGcARAB/wFaAZwBEAH/AVoBnAEQAf8BWgGUARgB/wFaAZQBGAH/ASEBQQEAAf//AMUAARIB
IgEAAf8BTAGGAQYB/wFSAYwBCAH/AVoBnAEQAf8BUAGKAQgB/wFSAYwBEAH/AVoBlAEQAf8BWgGcARAB
/wFaAZwBEAH/AVoBnAEQAf8BWgGcARAB/wFaAZwBEQH/AWkBqwEfAf8BCAEKAQAB//8AyQABEAEeAQAB
/wFIAX0BBwH/AVkBkwETAf8BVQGIARgB/wgAASEBQQEAAf8BQgF7AQAB/wFSAYwBCAH/AVUBkQEIAf8B
OQFmAQQB/wFRAVMBTgHv/wDZAAEeAToBAAH//wD/AP8A1wABQgFNAT4HAAE+AwABKAMAAYADAAEgAwAB
AQEAAQEGAAECFgAD/wEAA/8BxwwAAv8BzwGHDAAB/wH+AQABBwwAAf8B/AEAAQcMAAH/AfgBAAEPDAAB
/wHwAQABBwwAAf8B4AEAAQMMAAH/AcABAAEBDAAB/wHAAQABAQwAAf8B4A4AAf8B/AEgDQAB/wH+AeAN
AAH/AcAOAAH/AYAOAAH/DwAB/gIAAQEMAAH8AgABAQwAAfgCAAEBDAAB+AIAAQMMAAH4AgABBwwAAfgC
AAEPDAAB+AEAAUQBfwwAAfgBAAEBAf8MAAH4AgABfwwAAfwCAAF/DAAB/gIAAf8MAAH/AgAB/wwAAf8B
gAEBAf8MAAH/AQABAwH/DAAB/wEMAQ8B/wwAAf8B3wL/DAAE/wwACw==
</value>
</data>
<metadata name="ilTabIcons.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f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AQBDAADQgFyA2MB1QG1AaUBkQH5Af8B
yQGZAv8BvAF/Av8BrgFmAv8BpAFTAv8BnwFKAv8BnwFLAv8BowFRAv8BpwFYAf8BsAGVAXwB+ANdAccD
OwFiBABA/wgAAwUBBgMSARcDOgFgA1EBnwNfAdMDZwHvA2MB9gNiAe4DXgHSA1EBngM5AV8DEQEWAwUB
BhQAAw8BEwNHAYIDZAHbAn4BbwH8A2cB6gNUAagDKAE7HAADPAFlA14B0gH/Ae8B4AL/AdwBvAL/Ac0B
nwL/AcEBigL/AbsBfwL/Ab8BhgL/Ac0BoQL/AekB1gH/A1wBxAM1AVUIAAFCAU0BPgcAAT4DAAEoAwAB
QAMAASADAAEBAQABAQYAAQEWAAP/hQAB/wH8AcABAwQAAf8B/AGAAQEEAAH/AfkGAAH/AfkGAAHwARMG
AAHAAQMEAAL/AYABAQQAAcABAQGAAQEEAAGAAgABAQcAAQEHAAEBBwABAQcAAQEGAAGAAQEGAAHAAQMB
gAEBAgABwAEBAfABHwHAAQML
</value>
</data>
<metadata name="ctxmChangeStatus.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">

View File

@ -0,0 +1,206 @@
namespace qtc_net_client_2.Forms
{
partial class StockMarketGame
{
/// <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()
{
pStockManagement = new Panel();
nudStockBuySellAmount = new NumericUpDown();
btnSell = new Button();
btnBuy = new Button();
lblStockCount = new Label();
pMarketStatus = new Panel();
lblCurrentStockPrice = new Label();
lblMarketStatus = new Label();
pbDollarSignRight = new PictureBox();
pbDollarSignLeft = new PictureBox();
btnRefresh = new Button();
pStockManagement.SuspendLayout();
((System.ComponentModel.ISupportInitialize)nudStockBuySellAmount).BeginInit();
pMarketStatus.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pbDollarSignRight).BeginInit();
((System.ComponentModel.ISupportInitialize)pbDollarSignLeft).BeginInit();
SuspendLayout();
//
// pStockManagement
//
pStockManagement.Controls.Add(nudStockBuySellAmount);
pStockManagement.Controls.Add(btnSell);
pStockManagement.Controls.Add(btnBuy);
pStockManagement.Controls.Add(lblStockCount);
pStockManagement.Location = new Point(242, 108);
pStockManagement.Name = "pStockManagement";
pStockManagement.Size = new Size(135, 81);
pStockManagement.TabIndex = 3;
//
// nudStockBuySellAmount
//
nudStockBuySellAmount.Enabled = false;
nudStockBuySellAmount.Location = new Point(48, 7);
nudStockBuySellAmount.Name = "nudStockBuySellAmount";
nudStockBuySellAmount.Size = new Size(42, 23);
nudStockBuySellAmount.TabIndex = 9;
//
// btnSell
//
btnSell.Enabled = false;
btnSell.ForeColor = Color.Black;
btnSell.Location = new Point(88, 52);
btnSell.Name = "btnSell";
btnSell.Size = new Size(39, 23);
btnSell.TabIndex = 8;
btnSell.Text = "Sell";
btnSell.UseVisualStyleBackColor = true;
btnSell.Click += btnSell_Click;
//
// btnBuy
//
btnBuy.Enabled = false;
btnBuy.ForeColor = Color.Black;
btnBuy.Location = new Point(9, 52);
btnBuy.Name = "btnBuy";
btnBuy.Size = new Size(39, 23);
btnBuy.TabIndex = 7;
btnBuy.Text = "Buy";
btnBuy.UseVisualStyleBackColor = true;
btnBuy.Click += btnBuy_Click;
//
// lblStockCount
//
lblStockCount.Font = new Font("Segoe UI", 7F, FontStyle.Bold);
lblStockCount.ImageAlign = ContentAlignment.MiddleRight;
lblStockCount.Location = new Point(11, 34);
lblStockCount.Name = "lblStockCount";
lblStockCount.Size = new Size(115, 12);
lblStockCount.TabIndex = 6;
lblStockCount.Text = "Your Stock Count - 999";
lblStockCount.TextAlign = ContentAlignment.MiddleCenter;
//
// pMarketStatus
//
pMarketStatus.Controls.Add(lblCurrentStockPrice);
pMarketStatus.Controls.Add(lblMarketStatus);
pMarketStatus.Controls.Add(pbDollarSignRight);
pMarketStatus.Controls.Add(pbDollarSignLeft);
pMarketStatus.Location = new Point(9, 7);
pMarketStatus.Name = "pMarketStatus";
pMarketStatus.Size = new Size(586, 100);
pMarketStatus.TabIndex = 4;
//
// lblCurrentStockPrice
//
lblCurrentStockPrice.Font = new Font("Segoe UI", 9F, FontStyle.Bold);
lblCurrentStockPrice.ForeColor = Color.Black;
lblCurrentStockPrice.Location = new Point(194, 73);
lblCurrentStockPrice.Name = "lblCurrentStockPrice";
lblCurrentStockPrice.Size = new Size(199, 15);
lblCurrentStockPrice.TabIndex = 5;
lblCurrentStockPrice.Text = "Current Price Per Stock Is 999 Q's";
lblCurrentStockPrice.TextAlign = ContentAlignment.MiddleCenter;
//
// lblMarketStatus
//
lblMarketStatus.Font = new Font("Segoe UI", 35F, FontStyle.Bold | FontStyle.Italic);
lblMarketStatus.Location = new Point(90, 4);
lblMarketStatus.Name = "lblMarketStatus";
lblMarketStatus.Size = new Size(408, 62);
lblMarketStatus.TabIndex = 5;
lblMarketStatus.Text = "MARKET_STATUS";
lblMarketStatus.TextAlign = ContentAlignment.MiddleCenter;
//
// pbDollarSignRight
//
pbDollarSignRight.Image = Properties.Resources.dollar_money;
pbDollarSignRight.Location = new Point(498, 3);
pbDollarSignRight.Name = "pbDollarSignRight";
pbDollarSignRight.Size = new Size(83, 94);
pbDollarSignRight.SizeMode = PictureBoxSizeMode.Zoom;
pbDollarSignRight.TabIndex = 4;
pbDollarSignRight.TabStop = false;
//
// pbDollarSignLeft
//
pbDollarSignLeft.Image = Properties.Resources.dollar_money;
pbDollarSignLeft.Location = new Point(6, 3);
pbDollarSignLeft.Name = "pbDollarSignLeft";
pbDollarSignLeft.Size = new Size(83, 94);
pbDollarSignLeft.SizeMode = PictureBoxSizeMode.Zoom;
pbDollarSignLeft.TabIndex = 3;
pbDollarSignLeft.TabStop = false;
//
// btnRefresh
//
btnRefresh.Enabled = false;
btnRefresh.ForeColor = Color.Black;
btnRefresh.Location = new Point(283, 193);
btnRefresh.Name = "btnRefresh";
btnRefresh.Size = new Size(56, 23);
btnRefresh.TabIndex = 10;
btnRefresh.Text = "Refresh";
btnRefresh.UseVisualStyleBackColor = true;
btnRefresh.Click += btnRefresh_Click;
//
// StockMarketGame
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
BackColor = Color.DodgerBlue;
ClientSize = new Size(606, 227);
Controls.Add(btnRefresh);
Controls.Add(pMarketStatus);
Controls.Add(pStockManagement);
ForeColor = Color.White;
FormBorderStyle = FormBorderStyle.FixedDialog;
MaximizeBox = false;
MinimizeBox = false;
Name = "StockMarketGame";
StartPosition = FormStartPosition.CenterScreen;
Text = "QtC.NET qGame - Stock Market";
Load += StockMarketGame_Load;
pStockManagement.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)nudStockBuySellAmount).EndInit();
pMarketStatus.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)pbDollarSignRight).EndInit();
((System.ComponentModel.ISupportInitialize)pbDollarSignLeft).EndInit();
ResumeLayout(false);
}
#endregion
private Panel pStockManagement;
private Button btnSell;
private Button btnBuy;
private Label lblStockCount;
private Panel pMarketStatus;
private Label lblCurrentStockPrice;
private Label lblMarketStatus;
private PictureBox pbDollarSignRight;
private PictureBox pbDollarSignLeft;
private Button btnRefresh;
private NumericUpDown nudStockBuySellAmount;
}
}

View File

@ -0,0 +1,177 @@
using QtCNETAPI.Services.ApiService;
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 qtc_net_client_2.Forms
{
public partial class StockMarketGame : Form
{
private IApiService _apiService;
private int StockPrice = 0;
public StockMarketGame(IApiService apiService)
{
_apiService = apiService;
InitializeComponent();
}
private async void StockMarketGame_Load(object sender, EventArgs e) => await InitializeStockMarketGame();
private async void btnRefresh_Click(object sender, EventArgs e) => await InitializeStockMarketGame();
private async void btnBuy_Click(object sender, EventArgs e)
{
if (nudStockBuySellAmount.Value > 0)
{
nudStockBuySellAmount.Enabled = false;
btnBuy.Enabled = false;
btnSell.Enabled = false;
btnRefresh.Enabled = false;
// buy stock
var amountToBuy = int.Parse(nudStockBuySellAmount.Value.ToString());
var result = await _apiService.BuyStock(amountToBuy);
if (result != null && result.Success && result.Data != null)
{
lblStockCount.Text = $"Your Stock Count - {result.Data.StockAmount}";
_apiService.CurrentUser.StockAmount = result.Data.StockAmount;
_apiService.CurrentUser.CurrencyAmount = result.Data.CurrencyAmount;
Main? mainWindow = (Main?)Application.OpenForms[0];
if (mainWindow != null)
{
if (mainWindow.InvokeRequired)
{
mainWindow.Invoke(mainWindow.RefreshCurrencyCounter);
}
else
{
mainWindow.RefreshCurrencyCounter();
}
}
nudStockBuySellAmount.Enabled = true;
nudStockBuySellAmount.Value = 0;
btnBuy.Enabled = true;
btnSell.Enabled = true;
btnRefresh.Enabled = true;
}
else
{
MessageBox.Show("Buy Failed. Either You Don't Have Enough Q's Or A Server Side Error Occured.", "Oops.", MessageBoxButtons.OK, MessageBoxIcon.Error);
nudStockBuySellAmount.Enabled = true;
nudStockBuySellAmount.Value = 0;
btnBuy.Enabled = true;
btnSell.Enabled = true;
btnRefresh.Enabled = true;
}
}
}
private async void btnSell_Click(object sender, EventArgs e)
{
if(nudStockBuySellAmount.Value > 0)
{
nudStockBuySellAmount.Enabled = false;
btnBuy.Enabled = false;
btnSell.Enabled = false;
btnRefresh.Enabled = false;
// sell stock
var amountToSell = int.Parse(nudStockBuySellAmount.Value.ToString());
var result = await _apiService.SellStock(amountToSell);
if (result != null && result.Success && result.Data != null)
{
lblStockCount.Text = $"Your Stock Count - {result.Data.StockAmount}";
_apiService.CurrentUser.StockAmount = result.Data.StockAmount;
_apiService.CurrentUser.CurrencyAmount = result.Data.CurrencyAmount;
Main? mainWindow = (Main?)Application.OpenForms[0];
if (mainWindow != null)
{
if (mainWindow.InvokeRequired)
{
mainWindow.Invoke(mainWindow.RefreshCurrencyCounter);
}
else
{
mainWindow.RefreshCurrencyCounter();
}
}
nudStockBuySellAmount.Enabled = true;
nudStockBuySellAmount.Value = 0;
btnBuy.Enabled = true;
btnSell.Enabled = true;
btnRefresh.Enabled = true;
} else
{
MessageBox.Show("Sell Failed. Either You Don't Have Enough Stock Or A Server Side Error Occured.", "Oops.", MessageBoxButtons.OK, MessageBoxIcon.Error);
nudStockBuySellAmount.Enabled = true;
nudStockBuySellAmount.Value = 0;
btnBuy.Enabled = true;
btnSell.Enabled = true;
btnRefresh.Enabled = true;
}
}
}
private async Task InitializeStockMarketGame()
{
var currentStockPriceResult = await _apiService.GetCurrentStockPrice();
if (currentStockPriceResult != null && currentStockPriceResult.Success)
{
lblCurrentStockPrice.Text = $"Current Price Per Stock Is {currentStockPriceResult.Data} Q's";
lblStockCount.Text = $"Your Stock Count - {_apiService.CurrentUser.StockAmount}";
switch (currentStockPriceResult.Data)
{
case < 49:
lblMarketStatus.Text = "not good cheif :(";
lblMarketStatus.ForeColor = Color.Red;
break;
case < 99:
lblMarketStatus.Text = "its aight :/";
lblMarketStatus.ForeColor = Color.DarkGreen;
break;
case < 149:
lblMarketStatus.Text = "its good :)";
lblMarketStatus.ForeColor = Color.Green;
break;
case < 199:
lblMarketStatus.Text = "very good :D";
lblMarketStatus.ForeColor = Color.Blue;
break;
case > 200:
lblMarketStatus.Text = "$ AWESOME $";
lblMarketStatus.ForeColor = Color.LightGreen;
break;
default:
lblMarketStatus.Text = "Cannot Determine";
lblMarketStatus.ForeColor = Color.White;
break;
}
nudStockBuySellAmount.Enabled = true;
btnBuy.Enabled = true;
btnSell.Enabled = true;
btnRefresh.Enabled = true;
}
else
{
MessageBox.Show("The Stock Market Endpoint Could Not Be Reached. Please Check Your Internet Connection", "Uh Oh.", MessageBoxButtons.OK, MessageBoxIcon.Error);
Close();
}
}
}
}

View File

@ -0,0 +1,120 @@
<?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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

View File

@ -81,7 +81,7 @@ namespace qtc_net_client_2.Properties {
}
/// <summary>
/// Looks up a localized string similar to 3.4.1.
/// Looks up a localized string similar to 4.0.
/// </summary>
internal static string AssemblyVersion {
get {
@ -149,6 +149,16 @@ namespace qtc_net_client_2.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap dollar_money {
get {
object obj = ResourceManager.GetObject("dollar-money", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View File

@ -124,6 +124,9 @@
<data name="SendIcon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Icons\SendIcon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="left-horn-animated" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Anims\left-horn-animated.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="DefaultPfp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\DefaultPfp.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -157,6 +160,9 @@
<data name="MessageIcon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Icons\MessageIcon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="AssemblyVersion" xml:space="preserve">
<value>4.0</value>
</data>
<data name="LoginBanner" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\LoginBanner.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -166,10 +172,7 @@
<data name="AcceptContactIcon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Icons\AcceptContactIcon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="left-horn-animated" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Anims\left-horn-animated.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="AssemblyVersion" xml:space="preserve">
<value>3.4.1</value>
<data name="dollar-money" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Anims\dollar-money.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>