/// <summary>
        /// Closing MainForm
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FormMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            //Stopping threads
            if (downloadthread != null)
            {
                downloadthread.Stop();
                downloadthread = null;
            }

            if (thumbnailthread != null)
            {
                thumbnailthread.Stop();
                thumbnailthread = null;
            }

            if (mjsource != null)
            {
                mjsource.Stop();
                mjsource = null;
            }

            Properties.Settings.Default.WindowSize = this.Size;
            Properties.Settings.Default.WindowLocation = this.Location;

            Properties.Settings.Default.splitContainerDebugPosition = splitContainerDebug.SplitterDistance;
            Properties.Settings.Default.splitContainerPictureviewPosition = splitContainerPictureview.SplitterDistance;

            Properties.Settings.Default.Save();

            log.Debug("Application closing");
        }
        /// <summary>
        /// Starting/Stopping Liveview
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cbLiveView_CheckedChanged(object sender, EventArgs e)
        {
            if ((sender as CheckBox).Checked)
            {
                mjsource = new PtxK_S2.MJPEGSource();
                mjsource.VideoSource = string.Format("http://{0}/v1/liveview", Properties.Settings.Default.IPAdressCamera);
                mjsource.NewFrame += mjsource_NewFrame;
                mjsource.Start();

            }
            else
            {
                mjsource.Stop();
                mjsource = null;
            }
        }