Exemplo n.º 1
0
        // transmit a whole file via timer
        private void checkBoxTxFromFile_CheckedChanged(object sender, EventArgs e)
        {
            if (this.checkBoxTxFromFile.Checked)
            {
                // self made dialog
                SelectFolderOrFile sff = new SelectFolderOrFile();
                sff.Text        = "Select File";
                sff.DefaultPath = Path.GetDirectoryName(Application.ExecutablePath);
                DialogResult dlr = sff.ShowDialog(this);
                if (dlr != System.Windows.Forms.DialogResult.OK)
                {
                    return;
                }
                this.m_TxFileData = File.ReadLines(sff.ReturnFile).ToArray();
                sff.Dispose();

                int value = 1;
                if (this.checkBoxDelay.Checked)
                {
                    int.TryParse(this.textBoxTxRepeat.Text, out value);
                }
                this.m_TxFileIndex        = 0;
                this.timerTxFile.Interval = value;
                this.timerTxFile.Start();
            }
            else
            {
                this.timerTxFile.Stop();
                this.m_TxFileData = null;
            }
        }
Exemplo n.º 2
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SelectFolderOrFile sff = new SelectFolderOrFile();

            sff.Text        = "Select File";
            sff.DefaultPath = (this.m_fileName.Length > 0) ? Path.GetDirectoryName(this.m_fileName) : "";
            DialogResult dlr = sff.ShowDialog(this);

            if (dlr == System.Windows.Forms.DialogResult.OK)
            {
                this.OpenFile(sff.ReturnFile);
            }
            sff.Dispose();
        }
Exemplo n.º 3
0
        private void buttonBrowse_Click(object sender, EventArgs e)
        {
            // self made file folder select dialog
            SelectFolderOrFile sff = new SelectFolderOrFile();

            sff.Text        = "Select Folder";
            sff.DefaultPath = this.textBoxDestination.Text;
            DialogResult dlr = sff.ShowDialog(this);

            if (dlr == System.Windows.Forms.DialogResult.OK)
            {
                this.textBoxDestination.Text = sff.ReturnPath;
            }
            sff.Dispose();
        }
Exemplo n.º 4
0
        string OpenFile(string defaultfile)
        {
            string ret = "";

            // self made dialog
            SelectFolderOrFile sff = new SelectFolderOrFile();

            sff.Text = "Select File";
            if (!File.Exists(defaultfile))
            {
                defaultfile = Application.StartupPath;
            }
            sff.DefaultPath = defaultfile;
            DialogResult dlr = sff.ShowDialog(this);

            if (dlr == System.Windows.Forms.DialogResult.OK)
            {
                ret = sff.ReturnFile;
            }
            sff.Dispose();

            return(ret);
        }
Exemplo n.º 5
0
        // select network folder
        private void buttonSelectNetworkFolder_Click(object sender, EventArgs e)
        {
            // select network folder
            SelectFolderOrFile sff = new SelectFolderOrFile();

            sff.Text        = "Select Network Folder";
            sff.DefaultPath = "Network";
            DialogResult dlr = sff.ShowDialog(this);

            if (dlr != System.Windows.Forms.DialogResult.OK)
            {
                sff.Dispose();
                return;
            }
            string DriveToMap = sff.ReturnPath;

            sff.Dispose();

            // add selection to combobox
            bool bFound = false;

            for (int i = 0; i < this.comboBoxNetworkFolder.Items.Count; i++)
            {
                string value = this.comboBoxNetworkFolder.GetItemText(this.comboBoxNetworkFolder.Items[i]);
                if (value == DriveToMap)
                {
                    this.comboBoxNetworkFolder.SelectedIndex = i;
                    bFound = true;
                    break;
                }
            }
            if (!bFound)
            {
                this.comboBoxNetworkFolder.SelectedIndex = this.comboBoxNetworkFolder.Items.Add(DriveToMap);
            }
        }