예제 #1
0
        private void Reconnect_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (_fileClient.State == CommunicationState.Opened ||
                    _fileClient.State == CommunicationState.Created)
                {
                    _fileClient.Close();
                }
                if (_dataClient.State == CommunicationState.Opened ||
                    _dataClient.State == CommunicationState.Created)
                {
                    _dataClient.Close();
                }
                _dataClient = new DataOperationClient("NetTcpBinding_IDataOperation");
                _fileClient = new FileOperationClient("NetTcpBinding_IFileOperation");

                FullArrayOfOsoba       = _fileClient.GetDataFromXML().ToList();
                list_osoba.ItemsSource = FullArrayOfOsoba;
                MessageBox.Show("There is a connection.", "Message");
            }
            catch
            {
                MessageBox.Show("No connection to the service.", "Message");
            }
        }
예제 #2
0
        public MainWindow()
        {
            InitializeComponent();
            try
            {
                _dataClient = new DataOperationClient("NetTcpBinding_IDataOperation");
                _fileClient = new FileOperationClient("NetTcpBinding_IFileOperation");

                FullArrayOfOsoba       = _fileClient.GetDataFromXML().ToList();
                list_osoba.ItemsSource = FullArrayOfOsoba;
            }
            catch
            {
                MessageBox.Show("No connection to the service.", "Message");
            }
        }