public MainPage()
        {
            this.InitializeComponent();
            myDispatcher = Dispatcher;
            myStatus     = Status;

            threshold = 25;
            smooth    = 10;

            Camera = new CoreCamera(PreviewControl);

            CamerasList.SelectedIndex = 0;
            Camera.cameraPreview.PreviewStatusChanged += CameraPreview_PreviewStatusChanged;

            MotionDataCollection    = new MotionDataCollection(20);
            MotionChart.DataContext = MotionDataCollection.MotionValue;

            NetworkManager = new NetworkManager();

            MotionDetectorFactory = new MotionDetectorFactory(Camera, MotionDataCollection);
            MotionDetectorFactory.ImageCaptured += UpdateUI;
            MotionDetectorFactory.ImageCaptured += SaveImage;
            MotionDetectorFactory.ImageCaptured += SendNotification;
            MotionDetectorFactory.ImageCaptured += SendEmail;

            Task.Factory.StartNew(() => NetworkManager.Start());
            NetworkManager.UpdateSettings += NetworkManager_UpdateSettings;

            subEmail = new TextBox[] { subEmail1, subEmail2, subEmail3, subEmail4 };
            ShowSubEmail();

            ShowMessage($"Web portal at: {GetLocalIp()}:8081");
        }
 public MotionDetectorFactory(CoreCamera cameraSettings,
                              MotionDataCollection motionDataCollection)
 {
     Camera               = cameraSettings;
     MotionDetector       = new MotionDetector();
     MotionDataCollection = motionDataCollection;
 }