Пример #1
0
 static public void RegisterToKeyboard(ITextArea textarea)
 {
     keyDelegates.Add(textarea);
     IoManager.window.KeyPressed  += textarea.OnKeyPressed;
     IoManager.window.KeyReleased += textarea.OnKeyReleased;
     IoManager.window.TextEntered += textarea.OnTextEntered;
 }
Пример #2
0
        public XleGameControl(
            IXleScreen screen,
            IStatsDisplay statsDisplay,
            IXleWaiter waiter,
            IXleInput input,
            ISoundMan soundMan,
            ITextArea textArea,
            GameState gameState,
            XleSystemState systemState)
        {
            this.screen       = screen;
            this.statsDisplay = statsDisplay;
            this.waiter       = waiter;
            this.input        = input;
            this.soundMan     = soundMan;
            this.textArea     = textArea;
            this.gameState    = gameState;
            this.systemState  = systemState;

            soundMan.ErrorMessage += message =>
            {
                textArea.PrintLine();
                textArea.PrintLine(message);
            };

            textArea.Waiter += WaitAsync;
        }
Пример #3
0
        public CommandExecutor(
            GameState state,
            ICommandList commands,
            IXleGameControl gameControl,
            IXleInput input,
            ISoundMan soundMan,
            IPlayerDeathHandler deathHandler,
            IPlayerAnimator characterAnimator,
            ITextArea textArea)
        {
            gameState           = state;
            this.commands       = commands;
            this.gameControl    = gameControl;
            this.input          = input;
            this.textArea       = textArea;
            this.soundMan       = soundMan;
            this.playerAnimator = characterAnimator;
            this.deathHandler   = deathHandler;

            input.DoCommand += (sender, args) =>
            {
                DoCommand(args.Command, args.KeyString);
            };

            mDirectionMap[Keys.Right] = Direction.East;
            mDirectionMap[Keys.Up]    = Direction.North;
            mDirectionMap[Keys.Left]  = Direction.West;
            mDirectionMap[Keys.Down]  = Direction.South;

            mDirectionMap[Keys.OemOpenBrackets] = Direction.North;
            mDirectionMap[Keys.OemSemicolon]    = Direction.West;
            mDirectionMap[Keys.OemQuotes]       = Direction.East;
            mDirectionMap[Keys.OemQuestion]     = Direction.South;
        }
Пример #4
0
 public WeaponCommand(
     ITextArea textArea,
     IEquipmentPicker equipmentPicker)
 {
     this.textArea        = textArea;
     this.equipmentPicker = equipmentPicker;
 }
Пример #5
0
 static public void UnregisterToKeyboard(ITextArea textarea)
 {
     IoManager.window.KeyPressed  -= textarea.OnKeyPressed;
     IoManager.window.KeyReleased -= textarea.OnKeyReleased;
     IoManager.window.TextEntered -= textarea.OnTextEntered;
     keyDelegates.Remove(textarea);
 }
Пример #6
0
 public QuickMenuRunner(
     IXleScreen screen,
     ITextArea textArea,
     IXleGameControl gameControl)
 {
     this.screen      = screen;
     this.TextArea    = textArea;
     this.gameControl = gameControl;
 }
Пример #7
0
 public NumberPicker(
     IXleScreen screen,
     IXleGameControl gameControl,
     ITextArea textArea)
 {
     this.screen      = screen;
     this.gameControl = gameControl;
     this.TextArea    = textArea;
 }
Пример #8
0
        public void Draw(SpriteBatch spriteBatch, ITextArea textArea)
        {
            for (int i = 0; i < 5; i++)
            {
                //int x = 16 + 16 * g.BottomMargin(i);

                //DrawText(x, 368 - 16 * i, g.Bottom(i), g.BottomColor(i));
                int x = 16;

                var line = textArea.GetLine(i);

                DrawText(spriteBatch, x, 304 + 16 * i, line.Text, line.Colors);
            }
        }
Пример #9
0
 public MapChanger(
     GameState gameState,
     IXleScreen screen,
     IXleImages images,
     ITextArea textArea,
     ICommandList commands,
     IMapLoader mapLoader,
     IMuseumCoinSale museumCoinSale)
 {
     this.gameState      = gameState;
     this.screen         = screen;
     this.images         = images;
     this.textArea       = textArea;
     this.commands       = commands;
     this.mapLoader      = mapLoader;
     this.museumCoinSale = museumCoinSale;
 }
Пример #10
0
        private static TextMarkerProvider CreateTextMarkerProvider(ITextArea textView)
        {
            if (textView == null)
            {
                throw new ArgumentNullException("textView");
            }

            TextMarkerProvider property = null;
            IPropertyOwner     owner    = textView;

            if (!owner.TryGetProperty <TextMarkerProvider>("TextMarkerProvider", out property))
            {
                property = new TextMarkerProvider(textView);
                owner.AddProperty("TextMarkerProvider", property);
            }
            return(property);
        }
Пример #11
0
        internal static ToolTipProvider GetToolTipProviderInternal(ITextArea textView)
        {
            if (textView == null)
            {
                throw new ArgumentNullException("textView");
            }

            ToolTipProvider property = null;
            IPropertyOwner  owner    = textView;

            if (!owner.TryGetProperty <ToolTipProvider>("ToolTipProvider", out property))
            {
                property = new ToolTipProvider(textView);
                owner.AddProperty("ToolTipProvider", property);
            }
            return(property);
        }
Пример #12
0
        /// <summary>
        /// Start this instance.
        /// <para xml:lang="es">
        /// Inicia
        /// </para>
        /// </summary>
        public override void Start()
        {
            base.Start();

            //Create an Stack
            IStack stack = Platform.Current.Create <IStack>();

            //Create the Label lblLabel with text an height specific and adds it to the Stack.
            ILabel lblLabel = Platform.Current.Create <ILabel>();

            lblLabel.Text   = "Enter your comment";
            lblLabel.Height = 30;
            stack.Children.Add(lblLabel);

            //Create an textArea with size specific and adds it to the Stack
            txtTextarea        = Platform.Current.Create <ITextArea>();
            txtTextarea.Value  = "";
            txtTextarea.Width  = 200;
            txtTextarea.Height = 100;
            stack.Children.Add(txtTextarea);

            //Create the button cmdPrint with text specific with the event also click and adds it to the stack.
            IButton cmdPrint = Platform.Current.Create <IButton>();

            cmdPrint.Text   = "Print your coment";
            cmdPrint.Click += CmdOpen_Click;
            stack.Children.Add(cmdPrint);

            //Create the Label lblcoment not visible and with width specific and adds it to the Stack
            lblcoment         = Platform.Current.Create <ILabel>();
            lblcoment.Visible = false;
            lblcoment.Width   = 200;
            stack.Children.Add(lblcoment);

            //Create the button cmdClose with specific text with the event also click and adds it to the stack.
            IButton cmdClose = Platform.Current.Create <IButton>();

            cmdClose.Text   = "Close";
            cmdClose.Click += CmdClose_Click;
            stack.Children.Add(cmdClose);

            // Establishes the content and title of the page.
            Platform.Current.Page.Title   = "Test label";
            Platform.Current.Page.Content = stack;
        }
Пример #13
0
        public static IAdornmentProvider GetAdornmentAggregator(ITextArea textView)
        {
            if (textView == null)
            {
                throw new ArgumentNullException("textView");
            }

            IPropertyOwner     owner    = textView;
            IAdornmentProvider property = null;

            if (!owner.TryGetProperty <IAdornmentProvider>("IAdornmentAggregatorCache", out property))
            {
                property = new AdornmentAggregator(textView);
                owner.AddProperty("IAdornmentAggregatorCache", property);
            }

            return(property);
        }
Пример #14
0
        public static IEditorCommands CreateEditorCommands(ITextArea textView)
        {
            if (textView == null)
            {
                throw new ArgumentNullException("textView");
            }

            IPropertyOwner  owner    = textView;
            IEditorCommands property = null;

            if (!owner.TryGetProperty <IEditorCommands>("IEditorCommandsProvider", out property))
            {
                property = new EditorCommands(textView);
                owner.AddProperty("IEditorCommandsProvider", property);
            }

            return(property);
        }
Пример #15
0
        public static IAdornmentProvider[] GetAdornmentProviders(ITextArea textView)
        {
            if (textView == null)
            {
                throw new ArgumentNullException("textView");
            }

            if (_adornmentProviders == null)
            {
                _adornmentProviders = new IAdornmentProvider[] {
                    CreateBreakpointProviderInternal(textView.TextBuffer)
                    , CreateTextMarkerProvider(textView)
                    , GetToolTipProviderInternal(textView)
                };
            }

            return(_adornmentProviders);
        }
Пример #16
0
		/// <summary>
		/// Start this instance.
		/// <para xml:lang="es">
		/// Inicia
		/// </para>
		/// </summary>
		public override void Start()
		{
			base.Start();

			//Create an Stack
			IStack stack = Platform.Current.Create<IStack>();

			//Create the Label lblLabel with text an height specific and adds it to the Stack.
			ILabel lblLabel = Platform.Current.Create<ILabel>();
			lblLabel.Text = "Enter your comment";
			lblLabel.Height = 30;
			stack.Children.Add(lblLabel);

			//Create an textArea with size specific and adds it to the Stack
			txtTextarea = Platform.Current.Create<ITextArea>();
			txtTextarea.Value = "";
			txtTextarea.Width = 200;
			txtTextarea.Height = 100;
			stack.Children.Add(txtTextarea);

			//Create the button cmdPrint with text specific with the event also click and adds it to the stack.
			IButton cmdPrint = Platform.Current.Create<IButton>();
			cmdPrint.Text = "Print your coment";
			cmdPrint.Click += CmdOpen_Click;
			stack.Children.Add(cmdPrint);

			//Create the Label lblcoment not visible and with width specific and adds it to the Stack
			lblcoment = Platform.Current.Create<ILabel>();
			lblcoment.Visible = false;
			lblcoment.Width = 200;
			stack.Children.Add(lblcoment);

			//Create the button cmdClose with specific text with the event also click and adds it to the stack.
			IButton cmdClose = Platform.Current.Create<IButton>();
			cmdClose.Text = "Close";
			cmdClose.Click += CmdClose_Click;
			stack.Children.Add(cmdClose);

			// Establishes the content and title of the page.
			Platform.Current.Page.Title = "Test label";
			Platform.Current.Page.Content = stack;

			
		}
Пример #17
0
 public XleRunner(
     XleSystemState systemState,
     ITextArea textArea,
     IXleInput input,
     ICommandExecutor commandExecutor,
     IMapLoader mapLoader,
     IMapChanger mapChanger,
     IXleGameFactory gameFactory,
     GameState gameState)
 {
     this.systemState     = systemState;
     this.textArea        = textArea;
     this.input           = input;
     this.commandExecutor = commandExecutor;
     this.mapLoader       = mapLoader;
     this.mapChanger      = mapChanger;
     this.gameFactory     = gameFactory;
     this.gameState       = gameState;
 }
Пример #18
0
 public XlePlayerConsoleCommands(
     GameState gameState,
     ITextArea textArea,
     ICommandExecutor commandExecutor,
     IMapLoader mapLoader,
     IXleGameControl gameControl,
     IMapChanger mapChanger,
     XleSystemState systemState,
     XleOptions options,
     XleData data)
 {
     this.mapLoader       = mapLoader;
     this.GameState       = gameState;
     this.TextArea        = textArea;
     this.commandExecutor = commandExecutor;
     this.gameControl     = gameControl;
     this.systemState     = systemState;
     this.options         = options;
     this.Data            = data;
     this.mapChanger      = mapChanger;
 }
Пример #19
0
        public override void Start()
        {
            base.Start();

            IStack stack = Platform.Current.Create <IStack>();

            ILabel lblLabel = Platform.Current.Create <ILabel>();

            lblLabel.Text   = "Enter your comment";
            lblLabel.Height = 30;
            stack.Children.Add(lblLabel);

            txtTextarea        = Platform.Current.Create <ITextArea>();
            txtTextarea.Value  = "";
            txtTextarea.Width  = 200;
            txtTextarea.Height = 100;
            stack.Children.Add(txtTextarea);

            IButton cmdPrint = Platform.Current.Create <IButton>();

            cmdPrint.Text   = "Print your coment";
            cmdPrint.Click += CmdOpen_Click;
            stack.Children.Add(cmdPrint);

            lblcoment         = Platform.Current.Create <ILabel>();
            lblcoment.Visible = false;
            lblcoment.Width   = 200;
            stack.Children.Add(lblcoment);

            IButton cmdClose = Platform.Current.Create <IButton>();

            cmdClose.Text   = "Close";
            cmdClose.Click += CmdClose_Click;
            stack.Children.Add(cmdClose);

            Platform.Current.Page.Title   = "Test label";
            Platform.Current.Page.Content = stack;
        }
Пример #20
0
		public override void Start()
		{
			base.Start();

			IStack stack = Platform.Current.Create<IStack>();

			ILabel lblLabel = Platform.Current.Create<ILabel>();
			lblLabel.Text = "Enter your comment";
			lblLabel.Height = 30;
			stack.Children.Add(lblLabel);

			txtTextarea = Platform.Current.Create<ITextArea>();
			txtTextarea.Value = "";
			txtTextarea.Width = 200;
			txtTextarea.Height = 100;
			stack.Children.Add(txtTextarea);

			IButton cmdPrint = Platform.Current.Create<IButton>();
			cmdPrint.Text = "Print your coment";
			cmdPrint.Click += CmdOpen_Click;
			stack.Children.Add(cmdPrint);

			lblcoment = Platform.Current.Create<ILabel>();
			lblcoment.Visible = false;
			lblcoment.Width = 200;
			stack.Children.Add(lblcoment);

			IButton cmdClose = Platform.Current.Create<IButton>();
			cmdClose.Text = "Close";
			cmdClose.Click += CmdClose_Click;
			stack.Children.Add(cmdClose);

			Platform.Current.Page.Title = "Test label";
			Platform.Current.Page.Content = stack;

			
		}
Пример #21
0
        public TextLine(ITextArea parent)
        {
            this.parent = parent;

            Colors = new Color[40];
        }
Пример #22
0
 public SerialTextArea(ITextArea wdg) : base(wdg)
 {
     _element = wdg;
     InitializeProperty();
 }
Пример #23
0
 public void Update(ITextArea newWdg)
 {
     _element = newWdg;
     base.Update(newWdg);
     InitializeProperty();
 }
Пример #24
0
        public override void Start()
        {
            base.Start();

            IRelativePanel panel = Platform.Current.CreateControl <IRelativePanel>();

            BackgroundImage = Platform.Current.CreateControl <IImage>();
            BackgroundImage.LoadFromUrl(new Uri("http://app-udg.okhosting.com/ICONOS-PROG/icon2--47.png"));
            BackgroundImage.Width  = Platform.Current.Page.Width;
            BackgroundImage.Height = Platform.Current.Page.Height;
            panel.Add(BackgroundImage, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.TopWith);

            ILabelButton cmdProgramas = Platform.Current.CreateControl <ILabelButton>();

            cmdProgramas.Text     = "Programas";
            cmdProgramas.FontSize = 13;
            cmdProgramas.Width    = 80;
            cmdProgramas.Height   = 35;
            cmdProgramas.Click   += (object sender, EventArgs e) => new Programas().Start();
            panel.Add(cmdProgramas, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.TopWith);

            ILabelButton Regionales = Platform.Current.CreateControl <ILabelButton>();

            Regionales.Text     = "Regionales";
            Regionales.FontSize = 13;
            Regionales.Width    = 80;
            Regionales.Height   = 35;
            panel.Add(Regionales, RelativePanelHorizontalContraint.CenterWith, RelativePanelVerticalContraint.TopWith);

            ILabelButton Virtuales = Platform.Current.CreateControl <ILabelButton>();

            Virtuales.Text     = "Virtual";
            Virtuales.FontSize = 13;
            Virtuales.Width    = 80;
            Virtuales.Height   = 35;
            panel.Add(Virtuales, RelativePanelHorizontalContraint.RightWith, RelativePanelVerticalContraint.TopWith);

            ILabel lblLabel = Platform.Current.CreateControl <ILabel>();

            lblLabel.Text            = "Radio Universidad De Guadalajara";
            lblLabel.Width           = 240;
            lblLabel.Height          = 20;
            lblLabel.FontColor       = new Color(1, 0, 0, 255);
            lblLabel.BackgroundColor = new Color(1, 255, 0, 255);
            panel.Add(lblLabel, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.BelowOf, cmdProgramas);

            ILabel lblLabels = Platform.Current.CreateControl <ILabel>();

            lblLabels.Text   = "";
            lblLabels.Height = 20;
            lblLabels.Width  = 20;
            panel.Add(lblLabels, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.BelowOf, lblLabel);

            ILabel lblLabel2 = Platform.Current.CreateControl <ILabel>();

            lblLabel2.Text      = "AHORA AL AIRE";
            lblLabel2.FontColor = new Color(1, 255, 0, 255);
            panel.Add(lblLabel2, RelativePanelHorizontalContraint.CenterWith, RelativePanelVerticalContraint.BelowOf, lblLabels);

            play = Platform.Current.CreateControl <IImageButton>();
            play.LoadFromUrl(new Uri("http://app-udg.okhosting.com/ICONOS-PROG/icon-28.png"));
            play.Click += Play_Click;
            play.Width  = 80;
            play.Height = 35;
            panel.Add(play, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.BelowOf, lblLabel2);

            pause = Platform.Current.CreateControl <IImageButton>();
            pause.LoadFromUrl(new Uri("http://app-udg.okhosting.com/ICONOS-PROG/icon-04.png"));
            pause.Click += Pause_Click;
            pause.Width  = 80;
            pause.Height = 35;
            panel.Add(pause, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.BelowOf, play);

            stop = Platform.Current.CreateControl <IImageButton>();
            stop.LoadFromUrl(new Uri("http://app-udg.okhosting.com/ICONOS-PROG/icon-15.png"));
            stop.Click += Stop_Click;
            stop.Width  = 80;
            stop.Height = 35;
            panel.Add(stop, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.BelowOf, pause);

            ILabel lblLabel3 = Platform.Current.CreateControl <ILabel>();

            lblLabel3.Text      = "NOTAS DE EL ACORDEON";
            lblLabel3.FontColor = new Color(1, 255, 0, 255);
            panel.Add(lblLabel3, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.BelowOf, stop);

            ILabel lblTexto = Platform.Current.CreateControl <ILabel>();

            lblTexto.Text        = "Hoy estamos hablando de las palabras que usamos que provienen del árabe. Llama a cabina y dinos cules conoces. Entras a la rifa de boletos de Radaid";
            lblTexto.BorderColor = new Color(1, 255, 255, 255);
            lblTexto.BorderWidth = new Thickness(9, 9, 9, 9);
            panel.Add(lblTexto, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.BelowOf, lblLabel3);

            ILabel lblLabel4 = Platform.Current.CreateControl <ILabel>();

            lblLabel4.Text      = "ENVIA UN MENSAJE A EL ACORDEON";
            lblLabel4.FontSize  = 11;
            lblLabel4.FontColor = new Color(1, 255, 0, 255);
            panel.Add(lblLabel4, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.BelowOf, lblTexto);

            ITextArea txtAreaComentario = Platform.Current.CreateControl <ITextArea>();

            txtAreaComentario.Value           = "";
            txtAreaComentario.FontSize        = 12;
            txtAreaComentario.FontColor       = new Color(1, 0, 0, 255);
            txtAreaComentario.BackgroundColor = new Color(1, 255, 255, 255);
            txtAreaComentario.Width           = 210;
            txtAreaComentario.Height          = 80;
            panel.Add(txtAreaComentario, RelativePanelHorizontalContraint.LeftWith, RelativePanelVerticalContraint.BelowOf, lblLabel4);

            IButton Enviar = Platform.Current.CreateControl <IButton>();

            Enviar.Text            = "Enviar";
            Enviar.Width           = 80;
            Enviar.Height          = 30;
            Enviar.FontSize        = 12;
            Enviar.BackgroundColor = new Color(1, 255, 0, 255);
            panel.Add(Enviar, RelativePanelHorizontalContraint.RightWith, RelativePanelVerticalContraint.BelowOf, txtAreaComentario);

            Platform.Current.Page.Title   = "straming";
            Platform.Current.Page.Content = panel;
        }
Пример #25
0
 public TextArea(Generator g)
     : base(g, typeof(ITextArea))
 {
     inner = (ITextArea)base.Handler;
 }
Пример #26
0
        public void Process(IList <ITextArea> owner)
        {
            var content = _content;
            var clean   = content.TrimEnd();

            if (clean.Count(_ => _ == '*') == clean.Length)
            {
                if (clean.Length > 4)
                {
                    owner.Add(Strong.ParseStars(clean, Scope));
                    owner.Add(new TextArea("\n", Scope));
                }
                else
                {
                    owner.Add(new TextArea(clean + '\n', Scope));
                }

                return;
            }

            int       level         = 0;
            var       length        = 0;
            var       maxLevel      = 0;
            var       list          = new List <ITextArea>();
            var       balanced      = true;
            var       lastLineStart = 0;
            var       count         = 0;
            ITextArea lastText      = null;
            int       currentLine   = Scope.LineStart;

            for (int j = 0; j < content.Length; j++)
            {
                if (content[j] == '*')
                {
                    var fragment = content.Substring(j - length - (maxLevel == 0 ? 0 : maxLevel - 1), length);
                    var escaped  = IsEscaped(j, content, level > 0, ref balanced);
                    if (escaped)
                    {
                        length++;
                    }
                    else
                    {
                        count++;
                        if (length > 0 && maxLevel == 0)
                        {
                            foreach (var item in TextArea.Parse(fragment, new Scope {
                                LineStart = currentLine, LineEnd = currentLine
                            }))
                            {
                                list.Add(item);
                            }

                            length = 0;
                        }

                        if (length == 0)
                        {
                            level++;
                            maxLevel = level;
                        }
                        else
                        {
                            level--;
                        }

                        if (level == 0)
                        {
                            if (maxLevel == 2)
                            {
                                list.Add(new Strong(TextArea.Parse(fragment, new Scope {
                                    LineStart = currentLine, LineEnd = currentLine
                                })));
                            }
                            else if (maxLevel == 1)
                            {
                                list.Add(new Emphasis(TextArea.Parse(fragment, new Scope {
                                    LineStart = currentLine, LineEnd = currentLine
                                })));
                            }
                            else
                            {
                                list.Add(new Strong(TextArea.Parse($"*{fragment}*", new Scope {
                                    LineStart = currentLine, LineEnd = currentLine
                                })));
                            }

                            length   = 0;
                            maxLevel = 0;
                        }
                    }
                }
                else
                {
                    length++;
                }

                if (content[j] == '\n')
                {
                    currentLine++;
                    if (j != content.Length - 1)
                    {
                        lastLineStart = j + 1;
                        foreach (var item in list)
                        {
                            owner.Add(item);
                        }

                        list.Clear();
                    }
                }
            }

            balanced = count % 2 == 0;
            if (balanced)
            {
                foreach (var item in list)
                {
                    owner.Add(item);
                }

                list.Clear();

                if (length > 0)
                {
                    var fragment = content.Substring(content.Length - length, length);
                    lastText = TextArea.Parse(fragment, new Scope {
                        LineStart = currentLine, LineEnd = currentLine
                    })[0];
                }
            }
            else
            {
                level    = 0;
                length   = 0;
                maxLevel = 0;
                // rework last line.
                for (int j = lastLineStart == 0 ? 0 : lastLineStart + 1; j < content.Length; j++)
                {
                    if (content[j] == '*')
                    {
                        var escaped = IsEscaped(j, content, level > 0, ref balanced);
                        if (escaped)
                        {
                            length++;
                        }
                        else
                        {
                            count++;
                            var fragment = content.Substring(j - length - (maxLevel == 0 ? 0 : maxLevel - 1), length);
                            if (length > 0 && maxLevel == 0)
                            {
                                foreach (var item in TextArea.Parse(fragment, new Scope {
                                    LineStart = currentLine, LineEnd = currentLine
                                }))
                                {
                                    owner.Add(item);
                                }

                                length = 0;
                            }

                            if (length == 0)
                            {
                                level++;
                                maxLevel = level;
                            }
                            else
                            {
                                level--;
                            }

                            if (level == 0)
                            {
                                if (maxLevel == 2)
                                {
                                    owner.Add(new Strong(TextArea.Parse(fragment, new Scope {
                                        LineStart = currentLine, LineEnd = currentLine
                                    })));
                                }
                                else if (maxLevel == 1)
                                {
                                    owner.Add(new Emphasis(TextArea.Parse(fragment, new Scope {
                                        LineStart = currentLine, LineEnd = currentLine
                                    })));
                                }
                                else
                                {
                                    owner.Add(new Strong(TextArea.Parse($"*{fragment}*", new Scope {
                                        LineStart = currentLine, LineEnd = currentLine
                                    })));
                                }

                                length   = 0;
                                maxLevel = 0;
                            }
                        }
                    }
                    else
                    {
                        length++;
                    }
                }

                if (length > 0)
                {
                    var fragment = content.Substring(content.Length - length, length);
                    lastText = TextArea.Parse(fragment, new Scope {
                        LineStart = currentLine, LineEnd = currentLine
                    })[0];
                }
            }

            if (lastText != null)
            {
                owner.Add(lastText);
            }
        }
Пример #27
0
		protected TextArea (Generator generator, Type type, bool initialize = true)
			: base (generator, type, initialize)
		{
			handler = (ITextArea)base.Handler;
		}
Пример #28
0
 protected TextArea(Generator generator, Type type, bool initialize = true)
     : base(generator, type, initialize)
 {
     handler = (ITextArea)base.Handler;
 }
Пример #29
0
 public void Init() {
     _result = new Str();
     _textBox = new ExtFactory<User>().CreateTextArea( t => t.Name ).Width( 100 );
 }
Пример #30
0
        protected override void RunInternal()
        {
            // Create a new document.
            Program.Service.NewDocument(DocumentType.Standard);
            IDocument document = Program.Service.Document;

            // Create a page note field.
            document.PageAnnotationFieldSet.CreateAnnotationField("Default", AnnotationFieldType.Text);

            // Create some widget note fields.
            document.WidgetAnnotationFieldSet.CreateAnnotationField("Description", AnnotationFieldType.Text);
            document.WidgetAnnotationFieldSet.CreateAnnotationField("CreatedTime", AnnotationFieldType.Text);

            // Create a device.
            IDevice devide = document.DeviceSet.CreateDevice("iPhone 6 Plus");

            devide.Width     = 1024;
            devide.Height    = 768;
            devide.IsChecked = true;

            // Create a page.
            IDocumentPage page = document.CreatePage("Home");

            // Create the page node in page tree.
            ITreeNode node = document.DocumentSettings.LayoutSetting.PageTree.AddChild(TreeNodeType.Page);

            node.AttachedObject = page;

            // Must open the page before you read and modify it.
            page.Open();

            // Set page note.
            page.Annotation.SetTextValue("Default", "This Home page.");

            // Get the page view for base adaptive view.
            IPageView baseView = page.PageViews[document.AdaptiveViewSet.Base.Guid];

            // Create widgets on the base view in this page.
            IButton button = baseView.CreateWidget(WidgetType.Button) as IButton;

            button.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString());

            // Size
            button.WidgetStyle.Height = 30;
            button.WidgetStyle.Width  = 100;

            // Location
            button.WidgetStyle.X = 0;
            button.WidgetStyle.Y = 0;
            button.WidgetStyle.Z = 0;

            // Text things
            button.Name    = "Button 1";
            button.Text    = "Button";
            button.Tooltip = "Html button.";

            ICheckbox checkbox = baseView.CreateWidget(WidgetType.Checkbox) as ICheckbox;

            checkbox.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString());
            checkbox.WidgetStyle.Height = 18;
            checkbox.WidgetStyle.Width  = 120;
            checkbox.WidgetStyle.X      = 150;
            checkbox.WidgetStyle.Y      = 0;
            checkbox.WidgetStyle.Z      = 1;
            checkbox.Name    = "CheckBox 1";
            checkbox.Text    = "CheckBox";
            checkbox.Tooltip = "Left align check box.";

            IDroplist dropList = baseView.CreateWidget(WidgetType.DropList) as IDroplist;

            dropList.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString());
            dropList.WidgetStyle.Height = 22;
            dropList.WidgetStyle.Width  = 200;
            dropList.WidgetStyle.X      = 300;
            dropList.WidgetStyle.Y      = 0;
            dropList.WidgetStyle.Z      = 2;
            dropList.Name    = "Droplist 1";
            dropList.Tooltip = "A droplist has 3 item and item 3 is seleted.";

            // Create list items.
            dropList.CreateItem("Droplist Item 1");
            dropList.CreateItem("Droplist Item 2");
            IListItem item3 = dropList.CreateItem("Droplist Item 3");

            item3.IsSelected = true;

            /*
             * IFlowShape flowShap = baseView.CreateWidget(WidgetType.FlowShape) as IFlowShape; // Here flow shape type is none.
             * // You must set specific flow shape type, then the flowshape is a valid flowshape.
             * flowShap.FlowShapeType = FlowShapeType.Database;
             * flowShap.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString());
             * flowShap.Height = 80;
             * flowShap.Width = 60;
             * flowShap.X = 550;
             * flowShap.Y = 0;
             * flowShap.Z = 3;
             * flowShap.Name = "FlowShape 1";
             * flowShap.Tooltip = "A Database flow shape.";
             * flowShap.SetRichText("Database"); // FlowShape support rich text.
             */

            IHotSpot hotSpot = baseView.CreateWidget(WidgetType.HotSpot) as IHotSpot;

            hotSpot.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString());
            hotSpot.WidgetStyle.Height = 100;
            hotSpot.WidgetStyle.Width  = 100;
            hotSpot.WidgetStyle.X      = 0;
            hotSpot.WidgetStyle.Y      = 100;
            hotSpot.WidgetStyle.Z      = 4;
            hotSpot.Name    = "HotSpot 1";
            hotSpot.Tooltip = "A hot sport link to Baidu";
            // Create a link action to open www.baidu.com in new window.
            IInteractionEvent      clickEvent = hotSpot.Events[EventType.OnClick];
            IInteractionCase       case1      = clickEvent.CreateCase("clickCase");
            IInteractionOpenAction openAction = case1.CreateAction(ActionType.OpenAction) as IInteractionOpenAction;

            openAction.LinkType    = LinkType.LinkToUrl;
            openAction.ExternalUrl = @"www.baidu.com";
            openAction.OpenIn      = ActionOpenIn.NewWindowOrTab;

            IImage image = baseView.CreateWidget(WidgetType.Image) as IImage;

            image.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString());
            image.WidgetStyle.Height = 267;
            image.WidgetStyle.Width  = 116;
            image.WidgetStyle.X      = 150;
            image.WidgetStyle.Y      = 100;
            image.WidgetStyle.Z      = 5;
            image.Name    = "4.png";
            image.Tooltip = "A png image has 116 x 267 in size";

            // It is a png image by default. Set image stream
            string imageFile = Path.Combine(Program.WORKING_IMAGES_DIRECTORY, "HangGame", "4.png");

            if (File.Exists(imageFile))
            {
                using (FileStream fileStream = new FileStream(imageFile, FileMode.Open, FileAccess.Read))
                {
                    MemoryStream imageStream = new MemoryStream();
                    fileStream.CopyTo(imageStream);
                    image.ImageStream = imageStream;
                }
            }

            ILine line = baseView.CreateWidget(WidgetType.Line) as ILine;

            line.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString());
            line.Orientation        = Orientation.Vertical;
            line.WidgetStyle.Height = 200;
            line.WidgetStyle.Width  = 10;
            line.WidgetStyle.X      = 300;
            line.WidgetStyle.Y      = 100;
            line.WidgetStyle.Z      = 6;
            line.Name    = "Line";
            line.Tooltip = "A Vertical line with";

            IListBox listBox = baseView.CreateWidget(WidgetType.ListBox) as IListBox;

            listBox.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString());
            listBox.WidgetStyle.Height = 100;
            listBox.WidgetStyle.Width  = 200;
            listBox.WidgetStyle.X      = 350;
            listBox.WidgetStyle.Y      = 100;
            listBox.WidgetStyle.Z      = 7;
            listBox.Tooltip            = "A multiple-selected listBox which has 5 itmes. Item 1 and item 4 is selcted.";

            listBox.AllowMultiple = true;
            IListItem item1 = listBox.CreateItem("ListBox Item 1");

            item1.IsSelected = true;
            listBox.CreateItem("ListBox Item 2");
            listBox.CreateItem("ListBox Item 3");
            IListItem item4 = listBox.CreateItem("ListBox Item 4");

            item4.IsSelected = true;
            listBox.CreateItem("ListBox Item 5");

            IRadioButton radioButton = baseView.CreateWidget(WidgetType.RadioButton) as IRadioButton;

            radioButton.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString());
            radioButton.WidgetStyle.Height = 18;
            radioButton.WidgetStyle.Width  = 120;
            radioButton.WidgetStyle.X      = 0;
            radioButton.WidgetStyle.Y      = 300;
            radioButton.WidgetStyle.Z      = 8;

            radioButton.AlignButton = AlignButton.Right;
            radioButton.Text        = "Radio Button";
            radioButton.Tooltip     = "A right aligned radio button";

            IShape lable = baseView.CreateWidget(WidgetType.Shape) as IShape;

            lable.ShapeType = ShapeType.Paragraph;
            lable.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString());
            lable.WidgetStyle.Height = 100;
            lable.WidgetStyle.Width  = 200;
            lable.WidgetStyle.X      = 150;
            lable.WidgetStyle.Y      = 300;
            lable.WidgetStyle.Z      = 9;
            lable.Name    = "Label 1";
            lable.Tooltip = "A label.";
            lable.SetRichText("Label");
            lable.WidgetStyle.LineColor = new StyleColor(ColorFillType.Solid, -16777216);
            lable.WidgetStyle.LineWidth = 0;                                             // No border
            lable.WidgetStyle.FillColor = new StyleColor(ColorFillType.Solid, 16777215); // Transparent
            lable.WidgetStyle.HorzAlign = Alignment.Left;
            lable.WidgetStyle.VertAlign = Alignment.Top;

            IShape roundedRectangle = baseView.CreateWidget(WidgetType.Shape) as IShape;

            roundedRectangle.ShapeType = ShapeType.RoundedRectangle;
            roundedRectangle.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString());
            roundedRectangle.WidgetStyle.Height = 100;
            roundedRectangle.WidgetStyle.Width  = 200;
            roundedRectangle.WidgetStyle.X      = 400;
            roundedRectangle.WidgetStyle.Y      = 300;
            roundedRectangle.WidgetStyle.Z      = 10;
            roundedRectangle.Name    = "RoundedRectangle 1";
            roundedRectangle.Tooltip = "A Rounded Rectangle.";
            roundedRectangle.SetRichText("RoundedRectangle");

            IShape triangle = baseView.CreateWidget(WidgetType.Shape) as IShape;

            triangle.ShapeType = ShapeType.Triangle;
            triangle.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString());
            triangle.WidgetStyle.Height = 100;
            triangle.WidgetStyle.Width  = 100;
            triangle.WidgetStyle.X      = 650;
            triangle.WidgetStyle.Y      = 300;
            triangle.WidgetStyle.Z      = 11;
            triangle.Name    = "Triangle 1";
            triangle.Tooltip = "A Triangle.";
            triangle.SetRichText("Triangle");

            ISvg svg = baseView.CreateWidget(WidgetType.SVG) as ISvg;

            svg.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString());
            svg.WidgetStyle.Height = 117;
            svg.WidgetStyle.Width  = 150;
            svg.WidgetStyle.X      = 0;
            svg.WidgetStyle.Y      = 450;
            svg.WidgetStyle.Z      = 12;
            svg.Name    = "airplane 03";
            svg.Tooltip = "A airplane svg";

            string svgFile = Path.Combine(Program.WORKING_IMAGES_DIRECTORY, "Svg", "airplane 03.svg");

            if (File.Exists(svgFile))
            {
                using (FileStream fileStream = new FileStream(svgFile, FileMode.Open, FileAccess.Read))
                {
                    MemoryStream svgStream = new MemoryStream();
                    fileStream.CopyTo(svgStream);
                    svg.XmlStream = svgStream;
                }
            }

            ITextArea textArea = baseView.CreateWidget(WidgetType.TextArea) as ITextArea;

            textArea.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString());
            textArea.WidgetStyle.Height = 100;
            textArea.WidgetStyle.Width  = 200;
            textArea.WidgetStyle.X      = 250;
            textArea.WidgetStyle.Y      = 450;
            textArea.WidgetStyle.Z      = 12;
            textArea.Name       = "TextArea 1";
            textArea.Tooltip    = "A hidden border text area with max length is 10.";
            textArea.HintText   = "Password";
            textArea.MaxLength  = 10;
            textArea.HideBorder = true;

            ITextField textField = baseView.CreateWidget(WidgetType.TextField) as ITextField;

            textField.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString());
            textField.WidgetStyle.Height = 50;
            textField.WidgetStyle.Width  = 100;
            textField.WidgetStyle.X      = 500;
            textField.WidgetStyle.Y      = 450;
            textField.WidgetStyle.Z      = 13;
            textField.Name          = "TextField 1";
            textField.Tooltip       = "A TextField";
            textField.TextFieldType = TextFieldType.Email;
            textField.HintText      = "emial";

            IHamburgerMenu hamburgerMenu = baseView.CreateWidget(WidgetType.HamburgerMenu) as IHamburgerMenu;

            hamburgerMenu.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString());
            hamburgerMenu.WidgetStyle.Height = 280;
            hamburgerMenu.WidgetStyle.Width  = 150;
            hamburgerMenu.WidgetStyle.X      = 0;
            hamburgerMenu.WidgetStyle.Y      = 700;
            hamburgerMenu.WidgetStyle.Z      = 14;
            hamburgerMenu.Name    = "HamburgerMenu 1";
            hamburgerMenu.Tooltip = "A hamburger menu.";

            // Menu botton
            hamburgerMenu.MenuButton.WidgetStyle.Height = 50;
            hamburgerMenu.MenuButton.WidgetStyle.Width  = 50;
            hamburgerMenu.MenuButton.WidgetStyle.X      = 0;
            hamburgerMenu.MenuButton.WidgetStyle.Y      = 700;
            hamburgerMenu.MenuButton.WidgetStyle.Z      = 0;

            // Menu page,  add a shape
            IPage menuPage = hamburgerMenu.MenuPage;

            menuPage.Open(); // Open page to edit.

            // Get the base view of menu page.
            IPageView menuBaseView = menuPage.PageViews[document.AdaptiveViewSet.Base.Guid];

            // Create widgts on the base view in the menu page.
            IShape diamond = menuBaseView.CreateWidget(WidgetType.Shape) as IShape;

            diamond.ShapeType = ShapeType.Diamond;
            diamond.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString());
            diamond.WidgetStyle.Height = 100;
            diamond.WidgetStyle.Width  = 100;
            diamond.Name    = "Diamond 1";
            diamond.Tooltip = "A Diamond.";
            diamond.SetRichText("Diamond");
            menuPage.Close(); // Close Page to release resources.

            IToast toast = baseView.CreateWidget(WidgetType.Toast) as IToast;

            toast.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString());
            toast.WidgetStyle.Height = 146;
            toast.WidgetStyle.Width  = 298;
            toast.WidgetStyle.X      = 200;
            toast.WidgetStyle.Y      = 700;
            toast.WidgetStyle.Z      = 15;
            toast.Name            = "Toast 1";
            toast.Tooltip         = "A ExposureTime toast.";
            toast.ExposureTime    = 3;
            toast.DisplayPosition = ToastDisplayPosition.Top;
            toast.CloseSetting    = ToastCloseSetting.CloseButton;

            IPage toastPage = toast.ToastPage;

            toastPage.Open(); // Open page to edit.

            // Get the base view of toast page.
            IPageView toastBaseView = toastPage.PageViews[document.AdaptiveViewSet.Base.Guid];

            IShape ellipse = toastBaseView.CreateWidget(WidgetType.Shape) as IShape;

            ellipse.ShapeType = ShapeType.Ellipse;
            ellipse.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString());
            ellipse.WidgetStyle.Height = 100;
            ellipse.WidgetStyle.Width  = 100;
            ellipse.Name    = "Ellipse 1";
            ellipse.Tooltip = "A Ellipse.";
            ellipse.SetRichText("Ellipse");
            toastPage.Close(); // Close Page to release resources.

            IDynamicPanel dynamicPanel = baseView.CreateWidget(WidgetType.DynamicPanel) as IDynamicPanel;

            dynamicPanel.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString());
            dynamicPanel.WidgetStyle.Height = 198;
            dynamicPanel.WidgetStyle.Width  = 152;
            dynamicPanel.WidgetStyle.X      = 500;
            dynamicPanel.WidgetStyle.Y      = 700;
            dynamicPanel.WidgetStyle.Z      = 16;
            dynamicPanel.IsAutomatic        = true;

            // Set start panel page as the first created page.
            dynamicPanel.StartPanelStatePage = dynamicPanel.CreatePanelStatePage("Panel 1");
            dynamicPanel.CreatePanelStatePage("Panel 2");
            dynamicPanel.CreatePanelStatePage("Panel 3");

            int imageFileName = 1;

            foreach (IPage statePage in dynamicPanel.PanelStatePages)
            {
                statePage.Open(); // Open page to edit.

                // Get the base view of state page.
                IPageView stateBaseView = statePage.PageViews[document.AdaptiveViewSet.Base.Guid];

                IImage statePageImage = stateBaseView.CreateWidget(WidgetType.Image) as IImage;
                statePageImage.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString());
                statePageImage.WidgetStyle.Height = 198;
                statePageImage.WidgetStyle.Width  = 152;
                string statePageImageFile = Path.Combine(Program.WORKING_IMAGES_DIRECTORY, "HangGame", imageFileName + ".png");
                if (File.Exists(statePageImageFile))
                {
                    using (FileStream fileStream = new FileStream(statePageImageFile, FileMode.Open, FileAccess.Read))
                    {
                        MemoryStream imageStream = new MemoryStream();
                        fileStream.CopyTo(imageStream);
                        statePageImage.ImageStream = imageStream;
                    }
                }
                statePage.Close(); // Close Page to release resources.

                imageFileName++;
            }

            // Close the page if you don't want to work on it.
            page.Close();

            // Save the document to a pn file.
            string fileName = Path.Combine(Program.WORKING_DIRECTORY, _caseName + ".pn");

            Program.Service.Save(fileName);

            // Close this document when you don't work on it anymore.
            Program.Service.Close();
        }