public TestClass(string pathToImage) { client = new ServerServiceClient(new System.ServiceModel.InstanceContext(this)); try { filters = client.GetFilters(); } catch (Exception) { throw new Exception("Server is not avaliable"); } try { testImage = new Bitmap(pathToImage); } catch (FileNotFoundException e) { throw e; } }
public MainWindow() { InitializeComponent(); _isImageUpload = false; _isSendButton = true; _client = new ServerServiceClient(new System.ServiceModel.InstanceContext(this)); try { var filters = _client.GetFilters(); foreach (var f in filters) { filterComboBox.Items.Add(f); } filterComboBox.SelectedItem = filters.First(); } catch { MessageBox.Show("Server is not avaliable"); Close(); } }