Пример #1
0
        public static void ReadSettings(MainForm form)
        {
            FTPSettings ftpSettings = new FTPSettings();

            form.PenSize      = Properties.Settings.Default.PenWidth;
            form.ShapeOpacity = Properties.Settings.Default.Opacity;
            form.ArrowSize    = Properties.Settings.Default.ArrowSize;

            form.txtFont = new Font(Properties.Settings.Default.FontName, Properties.Settings.Default.FontSize, FontStyle.Regular, GraphicsUnit.Pixel);

            form.DrawingColor     = Properties.Settings.Default.Color;
            ftpSettings.FTPServer = Properties.Settings.Default.FTPServer;
            ftpSettings.FTPPort   = Properties.Settings.Default.FTPPort;
            ftpSettings.FTPUser   = Properties.Settings.Default.FTPUser;

            string     temp = Properties.Settings.Default.FTPPwd;
            SimplerAES aes  = new SimplerAES();

            ftpSettings.FTPPwd = temp == "" ? "" : aes.Decrypt(temp);

            ftpSettings.AnonymousLogin = Properties.Settings.Default.AnonymousLogin;
            ftpSettings.UseProxy       = Properties.Settings.Default.UseProxyServer;
            ftpSettings.PrxyServer     = Properties.Settings.Default.ProxyServer;
            ftpSettings.PrxyUser       = Properties.Settings.Default.ProxyUser;

            temp = Properties.Settings.Default.ProxyPassword;
            ftpSettings.PrxyPwd = temp == "" ? "" : aes.Decrypt(temp);

            ftpSettings.PrxyPort = Properties.Settings.Default.ProxyPort;
            ftpSettings.DefaultImagesLocation = Properties.Settings.Default.DefaultImagesLocation;
            form.GridColor        = Properties.Settings.Default.GridColor;
            form.ftpSettings      = ftpSettings;
            form.NoOfHistoryItems = Properties.Settings.Default.NoOfHistoryFiles;
        }
Пример #2
0
        public static void WriteSettings(MainForm form)
        {
            FTPSettings ftpSettings = form.ftpSettings;

            Properties.Settings.Default.PenWidth  = form.PenSize;
            Properties.Settings.Default.Opacity   = form.ShapeOpacity;
            Properties.Settings.Default.ArrowSize = form.ArrowSize;
            Properties.Settings.Default.FontName  = form.txtFont.Name;
            Properties.Settings.Default.FontSize  = form.txtFont.Size;
            Properties.Settings.Default.Color     = form.DrawingColor;
            Properties.Settings.Default.FTPServer = ftpSettings.FTPServer;
            Properties.Settings.Default.FTPPort   = ftpSettings.FTPPort;
            Properties.Settings.Default.FTPUser   = ftpSettings.FTPUser;
            SimplerAES aes    = new SimplerAES();
            string     encPwd = ftpSettings.FTPPwd == null ? "" : ftpSettings.FTPPwd;

            encPwd = aes.Encrypt(encPwd);
            Properties.Settings.Default.FTPPwd         = encPwd;
            Properties.Settings.Default.AnonymousLogin = ftpSettings.AnonymousLogin;
            Properties.Settings.Default.UseProxyServer = ftpSettings.UseProxy;
            Properties.Settings.Default.ProxyServer    = ftpSettings.PrxyServer;
            Properties.Settings.Default.ProxyUser      = ftpSettings.PrxyUser;
            string prxyPwd = ftpSettings.PrxyPwd == null ? "" : ftpSettings.PrxyPwd;

            prxyPwd = aes.Encrypt(prxyPwd);
            Properties.Settings.Default.ProxyPassword         = prxyPwd;
            Properties.Settings.Default.ProxyPort             = ftpSettings.PrxyPort;
            Properties.Settings.Default.DefaultImagesLocation = ftpSettings.DefaultImagesLocation;
            Properties.Settings.Default.GridColor             = form.GridColor;
            Properties.Settings.Default.NoOfHistoryFiles      = form.NoOfHistoryItems;

            Properties.Settings.Default.Save();
        }
Пример #3
0
 public SettingsForm(FTPSettings settings, Color gridColor, int noOfHistoryImages)
 {
     InitializeComponent();
     this.ftpSettings       = settings;
     this.NoOfHistoryImages = noOfHistoryImages;
     ftpControl             = new FtpSettingsControl(settings);
     otherSettings          = new OtherSettings(gridColor, NoOfHistoryImages);
     ftpControl.Parent      = this.tabFTPSettings;
     otherSettings.Parent   = this.tabOtherSettings;
     this.tabFTPSettings.Controls.Add(ftpControl);
     this.tabOtherSettings.Controls.Add(otherSettings);
 }
Пример #4
0
        private void settingsToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            SettingsForm settings = new SettingsForm(ftpSettings, GridColor, NoOfHistoryItems);

            if (settings.ShowDialog() == DialogResult.OK)
            {
                ftpSettings      = settings.ftpSettings;
                GridColor        = settings.GridColor;
                NoOfHistoryItems = settings.NoOfHistoryImages;
                AddHistoryMenuItems();
                Utility.WriteSettings(this);
            }
        }
Пример #5
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     try
     {
         ftpSettings       = ftpControl.GetLatestSettings();
         GridColor         = otherSettings.GridColor;
         NoOfHistoryImages = otherSettings.ItemsInHistory;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return;
     }
 }
Пример #6
0
        public MainForm()
        {
            InitializeComponent();
            InitializeSysTrayIconAndMenu();
            _hPreviousWindow = IntPtr.Zero;
            currentState     = CurrentState.STATE_IDLE;

            optionsForm = new OptionsForm(this);
            editState   = EditState.NONE;

            drawObjects = new List <Shape>();
            penPoints   = new List <Point>();

            HorzGridLine = new Line(2.0f, DrawingColor, Point.Empty, Point.Empty);
            VertGridLine = new Line(2.0f, DrawingColor, Point.Empty, Point.Empty);

            FirstEditPoint     = new Point();
            SecondEditPoint    = new Point();
            FirstEditPointDone = false;

            CalculateScreenRectangle();

            ftpSettings = new FTPSettings();
            ftpSettings.InitWithDefaults();

            cropCursor      = new Cursor(Assembly.GetExecutingAssembly().GetManifestResourceStream("Screenshot.Resources.CropCursor.cur"));
            circleCursor    = new Cursor(Assembly.GetExecutingAssembly().GetManifestResourceStream("Screenshot.Resources.Circle.cur"));
            rectCursor      = new Cursor(Assembly.GetExecutingAssembly().GetManifestResourceStream("Screenshot.Resources.Rectangle.cur"));
            penCursor       = new Cursor(Assembly.GetExecutingAssembly().GetManifestResourceStream("Screenshot.Resources.Pen.cur"));
            lineCursor      = new Cursor(Assembly.GetExecutingAssembly().GetManifestResourceStream("Screenshot.Resources.Line.cur"));
            arrowCursor     = new Cursor(Assembly.GetExecutingAssembly().GetManifestResourceStream("Screenshot.Resources.Arrow.cur"));
            selectionCursor = new Cursor(Assembly.GetExecutingAssembly().GetManifestResourceStream("Screenshot.Resources.Selection.cur"));
            textCursor      = new Cursor(Assembly.GetExecutingAssembly().GetManifestResourceStream("Screenshot.Resources.Text.cur"));

            Utility.ReadSettings(this);

            kbHook    = new KeyboardHooks(this);
            mouseHook = new MouseHooks(this);

            origBmpRect = Rectangle.Empty;

            SelectedShape      = null;
            selectedShapeIndex = -1;

            lastFTPLocation = String.Empty;

            AddHistoryMenuItems();
        }
Пример #7
0
 public FtpSettingsControl(FTPSettings settings)
 {
     InitializeComponent();
     this.ftpSettings = settings;
 }