예제 #1
0
파일: MainForm.cs 프로젝트: akx/lanline
        void AddHostBtnClick(object sender, EventArgs e)
        {
            string ip = PromptWindow.Prompt("Add Host", "Enter host IP address:", "");

            if (ip == null)
            {
                return;
            }
            bool ok = false;

            while (!ok)
            {
                ok = (NetworkManager.Instance.AddHost(ip, NetworkManager.LANLINE_PORT, true) != null);
                if (!ok)
                {
                    if (MessageBox.Show(
                            "Could not verify that the host is alive.\n" +
                            "Are you sure Lanline is running on it?\n\n" +
                            "Try the same host again?", "Oops.", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) !=
                        DialogResult.Yes
                        )
                    {
                        break;
                    }
                }
            }
            RefreshHostsList();
        }
예제 #2
0
파일: MainForm.cs 프로젝트: akx/lanline
        void SharesListDragDrop(object sender, DragEventArgs e)
        {
            DataObject       dobj = e.Data as DataObject;
            StringCollection sc   = dobj.GetFileDropList();

            foreach (string s in sc)
            {
                if (Directory.Exists(s))
                {
                    string defVpath = Path.GetFileName(s.TrimEnd('\\'));
                    string vpath    = PromptWindow.Prompt(
                        "Virtual Path",
                        "Enter the virtual path for the new share " + s + " (or just accept the default if you feel like that)",
                        defVpath
                        );
                    if (vpath != null)
                    {
                        if (!ShareManager.Instance.AddPath(s, vpath))
                        {
                            MessageBox.Show("Could not add the path. Duplicate vpath, maybe?");
                        }
                    }
                }
            }
            RefreshSharesList();
        }
예제 #3
0
파일: PromptWindow.cs 프로젝트: akx/lanline
        public static String Prompt(string title, string label, string value)
        {
            PromptWindow pw = new PromptWindow();

            pw.label.Text    = label;
            pw.Text          = title;
            pw.textBox1.Text = value;
            if (pw.ShowDialog() == DialogResult.OK)
            {
                return(pw.textBox1.Text);
            }
            return(null);
        }