Oppure

Loading
15/04/18 15:01
Thejuster
ConsoleGraph è una libreria Cross-Platform .net Core
che consente l'implementazione grafica su terminale di controlli gestisti come Button, TextBox, Label Etc.


Impostazione base dell'applicazione


WindowManager.Title("Example App");
WindowManager.SetupWindow();
WindowManager.UpdateWindow(100, 40); //Larghezza, Altezza in char




----------------------------


Versione 1.0.2
Implementazione del MessageBox di tipo Alert


WindowManager.SetupWindow();
new Alert("Messaggio di Avviso!", null); //Contenitore Padre
WindowManager.EndWindow();



ScreenShoot
s9.postimg.cc/4ticw53cf/…


Costruzione di un controllo manuale:


Button bt = new Button(X,Y,"Testo","ID",this);

//Assegnazione di un evento

bt.Action = delegate() { Exit(); }


/// <summary xml:lang="it">
///  Chisura dell'applicazione
/// </summary>
/// <summary xml:lang="en">
/// Application Exit
/// </summary>
public void Exit()
        {
            Exit = true;
            if (Parent != null)
                Parent.Draw();
        }



La classe button è basa sulla classe astratta Control


  public class Button : Control
    {


 /// <summary xml:lang="it">
        /// Crea un controllo di tipo Pulsante
        /// </summary>
        /// <summary xml:lang="en">
        /// Create a button control
        /// </summary>
        /// <param name="x">X</param>
        /// <param name="y">Y</param>
        /// <param name="text">Button Text</param>
        /// <param name="iD">Control ID</param>
        /// <param name="parentWindow">Parent Window</param>
        public Button(int x, int y, String text, String iD, Window parentWindow) : base(x, y, 1, text.Count() + 2, parentWindow, iD)
        {
            Text = text;
            BackgroundColour = parentWindow.BackgroundColour;
            Selectable = true;
        }

     }





Ultima modifica effettuata da Thejuster 15/04/18 15:02
mire.forumfree.it/ - Mire Engine
C# UI Designer
11/11/19 8:37
Thejuster
Aggiunto gli eventi ai relativi controlli.

i.postimg.cc/rsczYRXt/…

Un esempio è:

Button oneBtn = new Button(2, 2, "Button One", "oneBtn", this);
oneBtn.ButtonPressed += new Button.OnButtonPressed(oneBtn_ButtonPressed);



 void oneBtn_ButtonPressed()
        {
            new Alert("You Clicked Button One", this, ConsoleColor.White);
        }




Aggiunto anche gli eventi con argomenti relativi a determinati controlli.
Un esempio per la TextArea

i.postimg.cc/QtqWDJqq/…



var textArea = new TextArea(17, 2, 60, 6, "txtArea", this);
textArea.BackgroundColour = ConsoleColor.DarkGray;
textArea.TextChanged += new TextArea.OnTextChanged(textArea_TextChanged);


void textArea_TextChanged(Input Sender, TextChangedEventArgs e)
        {
            if (e.Text == "hello")
            {           
                new Alert("The Text area whit id: \"" + e.ID + "\" Contains " + e.Text + "!",this, ConsoleColor.White);
            }
        }

mire.forumfree.it/ - Mire Engine
C# UI Designer