private void Button4_Click(object sender, EventArgs e) { SearchForm searchForm = new SearchForm(this); searchForm.Show(); }
/** Loads the users category settings from their OneDrive. Searches for a file named Consultation_plus_categories.txt. if it doesnt * find a file it loads in predefined categories. The user can add more categories that they themselves create. If the file is found * we simply just load their categories in. */ public async static void LoadCategories() { try { var stream = await graphClient.Me.Drive.Special.AppRoot.ItemWithPath("categories.txt").Content.Request().GetAsync(); // We found a file with categories in them so we load those. StreamReader reader = new StreamReader(stream); dynamic obj = JsonConvert.DeserializeObject(reader.ReadToEnd()); foreach (var item in obj) { List <string> temp = new List <string>(); foreach (string site in item.GetValue("Sites_to_exclude")) { temp.Add(site); } Program.categories.Add(new Category(item.Name.ToString(), temp, (bool)item.Ticked)); } } catch (Microsoft.Graph.ServiceException) { // Load predefined categories. // make it so it loads it in from a text files List <Category> cat = new List <Category>() { new Category("General Practice (Recommended)", new List <string>() { "www.bad.org.uk", "www.pcds.org.uk", "www.ukdctn.org", "bdng.org.uk", "www.aan.com", "www.thebrainmatters.org", "www.neuroguide.com", "www.wfneurology.org", "www.neurology.co.in", "aaa.org", "apexcardiology.com", "bhvci.com", "pacificheart.com", "gpnotebook.com", "bnf.nice.org.uk", "bnfc.nice.org.uk", "products.mhra.gov.uk", "www.hee.nhs.uk", "www.sign.ac.uk", "www.nhs.uk", "rcgp.org.uk" }, true), new Category("Dermatology", new List <string>() { "healthline.com", "NIH.gov", "CDC.gov", "drugs.com", "WHO.int", "medlineplus.gov", "hopkinsmedicine.org", "www.aan.com", "www.thebrainmatters.org", "www.neuroguide.com", "www.wfneurology.org", "www.neurology.co.in", "aaa.org", "apexcardiology.com", "bhvci.com", "pacificheart.com", "gpnotebook.com", "bnf.nice.org.uk", "bnfc.nice.org.uk", "products.mhra.gov.uk", "www.hee.nhs.uk", "www.sign.ac.uk", "www.nhs.uk", "rcgp.org.uk" }, true), new Category("Neurology", new List <string>() { "healthline.com", "NIH.gov", "CDC.gov", "drugs.com", "WHO.int", "medlineplus.gov", "hopkinsmedicine.org", "www.bad.org.uk", "www.pcds.org.uk", "www.ukdctn.org", "bdng.org.uk", "aaa.org", "apexcardiology.com", "bhvci.com", "pacificheart.com", "gpnotebook.com", "bnf.nice.org.uk", "bnfc.nice.org.uk", "products.mhra.gov.uk", "www.hee.nhs.uk", "www.sign.ac.uk", "www.nhs.uk", "rcgp.org.uk", "www.aan.com" }, true), new Category("Cardiology", new List <string>() { "healthline.com", "NIH.gov", "CDC.gov", "drugs.com", "WHO.int", "medlineplus.gov", "hopkinsmedicine.org", "www.bad.org.uk", "www.pcds.org.uk", "www.ukdctn.org", "bdng.org.uk", "www.aan.com", "www.thebrainmatters.org", "www.neuroguide.com", "www.wfneurology.org", "www.neurology.co.in", "gpnotebook.com", "bnf.nice.org.uk", "bnfc.nice.org.uk", "products.mhra.gov.uk", "www.hee.nhs.uk", "www.sign.ac.uk", "www.nhs.uk", "rcgp.org.uk" }, true) }; Program.categories = cat; } SearchForm form = new SearchForm(); form.StartPosition = FormStartPosition.Manual; int oldFormHeight = form.Height; form.Height = form.Top - form.searchPanel.Bottom; form.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - form.Width, Screen.PrimaryScreen.WorkingArea.Height - oldFormHeight); form.Show(); }