private void ButConnect_Click(object sender, RoutedEventArgs e) { try { CameraServiceClient client = new CameraServiceClient(); var base64String = client.TakePhotoAsBase64String(20, 200, 200, 0); byte[] byteBuffer = Convert.FromBase64String(base64String); MemoryStream memoryStream = new MemoryStream(byteBuffer); memoryStream.Position = 0; imgPreview.BeginInit(); imgPreview.Source = BitmapFrame.Create(memoryStream, BitmapCreateOptions.None, BitmapCacheOption.OnLoad); ; imgPreview.EndInit(); memoryStream.Close(); //memoryStream = null; //byteBuffer = null; } catch (Exception exception) { MessageBox.Show(exception.Message); } }
private static void Main(string[] args) { ICameraServiceClient cameraServiceClient = new CameraServiceClient(); IPowerSupplyServiceClient powerSupplyServiceClient = new PowerSupplyServiceClient(); var camera = ConnectToCamera(cameraServiceClient); var powerSupply = PowerSupplyDevice(powerSupplyServiceClient); StartStreaming(cameraServiceClient); PowerConsumptionTest(camera, powerSupply); }
public AerotechCamera(string path) : base(path) { BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.None); binding.MaxReceivedMessageSize = 2147483647; binding.MaxBufferSize = 2147483647; binding.MaxBufferPoolSize = 2147483647; EndpointAddress epa = new EndpointAddress(path); Client = new CameraServiceClient(binding, epa); UpdateThread = new TrackedThread("Camera " + Name + " Event Thread", UpdateThreadMethod); UpdateThread.Start(); }
public void SetUp() { _iCameraServiceClient = new CameraServiceClient(); }
public CamerasPage() { InitializeComponent(); client = new CameraServiceClient( GetBinding(), GetEndpointAddress("Cameras")); client.ListCamerasCompleted += (o1, e1) => { HideProgress(); if (e1.Error != null) { if (e1.Error.GetType() == typeof(FaultException <AuthenticationFault>)) { GetAuthenticationToken( new Action( () => { client.ListCamerasAsync(Settings.CachedAuthenticationToken); } )); } else { MessageTextBlock.Text = "Error retrieving camera list."; MessageBox.Show(e1.Error.Message); } return; } if (e1.Result == null || e1.Result.Length == 0) { MessageTextBlock.Text = "You have not set up any cameras. Press the add button to add a camera to the system."; } else { MessageTextBlock.Visibility = System.Windows.Visibility.Collapsed; } int counter = 0; foreach (var a in e1.Result) { HubTile tile = new HubTile() { Title = a.Location, Tag = String.Format( CultureInfo.InvariantCulture, "?location={0}&mjpegurl={1}&username={2}&password={3}", a.Location, HttpUtility.UrlEncode(a.MjpegUrl), a.Username, a.Password), Source = new BitmapImage( new Uri( a.ImageUrl.Insert( 7, String.Format( CultureInfo.InvariantCulture, "{0}:{1}@", a.Username, a.Password)), UriKind.Absolute)), Margin = new Thickness(12, 12, 0, 0), }; tile.SetValue(Grid.ColumnProperty, counter % 2); tile.SetValue(Grid.RowProperty, counter / 2); tile.Tap += (o2, e2) => { NavigationService.Navigate(new Uri("/SingleCameraPage.xaml" + (((HubTile)o2).Tag.ToString()), UriKind.Relative)); }; CameraGrid.Children.Add(tile); counter++; } }; }