Exemplo n.º 1
0
        public OptionsForm(BackupForm parentForm, BackupSettings settings)
        {
            InitializeComponent();

            this.parentForm = parentForm;
            this.settings = settings;

            this.ServerAddressTextBox.Text = settings.ServerUrl;
            this.AuthenticationKeyTextBox.Text = settings.AuthenticationKey;
            this.CertificateIdentityTextBox.Text = settings.CertificateIdentity;

            // Set version label
            this.VersionLabel.Text = Assembly.GetExecutingAssembly().GetName().Version.ToString();

            // Populate storage accounts
            bool https;

            foreach(BackupStorageAccount storageAccount in settings.StorageAccounts)
            {
                if (storageAccount.Protocol == "Https")
                {
                    https = true;
                }
                else
                {
                    https = false;
                }

                this.StorageAccountDataGridView.Rows.Add(storageAccount.Label, storageAccount.AccountName, storageAccount.AccountKey, https);
            }
        }
Exemplo n.º 2
0
        public void LoadSettings()
        {
            // Look for settings in isolated storage
            this.isoStore = IsolatedStorageFile.GetUserStoreForAssembly();

            //this.isoStore.DeleteFile("Prefs.txt");

            string[] files = this.isoStore.GetFileNames(prefsFilename);

            if (files.Length > 0)
            {
                using (StreamReader reader = new StreamReader(new IsolatedStorageFileStream(prefsFilename, FileMode.Open, this.isoStore)))
                {
                    // Decrypt the stream
                    string       decrypted = Encryption.Decrypt(reader.ReadToEnd(), key, false);
                    StringReader sr        = new StringReader(decrypted);

                    // Deserialize the settings
                    XmlSerializer  serializer = new XmlSerializer(this.GetType());
                    BackupSettings settings   = (BackupSettings)serializer.Deserialize(sr);

                    // Set properties
                    this.ServerUrl           = settings.ServerUrl;
                    this.AuthenticationKey   = settings.AuthenticationKey;
                    this.CertificateIdentity = settings.CertificateIdentity;
                    this.StorageAccounts     = settings.StorageAccounts;
                }
            }
        }
Exemplo n.º 3
0
        public OptionsForm(BackupForm parentForm, BackupSettings settings)
        {
            InitializeComponent();

            this.parentForm = parentForm;
            this.settings   = settings;

            this.ServerAddressTextBox.Text       = settings.ServerUrl;
            this.AuthenticationKeyTextBox.Text   = settings.AuthenticationKey;
            this.CertificateIdentityTextBox.Text = settings.CertificateIdentity;

            // Set version label
            this.VersionLabel.Text = Assembly.GetExecutingAssembly().GetName().Version.ToString();

            // Populate storage accounts
            bool https;

            foreach (BackupStorageAccount storageAccount in settings.StorageAccounts)
            {
                if (storageAccount.Protocol == "Https")
                {
                    https = true;
                }
                else
                {
                    https = false;
                }

                this.StorageAccountDataGridView.Rows.Add(storageAccount.Label, storageAccount.AccountName, storageAccount.AccountKey, https);
            }
        }
Exemplo n.º 4
0
        public BackupForm()
        {
            InitializeComponent();

            // Load current settings
            this.settings = new BackupSettings();
            settings.LoadSettings();

            // Populate storage accounts
            UpdateStorageAccounts();
        }