Beispiel #1
0
        /// <summary>
        /// Double click on the error bring on the error's line
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ListViewError_OnItemActive(object sender, EventArgs e)
        {
            return;

            int l = Convert.ToInt32(ErrorListView.SelectedItems[0].SubItems[1].Text);
            int i, pos;

            if (l != 0)
            {
                i   = 1;
                pos = 0;
                while (i < l)
                {
                    pos = ScriptTxt.Text.IndexOf(Environment.NewLine, pos + 1);
                    i++;
                }
                //ScriptTxt.SelectionStart = pos;
                //ScriptTxt.SelectionLength = ScriptTxt.Text.IndexOf(Environment.NewLine, pos + 1) - pos;
            }

            ScriptTxt.Focus();
        }
Beispiel #2
0
        /// <summary>
        /// Code completion
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CompletionRequest(object sender, CompletionEventArgs e)
        {
            if (ScriptTxt.CompletionWindowVisible)
            {
                return;
            }

            // e.Key contains the key that the user wants to insert and which triggered
            // the CompletionRequest.
            // e.Key == '\0' means that the user triggered the CompletionRequest by pressing <Ctrl> + <Space>.

            if (e.Key == '\0')
            {
                // The user has requested the completion window by pressing <Ctrl> + <Space>.
                ScriptTxt.ShowCompletionWindow(new CodeCompletionDataProvider(), e.Key, false);
            }
            else if (char.IsLetter(e.Key))
            {
                // The user is typing normally.
                // -> Show the completion to provide suggestions. Automatically close the window if the
                // word the user is typing does not match the completion data. (Last argument.)
                ScriptTxt.ShowCompletionWindow(new CodeCompletionDataProvider(), e.Key, true);
            }
        }
Beispiel #3
0
 /// <summary>
 /// Clear source code
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ClearScriptBox_Click(object sender, EventArgs e)
 {
     ScriptTxt.Document.TextContent = string.Empty;
     ScriptTxt.Update();
 }
 private static IList<ScriptTxt> ReadTxt(string filename)
 {
     FileStream fs = null;
     StreamReader sr = null;
     IList<ScriptTxt> list = new List<ScriptTxt>();
     try
     {
         fs = new FileStream(filename, FileMode.Open, FileAccess.Read);
         sr = new StreamReader(fs, Encoding.UTF8);
         while (!sr.EndOfStream)
         {
             ScriptTxt st = new ScriptTxt();
             st.Text = sr.ReadLine();
             if (string.IsNullOrEmpty(st.Text))
             {
                 st.Text = "\0";
             }
             list.Add(st);
         }
         return list;
     }
     catch (Exception ex)
     {
         sw_WriteLog(ex.Message, null);
         return null;
     }
     finally
     {
         if (sr != null)
             sr.Close();
         if (fs != null)
             fs.Close();
     }
 }