Пример #1
0
        private void SettingsLoad(object sender, EventArgs e)
        {
            if (!Helper.HasFeature(Enums.Features.Settings))
            {
                using (var cp = new CheckPassword())
                {
                    cp.ShowDialog(this);
                }
            }

            if (!Helper.HasFeature(Enums.Features.Settings))
            {
                MessageBox.Show(this, LocRm.GetString("AccessDenied"));
                Close();
                return;
            }

            UISync.Init(this);
            tcTabs.SelectedIndex = InitialTab;
            chkErrorReporting.Checked = MainForm.Conf.Enable_Error_Reporting;
            chkCheckForUpdates.Checked = MainForm.Conf.Enable_Update_Check;

            chkShowGettingStarted.Checked = MainForm.Conf.Enabled_ShowGettingStarted;
            _rkApp = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", false);
            chkStartup.Checked = (_rkApp != null && _rkApp.GetValue("iSpy") != null);

            mediaDirectoryEditor1.Init(MainForm.Conf.MediaDirectories);

            btnDetectColor.BackColor = MainForm.Conf.ActivityColor.ToColor();
            btnNoDetectColor.BackColor = MainForm.Conf.NoActivityColor.ToColor();
            btnColorTracking.BackColor = MainForm.Conf.TrackingColor.ToColor();
            btnColorVolume.BackColor = MainForm.Conf.VolumeLevelColor.ToColor();
            btnColorMain.BackColor = MainForm.Conf.MainColor.ToColor();
            btnColorArea.BackColor = MainForm.Conf.AreaColor.ToColor();
            btnColorBack.BackColor = MainForm.Conf.BackColor.ToColor();
            btnBorderHighlight.BackColor = MainForm.Conf.BorderHighlightColor.ToColor();
            btnBorderDefault.BackColor = MainForm.Conf.BorderDefaultColor.ToColor();
            chkAutoSchedule.Checked = MainForm.Conf.AutoSchedule;
            numMaxCPU.Value = MainForm.Conf.CPUMax;
            numMaxRecordingThreads.Value = MainForm.Conf.MaxRecordingThreads;
            numRedraw.Value = MainForm.Conf.MaxRedrawRate;
            numMediaPanelItems.Value = MainForm.Conf.PreviewItems;
            txtTrayIcon.Text = MainForm.Conf.TrayIconText;
            chkMinimise.Checked = MainForm.Conf.MinimiseOnClose;
            chkSpeechRecognition.Checked = MainForm.Conf.SpeechRecognition;
            chkMinimiseToTray.Checked = MainForm.Conf.TrayOnMinimise;

            if (chkMonitor.Checked && !MainForm.Conf.Monitor)
            {
                Process.Start(Program.AppPath + "iSpyMonitor.exe");
            }
            chkMonitor.Checked = MainForm.Conf.Monitor;

            tbOpacity.Value = MainForm.Conf.Opacity;
            SetColors();

            chkBalloon.Checked = MainForm.Conf.BalloonTips;

            txtIPCameraTimeout.Value = MainForm.Conf.IPCameraTimeout;
            txtServerReceiveTimeout.Value = MainForm.Conf.ServerReceiveTimeout;
            txtServerName.Text = MainForm.Conf.ServerName;
            rtbAccessList.Text = MainForm.Conf.AllowedIPList;

            int i = 0, selind = 0;
            foreach (TranslationsTranslationSet set in LocRm.TranslationSets.OrderBy(p => p.Name))
            {
                ddlLanguage.Items.Add(new ListItem(set.Name, new[] {set.CultureCode}));
                if (set.CultureCode == MainForm.Conf.Language)
                    selind = i;
                i++;
            }
            ddlLanguage.SelectedIndex = selind;
            chkAlertWindows.Checked = MainForm.Conf.CreateAlertWindows;
            chkOverlay.Checked = MainForm.Conf.ShowOverlayControls;
            chkInterrupt.Checked = MainForm.Conf.ScreensaverWakeup;
            chkEnableIPv6.Checked = !MainForm.Conf.IPv6Disabled;
            chkRecycle.Checked = MainForm.Conf.DeleteToRecycleBin;
            txtAppendLinkText.Text = MainForm.Conf.AppendLinkText;
            numMJPEGStreamInterval.Value = MainForm.Conf.MJPEGStreamInterval;
            txtAlertOnDisconnect.Text = MainForm.Conf.AlertOnDisconnect;
            txtAlertOnReconnect.Text = MainForm.Conf.AlertOnReconnect;
            txtArchive.Text = MainForm.Conf.Archive;
            SetSSLText();

            txtAlertSubject.Text = MainForm.Conf.MailAlertSubject;
            txtAlertBody.Text = MainForm.Conf.MailAlertBody;
            txtSMSBody.Text = MainForm.Conf.SMSAlert;

            foreach (string s in StartupModes)
            {
                ddlStartupMode.Items.Add(LocRm.GetString(s));
            }

            foreach (string s in Priorities)
            {
                ddlPriority.Items.Add(LocRm.GetString(s));
            }
            ddlStartupMode.SelectedIndex = MainForm.Conf.StartupMode;

            foreach(var grid in MainForm.Conf.GridViews)
            {
                ddlStartUpForm.Items.Add(grid.name);
            }

            ddlPriority.SelectedIndex = MainForm.Conf.Priority - 1;

            ddlStartUpForm.SelectedItem = MainForm.Conf.StartupForm;
            if (ddlStartUpForm.SelectedItem==null)
                ddlStartUpForm.SelectedIndex = 0;

            ddlPlayback.Items.AddRange(PlaybackModes);

            if (MainForm.Conf.PlaybackMode < 0)
                MainForm.Conf.PlaybackMode = 0;

            if (MainForm.Conf.PlaybackMode<ddlPlayback.Items.Count)
                ddlPlayback.SelectedIndex = MainForm.Conf.PlaybackMode;
            try
            {
                numJPEGQuality.Value = MainForm.Conf.JPEGQuality;
            }
            catch (Exception)
            {

            }
            chkBigButtons.Checked = MainForm.Conf.BigButtons;

            selind = -1;
            i = 1;
            try
            {
                ddlTalkMic.Items.Add(LocRm.GetString("None"));

                for (int n = 0; n < WaveIn.DeviceCount; n++)
                {
                    ddlTalkMic.Items.Add(WaveIn.GetCapabilities(n).ProductName);
                    if (WaveIn.GetCapabilities(n).ProductName == MainForm.Conf.TalkMic)
                        selind = i;
                    i++;

                }
                ddlTalkMic.Enabled = true;
                if (selind > -1)
                    ddlTalkMic.SelectedIndex = selind;
                else
                {
                    if (ddlTalkMic.Items.Count == 1)
                    {
                        ddlTalkMic.Items.Add(_noDevices);
                        ddlTalkMic.Enabled = false;
                        ddlTalkMic.SelectedIndex = 1;
                    }
                    else
                        ddlTalkMic.SelectedIndex = 0;
                }
            }
            catch (ApplicationException ex)
            {
                MainForm.LogExceptionToFile(ex);
                ddlTalkMic.Items.Add(_noDevices);
                ddlTalkMic.Enabled = false;
            }

            ddlJoystick.Items.Add(LocRm.GetString("None"));

            _jst = new JoystickDevice();
            var ij = 0;
            _sticks = _jst.FindJoysticks();
            i = 1;
            foreach(string js in _sticks)
            {
                var nameid = js.Split('|');
                ddlJoystick.Items.Add(nameid[0]);
                if (nameid[1] == MainForm.Conf.Joystick.id)
                    ij = i;
                i++;
            }

            ddlJoystick.SelectedIndex = ij;

            jaxis1.ID = MainForm.Conf.Joystick.XAxis;
            jaxis1.SupportDPad = true;
            jaxis1.Invert = MainForm.Conf.Joystick.InvertXAxis;

            jaxis2.ID = MainForm.Conf.Joystick.YAxis;
            jaxis2.Invert = MainForm.Conf.Joystick.InvertYAxis;

            jaxis3.ID = MainForm.Conf.Joystick.ZAxis;
            jaxis3.Invert = MainForm.Conf.Joystick.InvertZAxis;

            jbutton1.ID = MainForm.Conf.Joystick.Record;
            jbutton2.ID = MainForm.Conf.Joystick.Snapshot;
            jbutton3.ID = MainForm.Conf.Joystick.Talk;
            jbutton4.ID = MainForm.Conf.Joystick.Listen;
            jbutton5.ID = MainForm.Conf.Joystick.Play;
            jbutton6.ID = MainForm.Conf.Joystick.Next;
            jbutton7.ID = MainForm.Conf.Joystick.Previous;
            jbutton8.ID = MainForm.Conf.Joystick.Stop;
            jbutton9.ID = MainForm.Conf.Joystick.MaxMin;

            jbutton1.GetInput += JbuttonGetInput;
            jbutton2.GetInput += JbuttonGetInput;
            jbutton3.GetInput += JbuttonGetInput;
            jbutton4.GetInput += JbuttonGetInput;
            jbutton5.GetInput += JbuttonGetInput;
            jbutton6.GetInput += JbuttonGetInput;
            jbutton7.GetInput += JbuttonGetInput;
            jbutton8.GetInput += JbuttonGetInput;
            jbutton9.GetInput += JbuttonGetInput;

            jaxis1.GetInput += JaxisGetInput;
            jaxis2.GetInput += JaxisGetInput;
            jaxis3.GetInput += JaxisGetInput;

            chkGZip.Checked = MainForm.Conf.EnableGZip;
            numDisconnectNotification.Value = MainForm.Conf.DisconnectNotificationDelay;
            mediaDirectoryEditor1.Enabled = Helper.HasFeature(Enums.Features.Storage);
            HideTab(tabPage11, Helper.HasFeature(Enums.Features.Plugins));

            //important leave here:
            chkPasswordProtect.Checked = MainForm.Conf.Enable_Password_Protect;
            if (Helper.HasFeature(Enums.Features.Plugins))
                ListPlugins();

            chkUseiSpy.Checked = !MainForm.Conf.UseSMTP;
            txtSMTPFromAddress.Text = MainForm.Conf.SMTPFromAddress;
            txtSMTPUsername.Text = MainForm.Conf.SMTPUsername;
            txtSMTPPassword.Text = MainForm.Conf.SMTPPassword;
            txtSMTPServer.Text = MainForm.Conf.SMTPServer;
            chkSMTPUseSSL.Checked = MainForm.Conf.SMTPSSL;
            numSMTPPort.Value = MainForm.Conf.SMTPPort;

            ftpEditor1.Init(MainForm.Conf.FTPServers);
            chkOpenGrabs.Checked = MainForm.Conf.OpenGrabs;
            numFileCache.Value = MainForm.Conf.VLCFileCache;
            rtbReferrers.Text = MainForm.Conf.Referers;
            chkPasswordProtectOnStart.Checked = MainForm.Conf.Password_Protect_Startup;

            chkEnableLogging.Checked = MainForm.Conf.Logging.Enabled;
            numMaxLogSize.Value = MainForm.Conf.Logging.FileSize;
            numKeepLogs.Value = MainForm.Conf.Logging.KeepDays;

            _loaded = true;
        }
Пример #2
0
 public void ShowIfUnlocked()
 {
     if (Visible == false || WindowState == FormWindowState.Minimized)
     {
         if (Conf.Enable_Password_Protect || _locked)
         {
             if (_cp == null)
             {
                 using (_cp = new CheckPassword())
                 {
                     _cp.ShowDialog(this);
                     if (_cp.DialogResult == DialogResult.OK)
                     {
                         _locked = false;
                         ShowForm(-1);
                     }
                 }
                 _cp = null;
             }
         }
         else
         {
             ShowForm(-1);
         }
     }
     else
     {
         ShowForm(-1);
     }
 }
Пример #3
0
 private void menuItem37_Click(object sender, EventArgs e)
 {
     if (_cp == null)
     {
         using (_cp = new CheckPassword())
         {
             _cp.ShowDialog(this);
             if (_cp.DialogResult == DialogResult.OK)
             {
                 _locked = false;
                 ShowForm(-1);
             }
         }
         _cp = null;
     }
 }
Пример #4
0
        private void SettingsLoad(object sender, EventArgs e)
        {
            if (!Helper.HasFeature(Enums.Features.Settings))
            {
                using (var cp = new CheckPassword())
                {
                    cp.ShowDialog(this);
                }
            }

            if (!Helper.HasFeature(Enums.Features.Settings))
            {
                MessageBox.Show(this, LocRm.GetString("AccessDenied"));
                Close();
                return;
            }

            UISync.Init(this);
            tcTabs.SelectedIndex       = InitialTab;
            chkErrorReporting.Checked  = MainForm.Conf.Enable_Error_Reporting;
            chkCheckForUpdates.Checked = MainForm.Conf.Enable_Update_Check;

            chkShowGettingStarted.Checked = MainForm.Conf.Enabled_ShowGettingStarted;
            _rkApp             = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", false);
            chkStartup.Checked = (_rkApp != null && _rkApp.GetValue("iSpy") != null);

            mediaDirectoryEditor1.Init(MainForm.Conf.MediaDirectories);

            btnDetectColor.BackColor     = MainForm.Conf.ActivityColor.ToColor();
            btnNoDetectColor.BackColor   = MainForm.Conf.NoActivityColor.ToColor();
            btnColorTracking.BackColor   = MainForm.Conf.TrackingColor.ToColor();
            btnColorVolume.BackColor     = MainForm.Conf.VolumeLevelColor.ToColor();
            btnColorMain.BackColor       = MainForm.Conf.MainColor.ToColor();
            btnColorArea.BackColor       = MainForm.Conf.AreaColor.ToColor();
            btnColorBack.BackColor       = MainForm.Conf.BackColor.ToColor();
            btnBorderHighlight.BackColor = MainForm.Conf.BorderHighlightColor.ToColor();
            btnBorderDefault.BackColor   = MainForm.Conf.BorderDefaultColor.ToColor();
            chkAutoSchedule.Checked      = MainForm.Conf.AutoSchedule;
            numMaxCPU.Value = MainForm.Conf.CPUMax;
            numMaxRecordingThreads.Value = MainForm.Conf.MaxRecordingThreads;
            numRedraw.Value              = MainForm.Conf.MaxRedrawRate;
            numMediaPanelItems.Value     = MainForm.Conf.PreviewItems;
            txtTrayIcon.Text             = MainForm.Conf.TrayIconText;
            chkMinimise.Checked          = MainForm.Conf.MinimiseOnClose;
            chkSpeechRecognition.Checked = MainForm.Conf.SpeechRecognition;
            chkMinimiseToTray.Checked    = MainForm.Conf.TrayOnMinimise;

            if (chkMonitor.Checked && !MainForm.Conf.Monitor)
            {
                Process.Start(Program.AppPath + "iSpyMonitor.exe");
            }
            chkMonitor.Checked = MainForm.Conf.Monitor;

            tbOpacity.Value = MainForm.Conf.Opacity;
            SetColors();

            chkBalloon.Checked = MainForm.Conf.BalloonTips;

            txtIPCameraTimeout.Value      = MainForm.Conf.IPCameraTimeout;
            txtServerReceiveTimeout.Value = MainForm.Conf.ServerReceiveTimeout;
            txtServerName.Text            = MainForm.Conf.ServerName;
            rtbAccessList.Text            = MainForm.Conf.AllowedIPList;

            int i = 0, selind = 0;

            foreach (TranslationsTranslationSet set in LocRm.TranslationSets.OrderBy(p => p.Name))
            {
                ddlLanguage.Items.Add(new ListItem(set.Name, new[] { set.CultureCode }));
                if (set.CultureCode == MainForm.Conf.Language)
                {
                    selind = i;
                }
                i++;
            }
            ddlLanguage.SelectedIndex    = selind;
            chkAlertWindows.Checked      = MainForm.Conf.CreateAlertWindows;
            chkOverlay.Checked           = MainForm.Conf.ShowOverlayControls;
            chkInterrupt.Checked         = MainForm.Conf.ScreensaverWakeup;
            chkEnableIPv6.Checked        = !MainForm.Conf.IPv6Disabled;
            chkRecycle.Checked           = MainForm.Conf.DeleteToRecycleBin;
            txtAppendLinkText.Text       = MainForm.Conf.AppendLinkText;
            numMJPEGStreamInterval.Value = MainForm.Conf.MJPEGStreamInterval;
            txtAlertOnDisconnect.Text    = MainForm.Conf.AlertOnDisconnect;
            txtAlertOnReconnect.Text     = MainForm.Conf.AlertOnReconnect;
            txtArchive.Text = MainForm.Conf.Archive;
            SetSSLText();


            txtAlertSubject.Text = MainForm.Conf.MailAlertSubject;
            txtAlertBody.Text    = MainForm.Conf.MailAlertBody;
            txtSMSBody.Text      = MainForm.Conf.SMSAlert;

            foreach (string s in StartupModes)
            {
                ddlStartupMode.Items.Add(LocRm.GetString(s));
            }

            foreach (string s in Priorities)
            {
                ddlPriority.Items.Add(LocRm.GetString(s));
            }
            ddlStartupMode.SelectedIndex = MainForm.Conf.StartupMode;

            foreach (var grid in MainForm.Conf.GridViews)
            {
                ddlStartUpForm.Items.Add(grid.name);
            }

            ddlPriority.SelectedIndex = MainForm.Conf.Priority - 1;

            ddlStartUpForm.SelectedItem = MainForm.Conf.StartupForm;
            if (ddlStartUpForm.SelectedItem == null)
            {
                ddlStartUpForm.SelectedIndex = 0;
            }

            ddlPlayback.Items.AddRange(PlaybackModes);

            if (MainForm.Conf.PlaybackMode < 0)
            {
                MainForm.Conf.PlaybackMode = 0;
            }

            if (MainForm.Conf.PlaybackMode < ddlPlayback.Items.Count)
            {
                ddlPlayback.SelectedIndex = MainForm.Conf.PlaybackMode;
            }
            try
            {
                numJPEGQuality.Value = MainForm.Conf.JPEGQuality;
            }
            catch (Exception)
            {
            }
            chkBigButtons.Checked = MainForm.Conf.BigButtons;

            selind = -1;
            i      = 1;
            try
            {
                ddlTalkMic.Items.Add(LocRm.GetString("None"));

                for (int n = 0; n < WaveIn.DeviceCount; n++)
                {
                    ddlTalkMic.Items.Add(WaveIn.GetCapabilities(n).ProductName);
                    if (WaveIn.GetCapabilities(n).ProductName == MainForm.Conf.TalkMic)
                    {
                        selind = i;
                    }
                    i++;
                }
                ddlTalkMic.Enabled = true;
                if (selind > -1)
                {
                    ddlTalkMic.SelectedIndex = selind;
                }
                else
                {
                    if (ddlTalkMic.Items.Count == 1)
                    {
                        ddlTalkMic.Items.Add(_noDevices);
                        ddlTalkMic.Enabled       = false;
                        ddlTalkMic.SelectedIndex = 1;
                    }
                    else
                    {
                        ddlTalkMic.SelectedIndex = 0;
                    }
                }
            }
            catch (ApplicationException ex)
            {
                Logger.LogException(ex);
                ddlTalkMic.Items.Add(_noDevices);
                ddlTalkMic.Enabled = false;
            }

            ddlJoystick.Items.Add(LocRm.GetString("None"));

            _jst = new JoystickDevice();
            var ij = 0;

            _sticks = _jst.FindJoysticks();
            i       = 1;
            foreach (string js in _sticks)
            {
                var nameid = js.Split('|');
                ddlJoystick.Items.Add(nameid[0]);
                if (nameid[1] == MainForm.Conf.Joystick.id)
                {
                    ij = i;
                }
                i++;
            }

            ddlJoystick.SelectedIndex = ij;


            jaxis1.ID          = MainForm.Conf.Joystick.XAxis;
            jaxis1.SupportDPad = true;
            jaxis1.Invert      = MainForm.Conf.Joystick.InvertXAxis;

            jaxis2.ID     = MainForm.Conf.Joystick.YAxis;
            jaxis2.Invert = MainForm.Conf.Joystick.InvertYAxis;

            jaxis3.ID     = MainForm.Conf.Joystick.ZAxis;
            jaxis3.Invert = MainForm.Conf.Joystick.InvertZAxis;

            jbutton1.ID = MainForm.Conf.Joystick.Record;
            jbutton2.ID = MainForm.Conf.Joystick.Snapshot;
            jbutton3.ID = MainForm.Conf.Joystick.Talk;
            jbutton4.ID = MainForm.Conf.Joystick.Listen;
            jbutton5.ID = MainForm.Conf.Joystick.Play;
            jbutton6.ID = MainForm.Conf.Joystick.Next;
            jbutton7.ID = MainForm.Conf.Joystick.Previous;
            jbutton8.ID = MainForm.Conf.Joystick.Stop;
            jbutton9.ID = MainForm.Conf.Joystick.MaxMin;

            jbutton1.GetInput += JbuttonGetInput;
            jbutton2.GetInput += JbuttonGetInput;
            jbutton3.GetInput += JbuttonGetInput;
            jbutton4.GetInput += JbuttonGetInput;
            jbutton5.GetInput += JbuttonGetInput;
            jbutton6.GetInput += JbuttonGetInput;
            jbutton7.GetInput += JbuttonGetInput;
            jbutton8.GetInput += JbuttonGetInput;
            jbutton9.GetInput += JbuttonGetInput;

            jaxis1.GetInput += JaxisGetInput;
            jaxis2.GetInput += JaxisGetInput;
            jaxis3.GetInput += JaxisGetInput;

            chkGZip.Checked = MainForm.Conf.EnableGZip;
            numDisconnectNotification.Value = MainForm.Conf.DisconnectNotificationDelay;
            mediaDirectoryEditor1.Enabled   = Helper.HasFeature(Enums.Features.Storage);
            HideTab(tabPage11, Helper.HasFeature(Enums.Features.Plugins));

            //important leave here:
            chkPasswordProtect.Checked = MainForm.Conf.Enable_Password_Protect;
            if (Helper.HasFeature(Enums.Features.Plugins))
            {
                ListPlugins();
            }

            chkUseiSpy.Checked      = !MainForm.Conf.UseSMTP;
            txtSMTPFromAddress.Text = MainForm.Conf.SMTPFromAddress;
            txtSMTPUsername.Text    = MainForm.Conf.SMTPUsername;
            txtSMTPPassword.Text    = MainForm.Conf.SMTPPassword;
            txtSMTPServer.Text      = MainForm.Conf.SMTPServer;
            chkSMTPUseSSL.Checked   = MainForm.Conf.SMTPSSL;
            numSMTPPort.Value       = MainForm.Conf.SMTPPort;

            ftpEditor1.Init(MainForm.Conf.FTPServers);
            chkOpenGrabs.Checked = MainForm.Conf.OpenGrabs;
            numFileCache.Value   = MainForm.Conf.VLCFileCache;
            rtbReferrers.Text    = MainForm.Conf.Referers;
            chkPasswordProtectOnStart.Checked = MainForm.Conf.Password_Protect_Startup;

            chkEnableLogging.Checked = MainForm.Conf.Logging.Enabled;
            numMaxLogSize.Value      = MainForm.Conf.Logging.FileSize;
            numKeepLogs.Value        = MainForm.Conf.Logging.KeepDays;

            _loaded = true;
        }