コード例 #1
0
        // "Search" button, also "Cancel" button, change when it is clicked
        // program status and Cancelled status also changed when this button is clicked
        private void SearchOnClick(object sender, EventArgs e)
        {
            KeyWord = SearchforTextBox.Text;
            if (SearchButton.Text == "Cancel")
            {
                FileNameTextBox.ReadOnly  = false;
                SearchforTextBox.ReadOnly = false;
                toolStripStatusLabel.Text = "Searching precess is cancellend.";
                StatusBar.Refresh();
                SearchButton.Text = "Search";
                Cancelled         = true;
            }
            else if (SearchButton.Text == "Search")
            {
                FileNameTextBox.ReadOnly  = true;
                SearchforTextBox.ReadOnly = true;
                toolStripStatusLabel.Text = "Searching precess start.";
                StatusBar.Refresh();
                ResultListView.Items.Clear();
                ResultListView.Update();
                ResultListView.Refresh();
                ProgressBar.Value = 0;
                SearchButton.Text = "Cancel";
                Cancelled         = false;
            }

            if (!Cancelled)
            {
                myBackgroundWorker.RunWorkerAsync();
            }
            else
            {
                myBackgroundWorker.CancelAsync();
            }
        }
コード例 #2
0
        private async void SearchButton_ClickAsync(object sender, EventArgs e)
        {
            SetupListView();
            Cursor = Cursors.WaitCursor;
            var ost = await SearchGoogleGeo(SearchTextBox.Text);

            Cursor = Cursors.Default;
            foreach (var item in ost.Results)
            {
                var lvi = new ListViewItem
                {
                    Text = item.Formatted_address,
                    Tag  = item
                };

                var latItem = new ListViewItem.ListViewSubItem
                {
                    Text = item.Geometry.Location.Lat.ToString()
                };

                var lonItem = new ListViewItem.ListViewSubItem
                {
                    Text = item.Geometry.Location.Lng.ToString()
                };

                lvi.SubItems.Add(latItem);
                lvi.SubItems.Add(lonItem);

                ResultListView.Items.Add(lvi);
            }
            ResultListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            ResultListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
        }
コード例 #3
0
        // search item function
        public void SearchFunction()
        {
            string Input = SearchInput.Text.Replace(" ", "+");

            try
            {
                WebClient client = new WebClient();
                client.Proxy = null;
                Stream       stream = client.OpenRead("http://services.runescape.com/m=itemdb_rs/api/catalogue/items.json?category=" + CatagoryBox.SelectedIndex + "&alpha=" + Input + "&page=1");
                StreamReader reader = new StreamReader(stream);
                jObject = JObject.Parse(reader.ReadLine());
                stream.Close();
            }
            catch
            {
            }

            ResultListView.BeginUpdate();
            ResultListView.Items.Clear();

            i = 0;
            try
            {
                while (true)
                {
                    var lvi = new ListViewItem(new string[] { (string)jObject["items"][i]["name"], (string)jObject["items"][i]["id"], (string)jObject["items"][i]["current"]["price"] });
                    ResultListView.Items.Add(lvi);
                    i++;
                }
            }
            catch
            {
                ResultListView.EndUpdate();
            }
        }
コード例 #4
0
 private void ItemLookup_Load(object sender, EventArgs e)
 {
     StyleManager.Theme = MainForm.data.Theme;
     StyleManager.Style = MainForm.data.Colour;
     this.Theme         = StyleManager.Theme;
     ResultListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
     ResultListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
 }
コード例 #5
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //testdata to be disabled
            TestData testdata = new TestData();

            testdata.data();
            ResultListView.SetObjects(resultlist);
            collapseGroup();
        }
コード例 #6
0
        private void SetupListView()
        {
            ResultListView.Clear();
            _ = new ListView.ColumnHeaderCollection(ResultListView)
            {
                "Adresse",
                "Latitude",
                "Longitude"
            };

            ResultListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            ResultListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
        }
コード例 #7
0
 public void Show()
 {
     ResultListView.Clear();
     Array.Sort(input);
     for (int j = 0; j < 100; j++)
     {
         int v = input[j];
         if (v > 0)
         {
             ResultListView.Items.Add(Convert.ToString(input[j]));
         }
     }
 }
コード例 #8
0
 public void Even()
 {
     ResultListView.Clear();
     for (int j = 0; j < i; j++)
     {
         int v = input[j];
         int x = (Convert.ToInt32(input[j])) % 2;
         if (x == 0 && v > 0)
         {
             ResultListView.Items.Add(input[j].ToString());
         }
     }
 }
コード例 #9
0
        public T GetItem(int index)
        {
            var cnt = Count;

            if (cnt == 0 || index >= cnt)
            {
                return(null);
            }

            var listItem = ResultListView.FindGeneric(Search.By <ListViewItem>().AndByIndex(index), depth: 1);

            return(mItemFactory(listItem));
        }
コード例 #10
0
ファイル: MainWindowViewModel.cs プロジェクト: sgww/cozy
        public void PushResults(List <Result> results)
        {
            ResultListView.Clear();

            if (results.Count > 0)
            {
                IsResultViewVisiable = true;

                ResultListView.AddRange(results);

                SelectedResultIndex = 0;
            }
            else
            {
                IsResultViewVisiable = false;
            }
        }
コード例 #11
0
        private void DisplayList(string filename, List <Accounts> list)
        {
            Accounts accounts   = new Accounts();
            String   path       = Directory.GetCurrentDirectory();                          //and the data in the list is written to the data file
            string   file       = filename + ".txt";
            string   pathString = Path.Combine(path, file);

            list.Clear();
            using (StreamReader SR = new StreamReader(pathString))              // StreamReader to read values from file
            {
                int    i      = 0;
                Logins logins = new Logins();
                String S      = SR.ReadLine();
                while (S != null)
                {
                    i++;
                    if (i == 1)
                    {
                        accounts.Type = S;
                    }
                    else if (i == 2)
                    {
                        accounts.Username = S;
                    }
                    else if (i == 3)
                    {
                        accounts.Password = S;
                        list.Add(new Accounts(accounts.Type, accounts.Username, accounts.Password));
                        i        = 0;
                        accounts = new Accounts();
                    }
                    S = SR.ReadLine();
                }
            }

            ResultListView.Clear();
            ResultListView.Columns.Add("Account", 120);
            ResultListView.Columns.Add("User ID", 230);
            for (int i = 0; i < list.Count; i++)
            {
                ListViewItem item1 = new ListViewItem(list[i].Type, 0);             //Add the list items into the view
                item1.SubItems.Add(list[i].Username);
                ResultListView.Items.AddRange(new ListViewItem[] { item1 });
            }
        }
コード例 #12
0
        // search item function
        public void SearchFunction()
        {
            string Input = SearchInput.Text.Replace(" ", "+");

            try
            {
                WebClient client = new WebClient();
                client.Proxy = null;
                Stream       stream = client.OpenRead("http://services.runescape.com/m=itemdb_rs/bestiary/beastSearch.json?term=" + Input);
                StreamReader reader = new StreamReader(stream);
                var          json   = reader.ReadToEnd();
                json1 = JsonConvert.DeserializeObject <dynamic[]>(json);

                stream.Close();
            }
            catch
            {
            }

            ResultListView.BeginUpdate();
            ResultListView.Items.Clear();

            i = 0;
            Console.WriteLine();
            try
            {
                while (true)
                {
                    var lvi = new ListViewItem(new string[] { (string)json1[i].label, (string)json1[i].value });
                    ResultListView.Items.Add(lvi);
                    i++;
                }
            }
            catch
            {
                ResultListView.EndUpdate();
            }
        }
コード例 #13
0
ファイル: MainWindowViewModel.cs プロジェクト: sgww/cozy
 public void Clear()
 {
     this.OnPropertyChanged("SystemCommand.ClearEditBox");
     ResultListView.Clear();
 }
コード例 #14
0
 private void SelectAllCommand_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     ResultListView.SelectAll();
 }