Esempio n. 1
0
        public EditQuote(Sqlite db, string quoteString)
        {
            InitializeComponent();

            this.db      = db;
            changed      = false;
            tChanged     = false;

            string[] arg      = parseString(quoteString);
            quoteText.Text    = arg[0].Trim();
            authorText.Text   = arg[1].Trim();
            locationText.Text = arg[2].Trim();

            string sql = "SELECT id FROM quotes WHERE quotes='" + ReplaceQuoteChar(quoteText.Text) + "';";
            id         = db.GetID<long>(sql);

            // Get tags from database and update tag textbox.
            string[] tagList = GetTags();
            origTags         = new string[tagList.Length];
            for (int i = 0; i < tagList.Length; i++)
            {
                origTags[i]   = tagList[i];     // Keep a copy

                if (i + 1 == tagList.Length)
                {
                    tagText.Text += tagList[i];
                }
                else
                {
                    tagText.Text += tagList[i] + ", ";
                }
            }

            authorText.TextChanged +=
                new EventHandler(authorText_TextChanged);
            quoteText.TextChanged +=
                new EventHandler(quoteText_TextChanged);
            locationText.TextChanged +=
                new EventHandler(locationText_TextChanged);
            tagText.TextChanged +=
                new EventHandler(tagText_TextChanged);
        }