private void AquariumControl_MouseMove(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { if (_focusedClientWindow != null) { _focusedClientWindow.OnMouseMove(new MouseEventArgs(e.Button, e.Clicks, e.X - _focusedClientWindow.X, e.Y - _focusedClientWindow.Y, e.Delta)); } return; } for (int i = _clientWindowList.Count - 1 ; i >= 0; i--) { ClientWindow window = _clientWindowList[i]; if (window.Contains(e.Location)) { MouseEventArgs args = new MouseEventArgs(e.Button, e.Clicks, e.X - window.X, e.Y - window.Y, e.Delta); if (window != _focusedClientWindow) { if (_focusedClientWindow != null) { _focusedClientWindow.Focused = false; _focusedClientWindow.OnMouseLeave(args); } window.Focused = true; _focusedClientWindow = window; window.OnMouseEnter(args); } window.OnMouseMove(args); return; } } if (_focusedClientWindow != null) { _focusedClientWindow.Focused = false; _focusedClientWindow.OnMouseLeave(new MouseEventArgs(e.Button, e.Clicks, e.X - _focusedClientWindow.X, e.Y - _focusedClientWindow.Y, e.Delta)); _focusedClientWindow = null; } }
//---------------------------- Public methods --------------------------// public void AddClientWindow(ClientWindow window) { _clientWindowList.Add(window); OnClientWindowAdded(EventArgs.Empty); }
/// <summary> /// Spawns the Eryan Client on a new thread /// </summary> public static void createWindow() { cWindow = new ClientWindow(); Application.Run(cWindow); }
public void RemoveClientWindow(ClientWindow window) { if (_clientWindowList.Remove(window)) OnClientWindowRemoved(EventArgs.Empty); }
/// <summary> /// Запомнить расположение окон /// </summary> /// <param name="CW"></param> /// <param name="Win"></param> internal static void WinVisibleSettingsSet(ClientWindow CW, List <Grid> Win) { //System.Drawing.Point point = new System.Drawing.Point(); //foreach (var gr in Win) //{ // switch (gr.Name) // { // case "_Indictive": // point.X = Convert.ToInt32(Canvas.GetLeft(CW._Indictive)); // point.Y = Convert.ToInt32(Canvas.GetTop(CW._Indictive)); // Properties.Settings.Default.LTV = new System.Drawing.Point(point.X, point.Y); // break; // case "_Investment": // point.X = Convert.ToInt32(Canvas.GetLeft(CW._Investment)); // point.Y = Convert.ToInt32(Canvas.GetTop(CW._Investment)); // Properties.Settings.Default.InvestDeta = new System.Drawing.Point(point.X, point.Y); // break; // case "_Chart": // point.X = Convert.ToInt32(Canvas.GetLeft(CW._Chart)); // point.Y = Convert.ToInt32(Canvas.GetTop(CW._Chart)); // Properties.Settings.Default.ChartDeta = new System.Drawing.Point(point.X, point.Y); // break; // case "_RecomPort": // point.X = Convert.ToInt32(Canvas.GetLeft(CW._RecomPort)); // point.Y = Convert.ToInt32(Canvas.GetTop(CW._RecomPort)); // Properties.Settings.Default.RecomendPort = new System.Drawing.Point(point.X, point.Y); // break; // case "_FondSummary": // point.X = Convert.ToInt32(Canvas.GetLeft(CW._FondSummary)); // point.Y = Convert.ToInt32(Canvas.GetTop(CW._FondSummary)); // Properties.Settings.Default.FundSumm = new System.Drawing.Point(point.X, point.Y); // break; // case "_Details": // point.X = Convert.ToInt32(Canvas.GetLeft(CW._Details)); // point.Y = Convert.ToInt32(Canvas.GetTop(CW._Details)); // Properties.Settings.Default.Details = new System.Drawing.Point(point.X, point.Y); // break; // case "_Current": // point.X = Convert.ToInt32(Canvas.GetLeft(CW._Current)); // point.Y = Convert.ToInt32(Canvas.GetTop(CW._Current)); // Properties.Settings.Default.CurrPort = new System.Drawing.Point(point.X, point.Y); // break; // case "_Library": // //point.X = Convert.ToInt32(Canvas.GetLeft(CW._Library)); // //point.Y = Convert.ToInt32(Canvas.GetTop(CW._Library)); // Properties.Settings.Default.Library = new System.Drawing.Point(point.X, point.Y); // break; // case "_RiscStart": // //point.X = Convert.ToInt32(Canvas.GetLeft(CW._RiscStart)); // //point.Y = Convert.ToInt32(Canvas.GetTop(CW._RiscStart)); // Properties.Settings.Default.StartRisk = new System.Drawing.Point(point.X, point.Y); // break; // case "_RiscHistory": // //point.X = Convert.ToInt32(Canvas.GetLeft(CW._RiscHistory)); // //point.Y = Convert.ToInt32(Canvas.GetTop(CW._RiscHistory)); // Properties.Settings.Default.HistoryRisk = new System.Drawing.Point(point.X, point.Y); // break; // case "_Tasks": // //point.X = Convert.ToInt32(Canvas.GetLeft(CW._Tasks)); // //point.Y = Convert.ToInt32(Canvas.GetTop(CW._Tasks)); // Properties.Settings.Default.Task = new System.Drawing.Point(point.X, point.Y); // break; // } // Properties.Settings.Default.Save(); //} }
/// <summary> /// Установка окон в позиции прошлого сеанса /// </summary> /// <param name="Window"></param> internal static void SetWinVisible(ClientWindow Window) { //if (Properties.Settings.Default.LTV != new System.Drawing.Point(0, 0)) //{ // Window.Indictive.IsChecked = true; // Canvas.SetLeft(Window._Indictive, Properties.Settings.Default.Setting.X); // Canvas.SetTop(Window._Indictive, Properties.Settings.Default.Setting.Y); //} //if (Properties.Settings.Default.InvestDeta != new System.Drawing.Point(0, 0)) //{ // Window.Investment.IsChecked = true; // Canvas.SetLeft(Window._Investment, Properties.Settings.Default.Setting.X); // Canvas.SetTop(Window._Investment, Properties.Settings.Default.Setting.Y); //} //if (Properties.Settings.Default.ChartDeta != new System.Drawing.Point(0, 0)) //{ // Window.Chart.IsChecked = true; // Canvas.SetLeft(Window._Chart, Properties.Settings.Default.Setting.X); // Canvas.SetTop(Window._Chart, Properties.Settings.Default.Setting.Y); //} //if (Properties.Settings.Default.RecomendPort != new System.Drawing.Point(0, 0)) //{ // Window.RecomPort.IsChecked = true; // Canvas.SetLeft(Window._RecomPort, Properties.Settings.Default.Setting.X); // Canvas.SetTop(Window._RecomPort, Properties.Settings.Default.Setting.Y); //} //if (Properties.Settings.Default.FundSumm != new System.Drawing.Point(0, 0)) //{ // Window.FondSummary.IsChecked = true; // Canvas.SetLeft(Window._FondSummary, Properties.Settings.Default.Setting.X); // Canvas.SetTop(Window._FondSummary, Properties.Settings.Default.Setting.Y); //} //if (Properties.Settings.Default.Details != new System.Drawing.Point(0, 0)) //{ // Window.Settings.IsChecked = true; // Canvas.SetLeft(Window._Details, Properties.Settings.Default.Setting.X); // Canvas.SetTop(Window._Details, Properties.Settings.Default.Setting.Y); //} //if (Properties.Settings.Default.CurrPort != new System.Drawing.Point(0, 0)) //{ // Window.Current.IsChecked = true; // Canvas.SetLeft(Window._Current, Properties.Settings.Default.Setting.X); // Canvas.SetTop(Window._Current, Properties.Settings.Default.Setting.Y); //} //if (Properties.Settings.Default.Library != new System.Drawing.Point(0, 0)) //{ // //Window.Library.IsChecked = true; // //Canvas.SetLeft(Window._Library, Properties.Settings.Default.Setting.X); // //Canvas.SetTop(Window._Library, Properties.Settings.Default.Setting.Y); //} //if (Properties.Settings.Default.StartRisk != new System.Drawing.Point(0, 0)) //{ // Window.RiscStart.IsChecked = true; // //Canvas.SetLeft(Window._RiscStart, Properties.Settings.Default.Setting.X); // //Canvas.SetTop(Window._RiscStart, Properties.Settings.Default.Setting.Y); //} //if (Properties.Settings.Default.HistoryRisk != new System.Drawing.Point(0, 0)) //{ // Window.RiscHistory.IsChecked = true; // //Canvas.SetLeft(Window._RiscHistory, Properties.Settings.Default.Setting.X); // //Canvas.SetTop(Window._RiscHistory, Properties.Settings.Default.Setting.Y); //} //if (Properties.Settings.Default.Task != new System.Drawing.Point(0, 0)) //{ // Window.Tasks.IsChecked = true; // //Canvas.SetLeft(Window._Tasks, Properties.Settings.Default.Setting.X); // //Canvas.SetTop(Window._Tasks, Properties.Settings.Default.Setting.Y); //} }
private void addClientButton_Click(object sender, RoutedEventArgs e) { ClientWindow ClientAddForm = new ClientWindow(this); ClientAddForm.ShowDialog(); }
public void Execute(Message message, ClientWindow parent) { parent.Message.Id = message.Id; message.Operation = "updatelist"; // Запросить список всех подключений parent.SendMessage(message); }
private void btnEnter_Click(object sender, RoutedEventArgs e) { if (TBoxLog.Text == null) { MessageBox.Show("Введите данные"); } else if (TBoxLog.Text == "admin" & TBoxPass.Password == password) { AdminWindow AW = new AdminWindow(); AW.mainWindow = this; AW.connect = mainConnect; TBoxPass.Password = TBoxLog.Text = ""; AW.ShowDialog(); } else { try { if (TBoxLog.Text.Length == 11) { cmmnd.Connection = mainConnect; cmmnd.CommandText = "select Client_ID from Client where C_Phone_number = " + TBoxLog.Text.ToString(); SqlDataReader Reader = cmmnd.ExecuteReader(); if (!Reader.Read()) { throw new Exception(); } ClientWindow CW = new ClientWindow() { ClientID = int.Parse(Reader[0].ToString()) }; CW.mainWindow = this; TBoxLog.Text = TBoxPass.Password = ""; CW.connect = mainConnect; Reader.Close(); CW.ShowDialog(); } else if (TBoxLog.Text.Length == 12) { cmmnd.Connection = mainConnect; cmmnd.CommandText = "select Driver_ID from Driver where Licence_number = " + "'" + TBoxLog.Text.ToString() + "'"; SqlDataReader Reader = cmmnd.ExecuteReader(); if (!Reader.Read()) { throw new Exception(); } DriverWindow DW = new DriverWindow() { DriverID = int.Parse(Reader[0].ToString()) }; DW.mainWindow = this; TBoxLog.Text = TBoxPass.Password = ""; DW.connect = mainConnect; Reader.Close(); DW.ShowDialog(); } else { throw new Exception(); } } catch { MessageBox.Show("Проверьте введенные данные"); TBoxLog.Text = TBoxPass.Password = ""; } } }