private ConnectionsContainer ReadSavedConnections(string pathToLoad)
 {
     if (pathToLoad != null)
     {
         ConnectionsContainer container = BinarySerialization.ReadFromBinaryFile <ConnectionsContainer>(pathToLoad);
         return(container);
     }
     else
     {
         return(null);
     }
 }
Esempio n. 2
0
        public FormAzuriranjeVeze(Form ownerForm, ConnectionsContainer connectionsContainer)
        {
            InitializeComponent();
            parentForm = (FormFTPSpajanje)ownerForm;
            this.myConnectionsContainer = connectionsContainer;
            this.Owner = parentForm;

            textBox_Naziv.Text                    = parentForm.textBox_Naziv.Text;
            textBox_host.Text                     = parentForm.textBox_host.Text;
            textBox_port.Text                     = parentForm.textBox_port.Text;
            textBox_username.Text                 = parentForm.textBox_username.Text;
            textBox_lozinka.Text                  = parentForm.textBox_lozinka.Text;
            richTextBox_Napomena.Text             = parentForm.richTextBox_Napomena.Text;
            comboBox_vrstaKonekcije.SelectedIndex = parentForm.comboBox_vrstaKonekcije.SelectedIndex;
        }
        public FormFTPSpajanje(Form ownerForm)
        {
            InitializeComponent();
            this.comboBox_vrstaKonekcije.SelectedIndex = 0;
            mainForm          = (Form_Glavna)ownerForm;
            pathLastSavedFile = Properties.Settings.Default.pathLastSavedFile;
            pathLastLoaded    = pathLastSavedFile;

            ConnectionsContainer container = ReadSavedConnections(pathLastSavedFile);

            if (container != null)
            {
                myConnectionsContainer = container;
                LoadSavedConnections();
            }
        }
        //------------------------------------------------------------------------------------------------------------------------------------



        private void ucitajListuVezaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog openDialog = new OpenFileDialog();

            openDialog.Filter = "Binary File | *.bin";
            DialogResult result = openDialog.ShowDialog(this);

            if (result == DialogResult.OK)
            {
                string pathToLoad = openDialog.FileName;

                ConnectionsContainer container = ReadSavedConnections(pathToLoad);

                if (container != null)
                {
                    myConnectionsContainer = container;
                    LoadSavedConnections();
                    pathLastLoaded    = pathToLoad;
                    pathLastSavedFile = pathToLoad;
                }
            }
        }