Ejemplo n.º 1
0
        private void DataBind()
        {
            if (foldersDataSet != null)
            {
                if (foldersDataSet.Tables.Count > 0)
                {
                    foreach (Folders.WebSiteRow row in foldersDataSet.WebSite)
                    {
                        ThreadItem itm = new ThreadItem(row.ID, row.Port, row.Vpath, row.Path);

                        listView1.Items.Add(itm);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        internal void AddItem(string port, string vpath, string path, bool startServer)
        {
            ListViewItem item;

            DataRow[] rows =
                foldersDataSet.WebSite.Select(String.Format(Resources.SiteSearchString, port, vpath, path));

            //check if item is in the dataset
            if (rows.Length == 0)
            {
                Folders.WebSiteRow row = foldersDataSet.WebSite.NewWebSiteRow();
                row.Path  = path;
                row.Port  = port;
                row.Vpath = vpath;
                row.ID    = Guid.NewGuid();

                foldersDataSet.WebSite.AddWebSiteRow(row);
                foldersDataSet.AcceptChanges();

                string filepath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Resources.SaveFile);



                foldersDataSet.WriteXml(filepath);

                ThreadItem itm = new ThreadItem(row.ID, row.Port, row.Vpath, row.Path);

                item = listView1.Items.Add(itm);
            }
            else
            {
                item = listView1.FindItemWithText(((Folders.WebSiteRow)rows[0]).ID.ToString());
            }

            //start the server if it told to
            if (startServer)
            {
                if (item != null)
                {
                    item.Selected = true;
                    StartServer(item);
                    Thread.Sleep(1000);
                    //OpenBrowser(item.SubItems[1].Text, item.SubItems[2].Text);
                }
            }
        }