Пример #1
0
    static void Init()
    {
        // Get existing open window or if none, make a new one:
        TestEditor window = (TestEditor)EditorWindow.GetWindow(typeof(TestEditor));

        window.Show();
    }
Пример #2
0
        public void AddTheme()
        {
            IAddTestView v = View;

            if (v.TestName.Length < 2)
            {
                v.Message = "Длина названия темы должна быть больше 2-х символов!";
                return;
            }
            if (!decimal.TryParse(v.Time, out var time))
            {
                v.Message = "Не верный формат времени. (пример 45)";
                return;
            }

            using var context = new Context();

            var test = new Test
            {
                Name        = v.TestName,
                Description = v.Description,
                Time        = time,
                UserId      = GetUserDataService.CurrentUser.Id
            };

            context.Tests.Add(test);

            context.SaveChanges();

            var form = new TestEditor(test);

            form.ShowDialog();
        }
Пример #3
0
    public static void Set()
    {
        TestEditor window = (TestEditor)EditorWindow.GetWindow(typeof(TestEditor), false, "Test Editor");

        window.Show();
        EditorWindow.GetWindow(typeof(TestEditor));
    }
Пример #4
0
    static void CreateWindow()
    {
        TestEditor window = EditorWindow.GetWindow <TestEditor>("音效管理");

        window.Show();
        // window.position = new Rect(0, 0, 500, 500);
    }
Пример #5
0
        public static void Duplicate(string from, string dir, Action onNameGet, Action <string, string> onFinish)
        {
            TextInput.GetInput("Enter a name for your test.", "Test", name =>
            {
                onNameGet();

                // Cancels if they didn't input anything.
                if (name == "")
                {
                    onFinish("", dir);
                    return;
                }

                var test = new Test(from, dir);

                if (!test.TryLoadQuestions())
                {
                    return;
                }

                var editor = new TestEditor(name, test.description, test.questions);

                editor.onFinish = () =>
                {
                    editor.Save(dir + "/" + name);

                    onFinish(name, dir);
                };

                editor.Show();
            }, "", s =>
            {
                return(TextInput.dirNameValid(s) && !Helper.Exists(dir + s));
            });
        }
 public static void Init()
 {
     if (instance == null)
     {
         //instance = EditorWindow.GetWindow<EditorWindow>("test") as TestEditor;
         instance = (TestEditor)EditorWindow.GetWindow <TestEditor>("test");
     }
     instance.position = new Rect(400, 200, 600, 400);
     instance.Show();
 }
Пример #7
0
        public override void Run()
        {
            var textEditor = new TestEditor();
            var clr        = new Clr();
            var compiler   = new Compiler();

            var ide = new VisualStudioFacade(textEditor, compiler, clr);

            var programmer = new Programmer(ide);
        }
Пример #8
0
    [MenuItem("툴/첫번째 임시 에디터")] //[반각 스페이스 + 수식자 키 + 임의의 문자] 띄어쓰기 + 임의문자(%#F Ctrl+Shift+F)
// % : Ctrl(Windows) 혹은 command(MacOSX) # : Shift & : Alt(Windows) 혹은 option(Mac OS X) _ : 수식자 키 없음
// F1...F12 : Function키 HOME : Home 키 END : End 키 PGUP : PageUp 키  PGDN : PageDown 키 KP0...KP9 : 0부터 9까지의 숫자키
// KP. : . KP+ : + KP- : - KP* : * KP/ : / KP= : =

    static void Init()
    {
        TestEditor window = (TestEditor)EditorWindow.GetWindow(typeof(TestEditor)); //탭윈도우처럼 부착가능

        Texture icon = AssetDatabase.LoadAssetAtPath <Texture>("Assets/Editor/Example.png");

        //Texture tex = EditorGUIUtility.Load("logo.png") as Texture;

        window.titleContent = new GUIContent("ㅋㅋ", icon);
        window.Show();

        string menuPath   = "툴/첫번째 임시 에디터";
        bool   tmpchecked = Menu.GetChecked(menuPath);

        Menu.SetChecked(menuPath, !tmpchecked); //에디터가 켜지면 체크표시됨
    }
Пример #9
0
        public static void Create(string dir, Action onNameGet, Action <string, string> onFinish)
        {
            // Asks for the name of the test.
            TextInput.GetInput("Enter a name for your test.", "Test", name =>
            {
                onNameGet();

                // Cancels if they didn't input anything.
                if (name == "")
                {
                    onFinish("", dir);
                    return;
                }

                var editor = new TestEditor(name);

                /*
                 * If the test is discarded or it fails to save,
                 * it calls the onFinish delegate but without
                 * a returned name.
                 */

                editor.onFinish = () =>
                {
                    if (editor.DialogResult == DialogResult.OK)
                    {
                        if (editor.Save(dir + "/" + name))
                        {
                            onFinish(name, dir);
                        }
                        else
                        {
                            onFinish("", dir);
                        }
                    }
                    else
                    {
                        onFinish("", dir);
                    }
                };

                editor.Show();
            }, "", s =>
            {
                return(TextInput.dirNameValid(s) && !Helper.Exists(dir + s));
            });
        }
Пример #10
0
        public void Setup()
        {
            _editor   = new TestEditor();
            _testForm = new TestForm();
            _testForm.Controls.Add(_editor);

            _buttonNotInEditor = new Button();
            _testForm.Controls.Add(_buttonNotInEditor);

            _panelInEditorOuter = new Panel();
            _panelInEditorInner = new Panel();
            _buttonInEditor     = new Button();
            _textBoxInEditor    = new TextBox();
            _labelInEditor      = new Label();

            _panelInEditorInner.Controls.AddRange(new Control[] { _labelInEditor, _buttonInEditor });
            _panelInEditorOuter.Controls.AddRange(new Control[] { _panelInEditorInner, _textBoxInEditor });
            _editor.Controls.Add(_panelInEditorOuter);
        }
Пример #11
0
        public static void Edit(string name, string dir, Action <string, string> onFinish)
        {
            var test = new Test(name, dir);

            if (!test.TryLoadQuestions())
            {
                return;
            }

            var editor = new TestEditor(name, test.description, test.questions);

            editor.onFinish = () =>
            {
                editor.Save(dir + "/" + name);

                onFinish(name, dir);
            };

            editor.Show();
        }
Пример #12
0
        public void EditTest()
        {
            var form = new TestEditor(View.SelectedTest);

            form.ShowDialog();
        }
Пример #13
0
    static void Init()
    {
        TestEditor testEditor = (TestEditor)EditorWindow.GetWindow(typeof(TestEditor));

        testEditor.Show();
    }
Пример #14
0
        public void DefaultConstructorTest()
        {
            var target = new TestEditor();

            Assert.IsNotNull(target);
        }
 public VisualStudioFacade(TestEditor textEditor, Compiler compiler, Clr clr)
 {
     _textEditor = textEditor;
     _compiler   = compiler;
     _clr        = clr;
 }
Пример #16
0
        public void SetUp()
        {
            var complexEditorConfig = new NestedContentConfiguration
            {
                ContentTypes = new[]
                {
                    new NestedContentConfiguration.ContentType {
                        Alias = "feature"
                    }
                }
            };

            ComplexTestEditor complexTestEditor           = Services.GetRequiredService <ComplexTestEditor>();
            TestEditor        testEditor                  = Services.GetRequiredService <TestEditor>();
            IDataTypeService  dataTypeService             = Services.GetRequiredService <IDataTypeService>();
            IConfigurationEditorJsonSerializer serializer = Services.GetRequiredService <IConfigurationEditorJsonSerializer>();

            var complexDataType = new DataType(complexTestEditor, serializer)
            {
                Name          = "ComplexTest",
                Configuration = complexEditorConfig
            };

            var testDataType = new DataType(testEditor, serializer)
            {
                Name = "Test",
            };

            dataTypeService.Save(complexDataType);
            dataTypeService.Save(testDataType);

            IFileService fileService = Services.GetRequiredService <IFileService>();
            Template     template    = TemplateBuilder.CreateTextPageTemplate();

            fileService.SaveTemplate(template);

            _contentType = ContentTypeBuilder.CreateTextPageContentType(ContentTypeAlias, defaultTemplateId: template.Id);

            // add complex editor
            foreach (IPropertyType pt in _contentType.PropertyTypes)
            {
                pt.DataTypeId = testDataType.Id;
            }

            _contentType.AddPropertyType(
                new PropertyType(_shortStringHelper, "complexTest", ValueStorageType.Ntext)
            {
                Alias = "complex", Name = "Complex", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = complexDataType.Id
            },
                "content", "Content");

            // make them all validate with a regex rule that will not pass
            foreach (IPropertyType prop in _contentType.PropertyTypes)
            {
                prop.ValidationRegExp        = "^donotmatch$";
                prop.ValidationRegExpMessage = "Does not match!";
            }

            IContentTypeService contentTypeService = Services.GetRequiredService <IContentTypeService>();

            contentTypeService.Save(_contentType);
        }
Пример #17
0
 protected sealed override Editor CreateEditor() => Editor = CreateTestEditor(this);
Пример #18
0
        public void TestEditorConstructorTest()
        {
            var target = new TestEditor(false);

            Assert.IsNotNull(target);
        }
 static void DoTest()
 {
     TestEditor.Init();
 }