Пример #1
0
        private void previewSelectedFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (lastObjContextMenu != null)
            {
                if (lastObjContextMenu is CheckedListBox)
                {
                    if ((lastObjContextMenu as CheckedListBox).SelectedIndex >= 0)
                    {
                        string selectedFile = ((lastObjContextMenu as CheckedListBox).Items[(lastObjContextMenu as CheckedListBox).SelectedIndex] as MyFileStruct).fullFileName;

                        if (File.Exists(selectedFile))
                        {
                            MyDateContainer newContainer = new MyDateContainer(selectedFile);
                            textBox7.Clear();
                            textBox8.Clear();
                            int    counter = 0;
                            string line;
                            System.IO.StreamReader file = new System.IO.StreamReader(selectedFile);
                            while ((line = file.ReadLine()) != null)
                            {
                                System.Console.WriteLine(line);
                                counter++;
                                textBox7.Text += line + Environment.NewLine;                                //Just write the Line!
                                textBox8.Text += newContainer.AddNewStreet(line).overpassQuery.ToString() + "" + Environment.NewLine;
                                //textBox8.Text += ConvertAdrRawToUsable(line);
                            }
                        }
                        else
                        {
                            MessageBox.Show("The file selected was not found!\n (" + selectedFile + ")");
                        }
                    }
                    else
                    {
                        (lastObjContextMenu as CheckedListBox).SelectedIndex = 0;
                        MessageBox.Show("Please select (highlight) a clb itemline before you call this function!\nFor reference - the first item is now selected!");
                    }
                }
            }
        }
Пример #2
0
        private void previewSelectedFileToolStripMenuItem_Click2(object sender, EventArgs e)
        {
            if (lastObjContextMenu != null)
            {
                if (lastObjContextMenu is CheckedListBox)
                {
                    if ((lastObjContextMenu as CheckedListBox).SelectedIndex >= 0)
                    {
                        string selectedFile = ((lastObjContextMenu as CheckedListBox).Items[(lastObjContextMenu as CheckedListBox).SelectedIndex] as MyFileStruct).fullFileName;
                        textBox10.Text = ((lastObjContextMenu as CheckedListBox).Items[(lastObjContextMenu as CheckedListBox).SelectedIndex] as MyFileStruct).ToString() + ".js";
                        string saveToFile = textBox9.Text + textBox10.Text;                         //---> See bottom!

                        if (File.Exists(selectedFile))
                        {
                            MyDateContainer newContainer = new MyDateContainer(selectedFile);
                            textBox7.Clear();
                            textBox8.Clear();
                            int    counter = 0;
                            string line;
                            System.IO.StreamReader file = new System.IO.StreamReader(selectedFile);
                            textBox11.Clear();

                            /*
                             * textBox11.Text = @"{{geocodeArea:Karlsruhe}}->.searchArea;
                             * (
                             * ";
                             */
                            textBox13.Clear();
                            textBox13.Text = "var streetparts = [";
                            string laststr = "";
                            while ((line = file.ReadLine()) != null)
                            {
                                if (laststr != "")
                                {
                                    textBox13.Text += "," + Environment.NewLine;
                                }
                                System.Console.WriteLine(line);
                                counter++;
                                textBox7.Text += line + Environment.NewLine;                                  //Just write the Line!
                                //textBox11.Text +=
                                newContainer.AddNewStreet(line).overpassQuery.ToString();
                                textBox13.Text += '"' + line.Substring(0, line.Length - 2) + '"';
                                laststr         = ",";
                                //textBox8.Text += ConvertAdrRawToUsable(line);
                            }
                            textBox13.Text += "]; " + Environment.NewLine + Environment.NewLine + " var streetpartsgeojson = ";

                            /*textBox11.Text+= @");
                             * (
                             * ._;
                             * >;
                             * );
                             * out; ";*/
                            textBox11.Text = newContainer.GetOverPassTurboQuery(true);

                            if (File.Exists(saveToFile))
                            {
                                tabControl4.SelectTab(2);
                            }
                            else
                            {
                                tabControl4.SelectTab(0);
                            }
                        }
                        else
                        {
                            MessageBox.Show("The file selected was not found!\n (" + selectedFile + ")");
                        }
                    }
                    else
                    {
                        (lastObjContextMenu as CheckedListBox).SelectedIndex = 0;
                        MessageBox.Show("Please select (highlight) a clb itemline before you call this function!\nFor reference - the first item is now selected!");
                    }
                }
            }
        }