public static bool RemoveItemFromCodeListbox(int removeLine)
 {
     if (removeLine >= 0 && removeLine < HalationViewCommand.LineCount())
     {
         Halation.mainView.codeListBox.Items.RemoveAt(removeLine);
         return(true);
     }
     return(false);
 }
Esempio n. 2
0
 public static bool RemoveItemFromCodeListbox(int removeLine)
 {
     if (removeLine >= 0 && removeLine < HalationViewCommand.LineCount())
     {
         Halation.mainView.codeListBox.Items.RemoveAt(removeLine);
         Halation.mainView.codeGroupBox.Text =
             $@"脚本 [{Halation.currentScriptName}] (Line: {Halation.currentCodePackage.GetAction().Count})";
         return(true);
     }
     return(false);
 }
        public static bool AddItemToCodeListbox(int insertLine, int indent, string text)
        {
            StringBuilder indentSb = new StringBuilder();

            for (int i = 0; i < indent; i++)
            {
                indentSb.Append(" ");
            }
            if (insertLine >= 0 && insertLine <= HalationViewCommand.LineCount())
            {
                Halation.mainView.codeListBox.Items.Insert(insertLine, indentSb.ToString() + text);
                return(true);
            }
            else if (insertLine == -1)
            {
                Halation.mainView.codeListBox.Items.Add(indentSb.ToString() + text);
                return(true);
            }
            return(false);
        }
Esempio n. 4
0
        public static bool AddItemToCodeListbox(int insertLine, int indent, string text)
        {
            StringBuilder indentSb = new StringBuilder();

            for (int i = 0; i < indent; i++)
            {
                indentSb.Append(" ");
            }
            if (insertLine >= 0 && insertLine <= HalationViewCommand.LineCount())
            {
                Halation.mainView.codeListBox.Items.Insert(insertLine, indentSb.ToString() + text);
                Halation.mainView.codeGroupBox.Text =
                    $@"脚本 [{Halation.currentScriptName}] (Line: {Halation.currentCodePackage.GetAction().Count})";
                return(true);
            }
            else if (insertLine == -1)
            {
                Halation.mainView.codeListBox.Items.Add(indentSb.ToString() + text);
                Halation.mainView.codeGroupBox.Text =
                    $@"脚本 [{Halation.currentScriptName}] (Line: {Halation.currentCodePackage.GetAction().Count})";
                return(true);
            }
            return(false);
        }