예제 #1
0
 public SecretaryGUI(ClientControllers.Client client)
 {
     InitializeComponent();
     this.client = new ClientControllers.Client(new System.Net.IPEndPoint(IPAddress.Parse("127.0.0.1"), 65432));
     if (client.ClientConnected())
     {
         IPersistable[] Iper  = client.GetAllCases();
         List <Case>    cases = new List <Case>();
         foreach (Case item in Iper)
         {
             cases.Add(item);
         }
         dgCases.ItemsSource = cases;
     }
     if (client.ClientConnected())
     {
         IPersistable[] Iper  = client.GetAllCases();
         List <Case>    cases = new List <Case>();
         foreach (Case item in Iper)
         {
             cases.Add(item);
         }
         dgCases.ItemsSource = cases;
     }
 }
예제 #2
0
 private void Window_ContentRendered(object sender, EventArgs e)
 {
     if (client.ClientConnected())
     {
         ContentBar.Background       = Brushes.Green;
         lblServerConnection.Content = "connected";
     }
     else
     {
         ContentBar.Background       = Brushes.Red;
         lblServerConnection.Content = "not connected";
         MessageBoxResult result = MessageBox.Show("you are not connected, do you want to connect", "not connected", MessageBoxButton.OKCancel, MessageBoxImage.Error, MessageBoxResult.OK);
         if (result == MessageBoxResult.OK)
         {
             client.Connect();
             Window_ContentRendered(sender, e);
         }
     }
 }
예제 #3
0
        public MainWindow()
        {
            client = new ClientControllers.Client(new IPEndPoint(IPAddress.Parse("127.0.0.1"), 65432));
            ClientGuiLogic logic   = new ClientGuiLogic();
            WeatherApi     weather = logic.Weather();

            InitializeComponent();
            lblWeather.Content = weather.Main.Temp;
            for (int i = 0; i < 10000; i++)
            {
                if (client.ClientConnected())
                {
                    IPersistable[] Iper  = client.GetAllCases();
                    List <Case>    cases = new List <Case>();
                    foreach (Case item in Iper)
                    {
                        cases.Add(item);
                    }
                    MessageBox.Show("success");
                }
            }
        }