Esempio n. 1
0
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            // 환경 검사
            MessageBox.Show($"EnvironmentType : {EnvironmentUtility.Type}\n{EnvironmentUtility.GetEnvironment().Version}", "실행된 환경");

            // 기본 블럭 추가
            listBlock.Items.Add(new EventBlock(new GCommand("this", "Loaded", "프로그램이 시작될 때", typeof(void), GCommand.CommandType.Event)));
            listBlock.Items.Add(new EventBlock(new GCommand("this", "Closing", "프로그램이 종료될 때", typeof(void), GCommand.CommandType.Event)));

            listBlock.Items.Add(new IfBlock());
            listBlock.Items.Add(new IfElseBlock());
            listBlock.Items.Add(new SetBlock());

            listBlock.Items.Add(new GateBlock());
            listBlock.Items.Add(new CompareBlock());

            listBlock.Items.Add(new EmptyListBlock());
            listBlock.Items.Add(new ItemBlock());
            listBlock.Items.Add(new ListAddBlock());

            listBlock.Items.Add(new ComputeBlock(GCompute.OperatorType.PLUS));
            listBlock.Items.Add(new ComputeBlock(GCompute.OperatorType.MINUS));
            listBlock.Items.Add(new ComputeBlock(GCompute.OperatorType.MULTIPLY));
            listBlock.Items.Add(new ComputeBlock(GCompute.OperatorType.DIVISION));
            listBlock.Items.Add(new ComputeBlock(GCompute.OperatorType.MODULO));

            listBlock.Items.Add(new StringCatBlock());
            listBlock.Items.Add(new LengthBlock());

            listBlock.Items.Add(new LoopInfinityBlock());
            listBlock.Items.Add(new LoopNBlock());

            // 확장 블럭 추가
            if (Directory.Exists("Extensions"))
            {
                var extension = new ExtensionManager("Extensions");
                foreach (var target in extension.Extensions)
                {
                    foreach (BaseBlock block in extension.ConvertToBlocks(target))
                    {
                        block.IsPreview = true;
                        listBlock.Items.Add(block);
                    }
                }
            }

            // 간격 및 이벤트 설정
            foreach (BaseBlock block in listBlock.Items)
            {
                block.Margin = new Thickness(0, 0, 0, 10);
                SetBlockEvent(block);
            }
        }