예제 #1
0
파일: Dialogs.cs 프로젝트: 91yuan/ilixi
    public static void Main(string[] args)
    {
        Application app = new Application(null, null);
        app.setMargin(new Margin(10));
        app.setLayout(new VBoxLayout());

        Dialog dialog1 = new Dialog("Dialog 1", Dialog.ButtonOption.NoButtonOption);
        ToolButton button1 = new ToolButton("Show dialog 1");
        button1.connectClick(new DelegateNotify(dialog1.execute));
        app.addWidget(button1);

        Dialog dialog2 = new Dialog("Dialog 2", Dialog.ButtonOption.CancelButtonOption);
        ToolButton button2 = new ToolButton("Show dialog 2");
        button2.connectClick(new DelegateNotify(dialog2.execute));
        app.addWidget(button2);

        Dialog dialog3 = new Dialog("Dialog 3", Dialog.ButtonOption.OKCancelButtonOption);
        ToolButton button3 = new ToolButton("Show dialog 3");
        button3.connectClick(new DelegateNotify(dialog3.execute));
        app.addWidget(button3);

        Dialog dialog4 = new Dialog("Dialog 4", Dialog.ButtonOption.YesNoCancelButtonOption);
        ToolButton button4 = new ToolButton("Show dialog 4");
        button4.connectClick(new DelegateNotify(dialog4.execute));
        app.addWidget(button4);

        app.exec();
    }
예제 #2
0
    public void OnPointerClick(PointerEventData eventData)
    {
        if (slices > 0)
        {
            slices--;
            eatSound.Play();
            Status food = GameStateManagerScript.Instance.GetStatus(StatusType.Food);

            GameStateManagerScript.Instance.Eat(Random.Range(40, 61));
            updateTooltip();
        }
        else
        {
            Dialog dialog = new Dialog();
            dialog.dialogText = "You have no more pizza.";
            DialogOption option = new DialogOption();
            option.optionText = "Ok";
            option.optionId = "ok";
            dialog.dialogOptions.Add(option);
            if (GameStateManagerScript.Instance.GetStatus(StatusType.Money).points >= 20)
            {
                option = new DialogOption();
                option.optionText = "Order more";
                option.optionId = "order";
                option.tooltipText = "-20$";
                dialog.dialogOptions.Add(option);
            }            
            DialogManagerScript.Instance.ShowDialog(dialog, optionChosen);
        }
    }
예제 #3
0
        protected void OnButtonIngresarClicked(object sender, EventArgs e)
        {
            ControladorBaseDatos Bd = new ControladorBaseDatos();

            string[] usuarioClave = new string[2];

            usuarioClave = Bd.ObtenerUsuarioContraseñaBd(entryUsuario.Text);

            if(usuarioClave[0].Equals(entryUsuario.Text) & usuarioClave[1].Equals(entryClave.Text))
            {
                //PrincipalWindow principal = new PrincipalWindow(entryUsuario.Text);
                VenderProductosDialog principal = new VenderProductosDialog(entryUsuario.Text);

                base.Destroy();
                principal.Show();
            }
            else
            {
                Dialog dialog = new Dialog("Iniciar Sesion", this, Gtk.DialogFlags.DestroyWithParent);
                dialog.Modal = true;
                dialog.Resizable = false;
                Gtk.Label etiqueta = new Gtk.Label();
                etiqueta.Markup = "Usuario/Clave incorrectos";
                dialog.BorderWidth = 8;
                dialog.VBox.BorderWidth = 8;
                dialog.VBox.PackStart(etiqueta, false, false, 0);
                dialog.AddButton ("Cerrar", ResponseType.Close);
                dialog.ShowAll();
                dialog.Run ();
                dialog.Destroy ();

            }
        }
예제 #4
0
 void Agregar( object o, EventArgs args )
 {
     // crear dialogo
     Dialog dialog = new Dialog ("Agregar", window, Gtk.DialogFlags.DestroyWithParent);
     dialog.Modal = true;
     dialog.AddButton ("Aceptar", ResponseType.Ok);
     dialog.AddButton ("Cerrar", ResponseType.Close);
     Label lab = new Label("Información que desea agregar:");
     lab.Show();
     dialog.VBox.PackStart (lab , true, true, 5 );
     Table table = new Table (2, 2, false);
     Label labNombre = new Label("Nombre:");
     labNombre.Show();
     table.Attach(labNombre , 0, 1, 0, 1);
     entryNombre = new Entry();
     entryNombre.Show();
     table.Attach(entryNombre, 1, 2, 0, 1);
     Label labApe = new Label("Apellidos:");
     labApe.Show();
     table.Attach(labApe , 0, 1, 1, 2);
     entryApe = new Entry();
     entryApe.Show();
     table.Attach(entryApe , 1, 2, 1, 2);
     table.Show();
     dialog.VBox.PackStart (table, true, true, 5 );
     dialog.Response += new ResponseHandler (on_dialog_agregar);
     dialog.Run ();
     dialog.Destroy ();
 }
예제 #5
0
        static void HandleButtonButtonAction(object sender, TouchEventArgs e)
        {
            //if (e.TouchEvent == TouchEventType.Down)
            {
                var dialog = new Dialog();
                Label label = new Label();
                label.X = 10.0f;
                label.Y = 50.0f;
                label.Text = "Test Dialog";

                Button button = new Button();
                button.Text = "Hidding Dialog...";
                button.TextColor = new UIColor(1.0f, 0.0f, 0.0f, 1.0f);
                button.SetPosition(5.0f, 5.0f);

                button.ButtonAction += (s, ea) =>
                {
                    dialog.Hide();
                };

                dialog.AddChildLast(button);
                dialog.AddChildLast(label);

                dialog.Show();
            }
        }
예제 #6
0
        public DialogManager(Dialog emptyDialog)
        {
            Check.Required<ArgumentNullException>(() => emptyDialog != null);

            _dialog = _emptyDialog = emptyDialog;
            emptyDialog.Initialize();
        }
예제 #7
0
    public TreeViewDemo()
    {
        Application.Init ();
        PopulateStore ();

        Window win = new Window ("TreeView demo");
        win.DeleteEvent += new DeleteEventHandler (DeleteCB);
        win.SetDefaultSize (640,480);

        ScrolledWindow sw = new ScrolledWindow ();
        win.Add (sw);

        TreeView tv = new TreeView (store);
        tv.EnableSearch = true;
        tv.HeadersVisible = true;
        tv.HeadersClickable = true;

        tv.AppendColumn ("Name", new CellRendererText (), "text", 0);
        tv.AppendColumn ("Type", new CellRendererText (), "text", 1);

        sw.Add (tv);

        dialog.Destroy ();
        dialog = null;

        win.ShowAll ();

        Application.Run ();
    }
예제 #8
0
파일: Main.cs 프로젝트: langpavel/LPS-old
    public void Run(string[] args)
    {
        Application.Init ();
        PopulateStore ();
        store.SetSortColumnId(2, SortType.Ascending);

        Window win = new Window ("Gtk Widget Attributes");
        win.DeleteEvent += new DeleteEventHandler (DeleteCB);
        win.SetDefaultSize (640,480);

        ScrolledWindow sw = new ScrolledWindow ();
        win.Add (sw);

        TreeView tv = new TreeView (store);
        tv.HeadersVisible = true;

        tv.AppendColumn ("Name", new CellRendererText (), "markup", 0);
        tv.AppendColumn ("Type", new CellRendererText (), "text", 1);

        foreach(TreeViewColumn col in tv.Columns)
            col.Resizable = true;

        tv.SearchColumn = 2;

        sw.Add (tv);

        dialog.Destroy ();
        dialog = null;

        win.ShowAll ();

        Application.Run ();
    }
예제 #9
0
 public void OnPointerClick(PointerEventData eventData)
 {
     if (workedToday)
     {
         Dialog dialog = new Dialog();
         dialog.dialogText = "You already went to work today.";
         DialogOption option = new DialogOption();
         option.optionText = "Ok";
         dialog.dialogOptions.Add(option);
         DialogManagerScript.Instance.ShowDialog(dialog, noOp);
     } 
     else if (allowWork && GameStateManagerScript.Instance.GetGameTime().hour > 14)
     {
         Dialog dialog = new Dialog();
         dialog.dialogText = "It's too late to go to work now.";
         DialogOption option = new DialogOption();
         option.optionText = "Ok";
         dialog.dialogOptions.Add(option);
         DialogManagerScript.Instance.ShowDialog(dialog, noOp);
     }
     else if (allowWork)
     {
         Dialog dialog = new Dialog();
         dialog.dialogText = "You went to work, you earned 20$.";
         DialogOption option = new DialogOption();
         option.optionText = "Ok";
         dialog.dialogOptions.Add(option);
         DialogManagerScript.Instance.ShowDialog(dialog, noOp);
         workedToday = true;
         GameStateManagerScript.Instance.AdvanceTime(8 * 60 + Random.Range(0, 30));
         GameStateManagerScript.Instance.ChangeMoney(20);
     }
 }
예제 #10
0
    internal void ShowDialog(Dialog dialog, Sprite avatar = null, DialogEndAction endAction = null)
    {
        currentDialog = dialog;
        avatarImage.sprite = avatar;

        StartCoroutine(getAllLines(endAction));
    }
예제 #11
0
    /**
     * Start Dialog is called from Dialog as the trigger to get the DialogGui
     * going.
     *
     * This is broadcast into he GameObject after the DialogGui class is created
     * and added to the GameObject. You should not need to use extends or alter
     * this method if you are using the DialogGuiAbstract as your base.
     *
     * This broadcasts DialogStarted into the GameObject after it is called.
     *
     */
    public void StartDialog(Dialog dialog)
    {
        Parley.GetInstance().SetInGui(true);

        this.dialog=dialog;

        // Change camera
        if (dialog.dialogCamera!=null){
            oldCamera=Camera.main;

            // Try calling the camera dolly
            dialog.dialogCamera.gameObject.SendMessage("SwitchCamera",SendMessageOptions.DontRequireReceiver);

            if (!dialog.dialogCamera.gameObject.activeSelf){
                oldCamera.gameObject.SetActive(false);
                dialog.dialogCamera.gameObject.SetActive(true);
            }
        }

        // Broadcast to player and this object that we have started a dialog
        GameObject.FindWithTag("Player").BroadcastMessage("DialogStarted",dialog,SendMessageOptions.DontRequireReceiver);
        BroadcastMessage("DialogStarted",dialog,SendMessageOptions.DontRequireReceiver);
        Parley.GetInstance().SetCurrentDialog(dialog);

        // Start at the correct dialog
        GotoDialogue(null,dialog.GetConversationIndex());
    }
예제 #12
0
            internal BattleGUI(ScreenConstants screen, GUIManager manager, 
            Dialog messageFrame, MessageBox messageBox, 
            IMenuWidget<MainMenuEntries> mainWidget, 
            IMenuWidget<Move> moveWidget, IMenuWidget<Pokemon> pokemonWidget, 
            IMenuWidget<Item> itemWidget, IBattleStateService battleState, 
            BattleData data)
        {
            this.battleState = battleState;
            playerId = data.PlayerId;
            ai = data.Clients.First(id => !id.IsPlayer);
            this.moveWidget = moveWidget;
            this.itemWidget = itemWidget;
            this.mainWidget = mainWidget;
            this.pokemonWidget = pokemonWidget;

            this.messageBox = messageBox;
            this.messageFrame = messageFrame;

            InitMessageBox(screen, manager);

            InitMainMenu(screen, manager);
            InitAttackMenu(screen, manager);
            InitItemMenu(screen, manager);
            InitPKMNMenu(screen, manager);

        }
예제 #13
0
 public Dialog(Dialog _dialog)
 {
     name=_dialog.name;
     //face=_dialog.face;
     text=_dialog.text;
     speed=_dialog.speed;
 }
예제 #14
0
		public Command Run (WindowFrame transientFor, MessageDescription message)
		{
			this.icon = GetIcon (message.Icon);
			if (ConvertButtons (message.Buttons, out buttons)) {
				// Use a system message box
				if (message.SecondaryText == null)
					message.SecondaryText = String.Empty;
				else {
					message.Text = message.Text + "\r\n\r\n" + message.SecondaryText;
					message.SecondaryText = String.Empty;
				}
				var wb = (WindowFrameBackend)Toolkit.GetBackend (transientFor);
				if (wb != null) {
					this.dialogResult = MessageBox.Show (wb.Window, message.Text, message.SecondaryText,
														this.buttons, this.icon, this.defaultResult, this.options);
				}
				else {
					this.dialogResult = MessageBox.Show (message.Text, message.SecondaryText, this.buttons,
														this.icon, this.defaultResult, this.options);
				}
				return ConvertResultToCommand (this.dialogResult);
			}
			else {
				// Custom message box required
				Dialog dlg = new Dialog ();
				dlg.Resizable = false;
				dlg.Padding = 0;
				HBox mainBox = new HBox { Margin = 25 };

				if (message.Icon != null) {
					var image = new ImageView (message.Icon.WithSize (32,32));
					mainBox.PackStart (image, vpos: WidgetPlacement.Start);
				}
				VBox box = new VBox () { Margin = 3, MarginLeft = 8, Spacing = 15 };
				mainBox.PackStart (box, true);
				var text = new Label {
					Text = message.Text ?? ""
				};
				Label stext = null;
				box.PackStart (text);
				if (!string.IsNullOrEmpty (message.SecondaryText)) {
					stext = new Label {
						Text = message.SecondaryText
					};
					box.PackStart (stext);
				}
				dlg.Buttons.Add (message.Buttons.ToArray ());
				if (mainBox.Surface.GetPreferredSize (true).Width > 480) {
					text.Wrap = WrapMode.Word;
					if (stext != null)
						stext.Wrap = WrapMode.Word;
					mainBox.WidthRequest = 480;
				}
				var s = mainBox.Surface.GetPreferredSize (true);

				dlg.Content = mainBox;
				return dlg.Run ();
			}
		}
예제 #15
0
 public BattleGUI(ScreenConstants screen, GUIManager manager, 
     Dialog messageFrame, MessageBox messageBox, 
     MainMenuWidget mainWidget,
     MoveMenuWidget moveWidget, PokemonMenuWidget pokemonWidget,
     ItemMenuWidget itemWidget, IBattleStateService battleState,
     BattleData data) :
     this(screen, manager, messageFrame, messageBox, (IMenuWidget<MainMenuEntries>)mainWidget, moveWidget, pokemonWidget, itemWidget, battleState, data)
 {}
        public void SetUp()
        {
            _responses = Enumerable.Range(1, 3)
                .Select(x => "Response" + x)
                .ToArray();

            _userDialog = new Dialog<string>(string.Empty, string.Empty, _responses);
        }
예제 #17
0
 public void LoadDialog(Dialog dialog)
 {
     GameController.Instance ().pause ();
     this.dialog = dialog;
     speakerIcon.sprite = dialog.speakerImage;
     speakerName.text = dialog.speakerName;
     dialogContent.text = dialog.getCurrentDialog();
 }
예제 #18
0
        protected void OnButtonEditarNumBoletaClicked(object sender, EventArgs e)
        {
            numBoleta = this.db.ObtenerBoleta ();

            if (Int32.Parse (entryNumBoleta.Text.Trim ()) > numBoleta) {

                try {
                    Venta nuevaVenta = new Venta (Int32.Parse (entryNumBoleta.Text.Trim ()), DateTime.Now.ToString ("yyyy-MM-dd"), "0", "inicioBoletaNueva", Int32.Parse ("0"), usuario_, "false");
                    db.AgregarVentaBd (nuevaVenta);

                    entryNumBoleta.Text = "";

                    Dialog dialog = new Dialog ("EDITAR BOLETA", this, Gtk.DialogFlags.DestroyWithParent);
                    dialog.Modal = true;
                    dialog.Resizable = false;
                    Gtk.Label etiqueta = new Gtk.Label ();
                    etiqueta.Markup = "La operación ha sido realizada con éxito";
                    dialog.BorderWidth = 8;
                    dialog.VBox.BorderWidth = 8;
                    dialog.VBox.PackStart (etiqueta, false, false, 0);
                    dialog.AddButton ("Cerrar", ResponseType.Close);
                    dialog.ShowAll ();
                    dialog.Run ();
                    dialog.Destroy ();

                } catch (Exception ex) {
                    Dialog dialog = new Dialog ("EDITAR BOLETA", this, Gtk.DialogFlags.DestroyWithParent);
                    dialog.Modal = true;
                    dialog.Resizable = false;
                    Gtk.Label etiqueta = new Gtk.Label ();
                    etiqueta.Markup = "Ha ocurrido un error al editar boleta";
                    dialog.BorderWidth = 8;
                    dialog.VBox.BorderWidth = 8;
                    dialog.VBox.PackStart (etiqueta, false, false, 0);
                    dialog.AddButton ("Cerrar", ResponseType.Close);
                    dialog.ShowAll ();
                    dialog.Run ();
                    dialog.Destroy ();
                    Console.WriteLine ("error editar boleta: " + ex);
                }

            } else {

                Dialog dialog = new Dialog ("EDITAR BOLETA", this, Gtk.DialogFlags.DestroyWithParent);
                dialog.Modal = true;
                dialog.Resizable = false;
                Gtk.Label etiqueta = new Gtk.Label ();
                etiqueta.Markup = "La boleta ingresada es menor a la del sistema";
                dialog.BorderWidth = 8;
                dialog.VBox.BorderWidth = 8;
                dialog.VBox.PackStart (etiqueta, false, false, 0);
                dialog.AddButton ("Cerrar", ResponseType.Close);
                dialog.ShowAll ();
                dialog.Run ();
                dialog.Destroy ();

            }
        }
예제 #19
0
 public DialogBox(Dialog startDialog)
 {
     this.groupRect = new Rect(0,Screen.height/2,Screen.width,Screen.height/2);
     this.boxRect = new Rect(0,0,Screen.width,Screen.height/2);
     this.typingPause = 0.1f;
     this.currentDialog = startDialog;
     this.currentText = "";
     this.currentTime = Time.time;
 }
예제 #20
0
파일: Living.cs 프로젝트: StaNov/Ludum-Dare
 void Start()
 {
     anim = GetComponent<Animator> ();
     ss = GetComponent<ShapeShiftController> ();
     dia = GetComponentInChildren<Dialog> ();
     bus = GameObject.Find("Bus").gameObject;
     rb = bus.GetComponent<Rigidbody2D> ();
     ending_scene = false;
 }
		private void SaveDialogToDb(Dialog dialog)
		{
			if (dialog != null)
			{
				var dialogTable = new DialogTable(dialog);
				dialogTable.LastMessageSent = DateTime.UtcNow;
				Database.Instance().SaveDialog(dialogTable);
			}
		}
예제 #22
0
    void Awake()
    {
        i = this;

        AudioClip[] clippers = Resources.LoadAll<AudioClip>("Dialog/");

        foreach (AudioClip clip in clippers)
            clips.Add(clip.name, clip);
    }
예제 #23
0
 public Option(string optionText, string clickText, Dialog clickDialog, string loadScene, string activateFunction, string activateFunctionGameObject)
 {
     this.optionText = optionText;
     this.clickText = clickText;
     this.clickDialog = clickDialog;
     this.loadScene = loadScene;
     this.activateFunction = activateFunction;
     this.activateFunctionGameObject = activateFunctionGameObject;
 }
예제 #24
0
 protected void OnButton1Clicked(object sender, EventArgs e)
 {
     dialog = new Dialog ("Sample", this, Gtk.DialogFlags.DestroyWithParent);
     dialog.Modal = true;
     dialog.AddButton ("Close", ResponseType.Close);
     dialog.Response += (o, args) => Console.WriteLine(args.ResponseId);
     dialog.Run ();
     dialog.Destroy ();
 }
예제 #25
0
        public string Initialize(string dialogName)
        {
            Check.Required<ArgumentNullException>(() => dialogName != null);

            if (!_storage.TryGetValue(dialogName, out _dialog))
                _dialog = _emptyDialog;

            return _dialog.Initialize();
        }
예제 #26
0
 public void CloseDialog()
 {
     dialogElement.gameObject.SetActive(false);
     actionsElement.gameObject.SetActive(false);
     CanvasGroup.alpha = 0;
     CanvasGroup.blocksRaycasts = false;
     CanvasGroup.interactable = false;
     currentDialog = null;
     IsOpen = false;
 }
예제 #27
0
    private bool DrawText(Dialog dialog)
    {
        string conversationText=GetConversationText();

        int textPos=(int)((Time.time-conversationTextStartSec)*dialog.charactersPerSecond);
        textPos=Mathf.Min(conversationText.Length,textPos);
        GUILayout.Label(conversationText.Substring(0,textPos),new GUILayoutOption[]{GUILayout.ExpandHeight(true),GUILayout.ExpandWidth(true)});

        return textPos==conversationText.Length;
    }
예제 #28
0
    public override void Interact()
    {
        if (dialog == null)
        {
            dialog = DialogPrefab.Instantiate().GetComponent<Dialog>();

            dialog.OnClosed += DialogClosed;
            dialog.GetComponent<Dialog>().StartConversation(SignText);
        }
    }
예제 #29
0
    void OnGUI()
    {
        currentDialog = GetActiveDialog();

        if (currentDialog != null)
        {
            GameStorage.gameState = GameStorage.GameState.Paused;
            DialogBox dialogBox = new DialogBox(currentDialog);
        }
    }
예제 #30
0
    public void ShowDialog(string dialogName, string message)
    {
        this.DismissDialog();

        GameObject prefab = Resources.Load ("Prefabs/Dialogs/"+dialogName) as GameObject;
        GameObject go = GameObject.Instantiate(prefab) as GameObject;
        go.transform.parent = dialogAnchor.transform;
        go.transform.localPosition = Vector3.zero;
        currentlyVisibleDialog = go.GetComponent<Dialog>();
        currentlyVisibleDialog.SetMessage(message);
    }
예제 #31
0
 public DialogBot(HRBotStateService botStateService, T dialog, ILogger <DialogBot <T> > logger)
 {
     hrBotStateService = botStateService ?? throw new System.ArgumentNullException(nameof(botStateService));
     dialog            = dialog ?? throw new System.ArgumentNullException(nameof(dialog));
     logger            = logger ?? throw new System.ArgumentNullException(nameof(logger));
 }
예제 #32
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnCapNhat_Click(object sender, DirectEventArgs e)
        {
            try
            {
                if (e.ExtraParams["Command"] != "Edit")
                {
                    var groupQuantumId = 0;
                    var grade          = 0;
                    if (!string.IsNullOrEmpty(hdfGroupQuantumId.Text))
                    {
                        groupQuantumId = Convert.ToInt32(hdfGroupQuantumId.Text);
                    }
                    if (!string.IsNullOrEmpty(hdfBac.Text))
                    {
                        grade = Convert.ToInt32(hdfBac.Text);
                    }
                    var groupQuantum = GetSalaryGroupQuantumByCondition(groupQuantumId, null, grade);
                    if (groupQuantum != null)
                    {
                        X.Msg.Alert("Thông báo từ hệ thống", "Ngạch và bậc " + groupQuantum.SalaryGrade + " đã có dữ liệu. Bạn không thể thêm mới dữ liệu khác").Show();
                        return;
                    }
                }

                var salaryController = new CatalogGroupQuantumGradeController();
                var salary           = new cat_GroupQuantumGrade();
                if (!string.IsNullOrEmpty(hdfGroupQuantumId.Text))
                {
                    salary.GroupQuantumId = Convert.ToInt32(hdfGroupQuantumId.Text);
                }
                salary.SalaryLevel = txtMucLuong.Text;
                if (!string.IsNullOrEmpty(txtHeSoLuong.Text))
                {
                    salary.SalaryFactor = Convert.ToDecimal(txtHeSoLuong.Text.Replace('.', ','));
                }
                if (!string.IsNullOrEmpty(hdfBac.Text))
                {
                    salary.SalaryGrade = Convert.ToInt32(hdfBac.Text);
                }
                salary.Description = txtGhiChu.Text;
                salary.CreatedDate = DateTime.Now;

                if (e.ExtraParams["Command"] == "Edit")
                {
                    if (!string.IsNullOrEmpty(hdfRecordId.Text))
                    {
                        salary.Id = Convert.ToInt32(hdfRecordId.Text);
                    }
                    salaryController.Update(salary);
                    Dialog.ShowNotification("Cập nhật dữ liệu thành công");
                    wdThemMoiMucLuongNgach.Hide();
                }
                else
                {
                    if (cat_GroupQuantumServices.checkOutFrame(salary.GroupQuantumId, salary.SalaryGrade) == false)
                    {
                        Dialog.ShowError("Bậc bạn chọn đã vượt quá số bậc tối đa của ngạch");
                        return;
                    }
                    salaryController.Insert(salary);
                    Dialog.ShowNotification("Thêm mới dữ liệu thành công!");
                    if (e.ExtraParams["Close"] == "True")
                    {
                        wdThemMoiMucLuongNgach.Hide();
                    }
                    else
                    {
                        RM.RegisterClientScriptBlock("rs1", "ResetWdThemMucLuongNgach();");
                    }
                }
                GridPanel1.Reload();
            }
            catch (Exception ex)
            {
                X.Msg.Alert("Thông báo từ hệ thống", "Có lỗi xảy ra: " + ex.Message).Show();
            }
        }
예제 #33
0
    private SetElem ProcessSetElem(ActorBrain actorBrain, Dialog dialog, XmlNode node, bool oneUse)
    {
        dynamic setElem = null;

        switch (node.Name)
        {
        case "set":
            setElem = new SetElem(actorBrain, dialog);
            break;

        case "inc":
            setElem = new SetElemIncVar(actorBrain, dialog, false);
            break;

        case "dec":
            setElem = new SetElemIncVar(actorBrain, dialog, true);
            break;
        }

        if (setElem != null)
        {
            oneUse = oneUse || ExistsChildNode(node, "oneuse");

            string name  = FindChildText(node, "name");
            string value = null;

            SetFunctionElem functionElem = null;

            XmlNode funcNode = FindChildNode(node, "value");
            if (funcNode != null)
            {
                functionElem = ProcessSetFunctionElem(actorBrain, GetChildNode(funcNode));
            }

            if (functionElem == null)
            {
                value = FindChildText(node, "value");
                if (value != null && value.Length == 0)
                {
                    value = null;
                }
            }


            if (name != null)
            {
                name = name.ToLower();
            }
            else
            {
                name = GetTextNode(node);
                if (name != null && name.Length == 0)
                {
                    name = null;
                }
            }

            setElem.SetOneUse(oneUse);
            setElem.SetName(name);
            setElem.SetValue(value);
            setElem.SetFunction(functionElem);
        }

        return(setElem);
    }
예제 #34
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            var cancelButton = Template.FindName("CancelButton", this) as ImageButton;
            var fileButton = Template.FindName("FileButton", this) as ImageButton;
            var folderButton = Template.FindName("FolderButton", this) as ImageButton;
            var detailsButton = Template.FindName("DetailsButton", this) as ImageButton;
            var copyMenu = Template.FindName("CopyMenuItem", this) as ImageMenuItem;
            var copyImageMenu = Template.FindName("CopyImageMenuItem", this) as ImageMenuItem;
            var copyFilenameMenu = Template.FindName("CopyFilenameMenuItem", this) as ImageMenuItem;
            var copyFolderMenu = Template.FindName("CopyFolderMenuItem", this) as ImageMenuItem;

            if (cancelButton != null)
                cancelButton.Click += (s, a) => RaiseCancelClickedEvent();

            //Open file.
            if (fileButton != null)
                fileButton.Click += (s, a) =>
                {
                    RaiseOpenFileClickedEvent();

                    try
                    {
                        if (!string.IsNullOrWhiteSpace(OutputFilename) && File.Exists(OutputFilename))
                            Process.Start(OutputFilename);
                    }
                    catch (Exception ex)
                    {
                        Dialog.Ok("Open File", "Error while openning the file", ex.Message);
                    }
                };

            //Open folder.
            if (folderButton != null)
                folderButton.Click += (s, a) =>
                {
                    RaiseExploreFolderClickedEvent();

                    try
                    {
                        if (!string.IsNullOrWhiteSpace(OutputFilename) && Directory.Exists(OutputPath))
                            Process.Start("explorer.exe", $"/select,\"{OutputFilename}\"");
                    }
                    catch (Exception ex)
                    {
                        Dialog.Ok("Explore Folder", "Error while openning the folder", ex.Message);
                    }
                };

            //Details. Usually when something wrong happens.
            if (detailsButton != null)
                detailsButton.Click += (s, a) =>
                {
                    if (Exception != null)
                    {
                        var viewer = new ExceptionViewer(Exception);
                        viewer.ShowDialog();
                    }  
                };

            //Copy (as image and text).
            if (copyMenu != null)
                copyMenu.Click += (s, a) => 
                {
                    if (!string.IsNullOrWhiteSpace(OutputFilename))
                    {
                        var data = new DataObject();
                        data.SetImage(OutputFilename.SourceFrom());
                        data.SetText(OutputFilename, TextDataFormat.Text);
                        data.SetFileDropList(new StringCollection { OutputFilename });

                        Clipboard.SetDataObject(data, true);
                    }
                };

            //Copy as image.
            if (copyImageMenu != null)
                copyImageMenu.Click += (s, a) =>
                {
                    if (!string.IsNullOrWhiteSpace(OutputFilename))
                        Clipboard.SetImage(OutputFilename.SourceFrom());
                };

            //Copy full path.
            if (copyFilenameMenu != null)
                copyFilenameMenu.Click += (s, a) =>
                {
                    if (!string.IsNullOrWhiteSpace(OutputFilename))
                        Clipboard.SetText(OutputFilename);
                };

            //Copy folder path.
            if (copyFolderMenu != null)
                copyFolderMenu.Click += (s, a) =>
                {
                    if (!string.IsNullOrWhiteSpace(OutputPath))
                        Clipboard.SetText(OutputPath);
                };
        }
예제 #35
0
 // Start is called before the first frame update
 void Start()
 {
     dialog = GetComponent <Dialog>();
     col    = GetComponent <BoxCollider2D>();
 }
예제 #36
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();
        DialogTree myTarget = (DialogTree)target;


        if (GUILayout.Button("Add Dialog"))
        {
            GameObject myPoint = (GameObject)Instantiate(myTarget.dialogPrefab, myTarget.transform.position, myTarget.transform.rotation);
            myPoint.transform.parent = myTarget.transform;
        }

        if (GUILayout.Button("Save Dialog Tree Asset"))
        {
            DialogTreeAsset asset           = myTarget.myAsset;
            bool            shouldCreateNew = false;
            if (asset == null)
            {
                asset           = ScriptableObject.CreateInstance <DialogTreeAsset> ();
                shouldCreateNew = true;
            }
            asset.dialogs = new DialogObject[myTarget.dialogs.Length];
            asset.name    = myTarget.dialogName;

            for (int i = 0; i < myTarget.dialogs.Length; i++)
            {
                if (myTarget.dialogs[i] != null)
                {
                    asset.dialogs[i] = new DialogObject {
                        tag             = myTarget.dialogs[i].myTag,
                        text            = myTarget.dialogs[i].text,
                        clearImage      = myTarget.dialogs[i].clearImage,
                        image           = myTarget.dialogs[i].image,
                        bigSpriteAction = myTarget.dialogs[i].bigSpriteAction,
                        bigSpriteSlot   = myTarget.dialogs[i].bigSpriteSlot,
                        bigSprite       = myTarget.dialogs[i].bigSprite,
                        delay           = myTarget.dialogs[i].delay,
                        breakAutoChain  = myTarget.dialogs[i].breakAutoChain
                    };
                }
            }

            if (shouldCreateNew)
            {
                AssetDatabase.CreateAsset(asset, "Assets/-" + myTarget.dialogName + "- Dialog.asset");
                AssetDatabase.SaveAssets();
            }

            EditorUtility.FocusProjectWindow();

            Selection.activeObject = asset;

            myTarget.myAsset = asset;
        }

        if (GUILayout.Button("Load Dialog Tree Asset"))
        {
            if (myTarget.myAsset != null)
            {
                Dialog[] myChild = myTarget.GetComponentsInChildren <Dialog> ();
                for (int i = 0; i < myChild.Length; i++)
                {
                    DestroyImmediate(myChild[i].gameObject);
                }

                foreach (DialogObject dia in myTarget.myAsset.dialogs)
                {
                    GameObject myPoint = (GameObject)Instantiate(myTarget.dialogPrefab, myTarget.transform.position, myTarget.transform.rotation);
                    myPoint.transform.parent = myTarget.transform;
                    Dialog myDia = myPoint.GetComponent <Dialog> ();
                    myDia.myTag           = dia.tag;
                    myDia.text            = dia.text;
                    myDia.clearImage      = dia.clearImage;
                    myDia.image           = dia.image;
                    myDia.bigSpriteAction = dia.bigSpriteAction;
                    myDia.bigSpriteSlot   = dia.bigSpriteSlot;
                    myDia.bigSprite       = dia.bigSprite;
                    myDia.delay           = dia.delay;
                    myDia.breakAutoChain  = dia.breakAutoChain;
                }

                //myTarget.myAsset = null;
                myTarget.dialogName          = myTarget.myAsset.name;
                myTarget.updateAssetRealtime = true;
            }
        }


        if (GUILayout.Button("Reset Dialog Tree"))
        {
            myTarget.myAsset = null;
            Dialog[] myChild = myTarget.GetComponentsInChildren <Dialog> ();
            for (int i = 0; i < myChild.Length; i++)
            {
                DestroyImmediate(myChild[i].gameObject);
            }
            myTarget.dialogName          = "New Dialog";
            myTarget.updateAssetRealtime = false;
        }
    }
        public override Android.Views.View GetView(int position, Android.Views.View convertView, Android.Views.ViewGroup parent)
        {
            LayoutInflater inflater = context.LayoutInflater;
            View           v        = inflater.Inflate(Resource.Layout.Organizator_Trip_GridViewAdapter, null, true);

            ImageView Icon_iView = v.FindViewById <ImageView> (Resource.Id.imageView1);

            Icon_iView.SetImageDrawable(Icons[position]);

            Icon_iView.Click += (object sender, EventArgs e) => {
                switch (position)
                {
                case 1: {
                    context.StartActivity(typeof(Organizator_Trip_VizualizareExcursionisti));
                } break;

                case 3:
                {
                    Dialog diag = new Dialog(context);
                    diag.Window.RequestFeature(WindowFeatures.NoTitle);

                    View      CostumView = inflater.Inflate(Resource.Layout.Utilizator_Trip_TripInfo_AlertDialogAdapter, null);
                    TextView  NumeCamp   = CostumView.FindViewById <TextView>(Resource.Id.textView1);
                    ImageView EditInfo   = CostumView.FindViewById <ImageView>(Resource.Id.imageView1);
                    EditText  NewValue   = CostumView.FindViewById <EditText>(Resource.Id.editText1);

                    SaveUsingSharedPreferences Save = new SaveUsingSharedPreferences(context);
                    string Distanta = Save.LoadString(SaveUsingSharedPreferences.Tags.Organizator.Distanta);

                    NumeCamp.Text   = "Valoarea actuala este:" + Distanta;
                    EditInfo.Click += (object sender1, EventArgs e1) =>
                    {
                        Save.Save(SaveUsingSharedPreferences.Tags.Organizator.Distanta, NewValue.Text);

                        diag.Cancel();
                    };

                    diag.SetContentView(CostumView);

                    diag.SetCanceledOnTouchOutside(true);
                    diag.Show();
                    diag.Window.SetBackgroundDrawable(context.Resources.GetDrawable(Resource.Drawable.background_MarginiOvaleAlb));
                } break;

                case 4: {
                    PopupMenu popup = new PopupMenu(context, v);
                    popup.MenuItemClick += (object s, PopupMenu.MenuItemClickEventArgs e1) =>
                    {
                        switch (e1.Item.ToString())
                        {
                        case "Adauga intrebare noua":
                        {
                            context.StartActivity(typeof(Organizator_Trip_NewQuestionPool));
                        } break;

                        case "Vezi progresul intrebarilor actuale":
                        {
                            TcpClient     Client = new TcpClient(_Details.ServerIP, _Details.LargeFilesPort);
                            NetworkStream ns     = Client.GetStream();

                            string TripId = new SaveUsingSharedPreferences(context).LoadString(SaveUsingSharedPreferences.Tags.Trip.TipId);
                            _TcpDataExchange.WriteStreamString(ns, CryptDecryptData.CryptData(new string[] { _Details.RequestVotesQuestionPool, TripId }));

                            string[] Response = CryptDecryptData.DecryptData(_TcpDataExchange.ReadStreamString(ns));

                            string[] Intrebari = Response[0].Split(',');
                            string[] Ids       = Response[1].Split(',');

                            var Test = new Organizator_Trip_ViewQuestionPool_Adapters.IntrebarVariante[Intrebari.Length];

                            for (int i = 0; i < Intrebari.Length; i++)
                            {
                                Response = CryptDecryptData.DecryptData(_TcpDataExchange.ReadStreamString(ns));

                                List <string> Variante = new List <string>();
                                List <string> Procente = new List <string>();

                                for (int j = 0; j < Response.Length; j++)
                                {
                                    if (Response[j] != "")
                                    {
                                        Variante.Add(Response[j].Split(',')[0]);
                                        Procente.Add(Response[j].Split(',')[1]);
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }

                                var temp = new Organizator_Trip_ViewQuestionPool_Adapters.IntrebarVariante();
                                temp.Intrebare = Intrebari[i];
                                temp.Variante  = Variante.ToArray();
                                temp.Procente  = Procente.ToArray();

                                Test[i] = temp;
                            }

                            Organizator_Trip_ViewQuestionPool_DialogFragment diag = new Organizator_Trip_ViewQuestionPool_DialogFragment(Test);
                            diag.Show(context.FragmentManager, "ViewQuestionPool");
                        } break;
                        }
                    };
                    MenuInflater menuInflater = popup.MenuInflater;
                    menuInflater.Inflate(Resource.Menu.OptiuniQuestionPool, popup.Menu);
                    popup.Show();
                } break;
                }
            };

            return(v);
        }
예제 #38
0
 public RootBot(ConversationState conversationState, T mainDialog)
 {
     _conversationState = conversationState;
     _mainDialog        = mainDialog;
 }
예제 #39
0
    void InitializeUI()
    {
        var os  = Environment.OSVersion;
        var pid = os.Platform;

        switch (pid)
        {
        case PlatformID.MacOSX:
            this.Title = "DeepLearnUI (OSX, Mono, Beta)";
            break;

        case PlatformID.Unix:
            this.Title = "DeepLearnUI (Unix/Linux/OSX, Mono, Beta)";
            break;

        case PlatformID.Xbox:
            this.Title = "DeepLearnUI (Xbox, Beta)";
            break;

        case PlatformID.WinCE:
            this.Title = "DeepLearnUI (WinCE x86/x64, Beta)";
            break;

        case PlatformID.Win32NT:
            this.Title = "DeepLearnUI (WinNT x86/x64, Beta)";
            break;

        case PlatformID.Win32Windows:
            this.Title = "DeepLearnUI (Win x86/x64, 1.0)";
            break;

        default:
            this.Title = "DeepLearnUI (Unknown OS, Beta)";
            break;
        }

        Confirm = new Dialog(
            "Are you sure?",
            this,
            DialogFlags.Modal,
            "Yes", ResponseType.Accept,
            "No", ResponseType.Cancel
            )
        {
            Resizable    = false,
            KeepAbove    = true,
            TypeHint     = WindowTypeHint.Dialog,
            WidthRequest = 250
        };

        Confirm.ActionArea.LayoutStyle = ButtonBoxStyle.Center;
        Confirm.WindowStateEvent      += OnWindowStateEvent;

        ImageLoader = new FileChooserDialog(
            "Load image",
            this,
            FileChooserAction.Open,
            "Cancel", ResponseType.Cancel,
            "Open", ResponseType.Accept
            );

        ClearDigit();

        CopyDrawing(Digit);

        CopyClassification();

        ProbabilityZ.IsEditable = false;
        Probability1.IsEditable = false;
        Probability2.IsEditable = false;
        Probability3.IsEditable = false;
        Probability4.IsEditable = false;
        Probability5.IsEditable = false;
        Probability6.IsEditable = false;
        Probability7.IsEditable = false;
        Probability8.IsEditable = false;
        Probability9.IsEditable = false;

        ScoreBox.ModifyFont(Pango.FontDescription.FromString("Verdana 16"));
        ClassificationBox.ModifyFont(Pango.FontDescription.FromString("Verdana 16"));

        for (int i = 0; i < cnn.Layers.Count; i++)
        {
            switch (cnn.Layers[i].Type)
            {
            case LayerTypes.Input:
                NetworkLayers.AppendText(String.Format("{0} Input", i));
                break;

            case LayerTypes.Convolution:
                NetworkLayers.AppendText(String.Format("{0} Convolution", i));
                break;

            case LayerTypes.Subsampling:
                NetworkLayers.AppendText(String.Format("{0} Subsampling / Pooling", i));
                break;
            }
        }

        PrepareImage(ActivationMap);
        PrepareImage(FeatureVector);
        PrepareImage(Output);
        PrepareImage(Weights);
        PrepareImage(NetworkBias);
        PrepareImage(FeatureMap);
        PrepareImage(BiasMap);

        NetworkLayers.Sensitive       = false;
        ActivationMapScroll.Sensitive = false;

        HideFeatureMaps();
    }
예제 #40
0
            public override void Enter()
            {
                base.Enter();
                if (Game.Instance.musicChannel1 != null)
                {
                    Game.Instance.musicChannel1.Stop(1f);
                    Game.Instance.musicChannel1 = null;
                }
                if (Game.Instance.ambienceChannel1 != null)
                {
                    Game.Instance.ambienceChannel1.Stop(1f);
                    Game.Instance.ambienceChannel1 = null;
                }
                if (Instance.GameState == GameState.Won)
                {
                    scoreScreenVictoryMusic = Program.Instance.SoundManager.GetStream(Client.Sound.Stream.ScoreScreenVictoryMusic1).Play(new Sound.PlayArgs
                    {
                        FadeInTime = 1f,
                        Looping    = true
                    });
                }
                else
                {
                    scoreScreenDefeatMusic = Program.Instance.SoundManager.GetStream(Client.Sound.Stream.ScoreScreenVictoryMusic1).Play(new Sound.PlayArgs
                    {
                        FadeInTime = 1f,
                        Looping    = true
                    });
                }
                Game.Instance.Pause();

                var ss = new Interface.ScoreScreenControl
                {
                    GameState              = Game.Instance.GameState,
                    Map                    = Game.Instance.Map,
                    GameTime               = Game.Instance.GameTime,
                    Statistics             = Game.Instance.Statistics,
                    AchievementsEarned     = Game.Instance.AchievementsEarned,
                    NPlaythroughs          = Program.Instance.Profile.GetNPlaythroughs(Game.Instance.LoadMapFilename) + 1,
                    SilverYield            = Game.Instance.SilverYield,
                    PreviousMaxSilverYield = Game.Instance.PreviousMaxSilverYield,
                    FirstTimeCompletedMap  = Game.Instance.GameState == GameState.Won && !Game.Instance.HasPreviouslyCompletedMap,
                    CurrentStages          = Game.Instance.CurrentStageInfos,
                    BestStages             = Game.Instance.BestStagesInfos,
                    SilverEnabled          = Program.Settings.SilverEnabled,
                    HideStats              = Program.Settings.HideStats,
                };

                if (Game.Instance.GameState == GameState.Lost)
                {
                    ss.LostGameReason = Game.Instance.LostReason;
                }

                var ep = Game.Instance.GoldYield;

                ss.EarnedGoldCoins = ep;

                Program.Instance.Interface.AddChild(ss);

                Game.Instance.MaximizeStages();

                if (Game.Instance.GameState == GameState.Won && !Game.Instance.HasPreviouslyCompletedMap &&
                    Program.Settings.DisplayMapRatingDialog == MapRatingDialogSetup.Required)
                {
                    Dialog.Show(new Interface.RatingBox());
                }
            }
        public static List <OuiJournalCollabProgressInLobby> GeneratePages(OuiJournal journal, string levelSet)
        {
            List <OuiJournalCollabProgressInLobby> pages = new List <OuiJournalCollabProgressInLobby>();
            int rowCount = 0;
            OuiJournalCollabProgressInLobby currentPage = new OuiJournalCollabProgressInLobby(journal, levelSet);

            pages.Add(currentPage);

            int  totalStrawberries = 0;
            int  totalDeaths       = 0;
            int  sumOfBestDeaths   = 0;
            long totalTime         = 0;
            long sumOfBestTimes    = 0;

            bool allMapsDone = true;

            bool allLevelsDone       = true;
            bool allSpeedBerriesDone = true;

            string heartTexture = MTN.Journal.Has("CollabUtils2Hearts/" + levelSet) ? "CollabUtils2Hearts/" + levelSet : "heartgem0";

            foreach (AreaStats item in SaveData.Instance.Areas_Safe)
            {
                AreaData areaData = AreaData.Get(item.ID_Safe);
                if (!areaData.Interlude_Safe)
                {
                    if (LobbyHelper.IsHeartSide(areaData.GetSID()))
                    {
                        if (allMapsDone || item.TotalTimePlayed > 0)
                        {
                            // add a separator, like the one between regular maps and Farewell
                            currentPage.table.AddRow();
                        }
                        else
                        {
                            // all maps weren't complete yet, and the heart side was never accessed: hide the heart side for now.
                            continue;
                        }
                    }

                    string strawberryText = null;
                    if (areaData.Mode[0].TotalStrawberries > 0 || item.TotalStrawberries > 0)
                    {
                        strawberryText = item.TotalStrawberries.ToString();
                        if (item.Modes[0].Completed)
                        {
                            strawberryText = strawberryText + "/" + areaData.Mode[0].TotalStrawberries;
                        }
                    }
                    else
                    {
                        strawberryText = "-";
                    }

                    Row row = currentPage.table.AddRow()
                              .Add(new TextCell(Dialog.Clean(areaData.Name), new Vector2(1f, 0.5f), 0.6f, currentPage.TextColor))
                              .Add(null)
                              .Add(new IconCell(item.Modes[0].HeartGem ? heartTexture : "dot"))
                              .Add(new TextCell(strawberryText, currentPage.TextJustify, 0.5f, currentPage.TextColor));

                    if (item.TotalTimePlayed > 0)
                    {
                        row.Add(new TextCell(Dialog.Deaths(item.Modes[0].Deaths), currentPage.TextJustify, 0.5f, currentPage.TextColor));
                    }
                    else
                    {
                        row.Add(new IconCell("dot"));
                    }


                    AreaStats stats = SaveData.Instance.GetAreaStatsFor(areaData.ToKey());
                    if (CollabMapDataProcessor.SilverBerries.TryGetValue(areaData.GetLevelSet(), out Dictionary <string, EntityID> levelSetBerries) &&
                        levelSetBerries.TryGetValue(areaData.GetSID(), out EntityID berryID) &&
                        stats.Modes[0].Strawberries.Contains(berryID))
                    {
                        // silver berry was obtained!
                        row.Add(new IconCell("CollabUtils2/silver_strawberry"));
                    }
                    else if (stats.Modes[0].Strawberries.Any(berry => areaData.Mode[0].MapData.Goldenberries.Any(golden => golden.ID == berry.ID && golden.Level.Name == berry.Level)))
                    {
                        // golden berry was obtained!
                        row.Add(new IconCell("CollabUtils2/golden_strawberry"));
                    }
                    else if (item.Modes[0].SingleRunCompleted)
                    {
                        row.Add(new TextCell(Dialog.Deaths(item.Modes[0].BestDeaths), currentPage.TextJustify, 0.5f, currentPage.TextColor));
                        sumOfBestDeaths += item.Modes[0].BestDeaths;
                    }
                    else
                    {
                        // the player didn't ever do a single run.
                        row.Add(new IconCell("dot"));
                        allLevelsDone = false;
                    }

                    if (item.TotalTimePlayed > 0)
                    {
                        row.Add(new TextCell(Dialog.Time(item.TotalTimePlayed), currentPage.TextJustify, 0.5f, currentPage.TextColor));
                    }
                    else
                    {
                        row.Add(new IconCell("dot"));
                    }

                    if (CollabModule.Instance.Settings.BestTimeToDisplayInJournal == CollabSettings.BestTimeInJournal.SpeedBerry)
                    {
                        if (CollabMapDataProcessor.SpeedBerries.TryGetValue(item.GetSID(), out CollabMapDataProcessor.SpeedBerryInfo speedBerryInfo) &&
                            CollabModule.Instance.SaveData.SpeedBerryPBs.TryGetValue(item.GetSID(), out long speedBerryPB))
                        {
                            row.Add(new TextCell(Dialog.Time(speedBerryPB), currentPage.TextJustify, 0.5f, getRankColor(speedBerryInfo, speedBerryPB)));
                            row.Add(new IconCell(getRankIcon(speedBerryInfo, speedBerryPB)));
                            sumOfBestTimes += speedBerryPB;
                        }
                        else
                        {
                            row.Add(new IconCell("dot")).Add(null);
                            allSpeedBerriesDone = false;
                        }
                    }
                    else
                    {
                        if (item.Modes[0].BestTime > 0f)
                        {
                            row.Add(new TextCell(Dialog.Time(item.Modes[0].BestTime), currentPage.TextJustify, 0.5f, currentPage.TextColor)).Add(null);
                            sumOfBestTimes += item.Modes[0].BestTime;
                        }
                        else
                        {
                            row.Add(new IconCell("dot")).Add(null);
                            allSpeedBerriesDone = false;
                        }
                    }

                    totalStrawberries += item.TotalStrawberries;
                    totalDeaths       += item.Modes[0].Deaths;
                    totalTime         += item.TotalTimePlayed;

                    if (!item.Modes[0].HeartGem)
                    {
                        allMapsDone = false;
                    }

                    rowCount++;
                    if (rowCount > 11)
                    {
                        // split the next zones into another page.
                        rowCount    = 0;
                        currentPage = new OuiJournalCollabProgressInLobby(journal, levelSet);
                        pages.Add(currentPage);
                    }
                }
            }

            if (currentPage.table.Rows > 1)
            {
                currentPage.table.AddRow();
                Row totalsRow = currentPage.table.AddRow()
                                .Add(new TextCell(Dialog.Clean("journal_totals"), new Vector2(1f, 0.5f), 0.7f, currentPage.TextColor)).Add(null)
                                .Add(null)
                                .Add(new TextCell(totalStrawberries.ToString(), currentPage.TextJustify, 0.6f, currentPage.TextColor))
                                .Add(new TextCell(Dialog.Deaths(totalDeaths), currentPage.TextJustify, 0.6f, currentPage.TextColor))
                                .Add(new TextCell(allLevelsDone ? Dialog.Deaths(sumOfBestDeaths) : "-", currentPage.TextJustify, 0.6f, currentPage.TextColor))
                                .Add(new TextCell(Dialog.Time(totalTime), currentPage.TextJustify, 0.6f, currentPage.TextColor))
                                .Add(new TextCell(allSpeedBerriesDone ? Dialog.Time(sumOfBestTimes) : "-", currentPage.TextJustify, 0.6f, currentPage.TextColor)).Add(null);

                for (int l = 1; l < SaveData.Instance.UnlockedModes; l++)
                {
                    totalsRow.Add(null);
                }
                totalsRow.Add(new TextCell(Dialog.Time(SaveData.Instance.Time), currentPage.TextJustify, 0.6f, currentPage.TextColor));
                currentPage.table.AddRow();
            }

            return(pages);
        }
예제 #42
0
        public void BindData()
        {
            try
            {
                // from date
                var fromDate = _filter.StartDate != null?_filter.StartDate.Value.ToString("yyyy-MM-dd 00:00:00") : string.Empty;

                // to date
                var toDate = _filter.EndDate != null?_filter.EndDate.Value.ToString("yyyy-MM-dd 23:59:59") : string.Empty;

                // select form db
                var table = SQLHelper.ExecuteTable(SQLReportRegulationAdapter.GetStore_EmployeeAdjust(string.Join(",", _filter.Departments.Split(
                                                                                                                      new[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(d => "'{0}'".FormatWith(d))), true, fromDate, toDate, _filter.Condition));
                DataSource = table;
                // binding data
                xrCellEmployeeCode.DataBindings.Add("Text", DataSource, "EmployeeCode");
                xrCellFullName.DataBindings.Add("Text", DataSource, "FullName");
                xrCellDegree.DataBindings.Add("Text", DataSource, "Certify");
                xrCellPosition.DataBindings.Add("Text", DataSource, "PositionName");
                xrCellWorkingDate.DataBindings.Add("Text", DataSource, "Date", "{0:dd/MM/yyyy}");
                xrCellDepartment.DataBindings.Add("Text", DataSource, "DepartmentName");
                xrCellTotal.DataBindings.Add("Text", DataSource, "xEmployee", "{0: 0 người}");
                // group
                GroupHeader1.GroupFields.AddRange(new[]
                {
                    new GroupField("DepartmentId", XRColumnSortOrder.Ascending)
                });
                xrt_GroupDepartment.DataBindings.Add("Text", DataSource, "DepartmentName");
                // other items
                // label report title
                if (!string.IsNullOrEmpty(_filter.ReportTitle))
                {
                    lblReportTitle.Text = _filter.ReportTitle;
                }
                // lablel duration
                if (_filter.StartDate != null && _filter.EndDate != null)
                {
                    lblDuration.Text = lblDuration.Text.FormatWith(_filter.StartDate.Value.ToString("dd/MM/yyyy"),
                                                                   _filter.EndDate.Value.ToString("dd/MM/yyyy"));
                }
                else
                {
                    lblDuration.Text = string.Empty;
                }
                // label report date
                lblReportDate.Text = lblReportDate.Text.FormatWith(_filter.ReportDate.Day, _filter.ReportDate.Month, _filter.ReportDate.Year);
                // created by
                if (!string.IsNullOrEmpty(_filter.CreatedByTitle))
                {
                    lblCreatedByTitle.Text = _filter.CreatedByTitle;
                }
                if (!string.IsNullOrEmpty(_filter.CreatedByName))
                {
                    lblCreatedByName.Text = _filter.CreatedByName;
                }
                // reviewed by
                //if(!string.IsNullOrEmpty(_filter.ReviewedByTitle)) lblReviewedByTitle.Text = _filter.ReviewedByTitle;
                //if(!string.IsNullOrEmpty(_filter.ReviewedByName)) lblReviewedByName.Text = _filter.ReviewedByName;
                // signed by
                if (!string.IsNullOrEmpty(_filter.SignedByTitle))
                {
                    lblSignedByTitle.Text = _filter.SignedByTitle;
                }
                if (!string.IsNullOrEmpty(_filter.SignedByName))
                {
                    lblSignedByName.Text = _filter.SignedByName;
                }
            }
            catch (Exception ex)
            {
                Dialog.ShowError(ex);
            }
        }
예제 #43
0
 async public void User()
 {
     // await Navigation.Push<UserViewModel>();
     await Dialog.Error();
 }
예제 #44
0
 async public void Product()
 {
     // await Navigation.Push<ProductViewModel>();
     await Dialog.Error();
 }
예제 #45
0
        private void Update()
        {
            try
            {
                var makerPosition  = string.Empty;
                var destDepartment = string.Empty;
                if (hdfIsUpdateMakerPosition.Text == @"0")
                {
                    makerPosition = cbxUpdateMakerPosition.Text;
                }
                else
                {
                    makerPosition = cbxUpdateMakerPosition.SelectedItem.Text;
                }
                if (hdfIsUpdateDestDepartment.Text == @"0")
                {
                    destDepartment = cbxUpdateDestDepartment.Text;
                }
                else
                {
                    destDepartment = cbxUpdateDestDepartment.SelectedItem.Text;
                }

                int id;
                if (!int.TryParse(hdfKeyRecord.Text, out id) || id <= 0)
                {
                    return;
                }
                var business = hr_BusinessHistoryServices.GetById(id);
                var util     = new Util();
                if (business == null)
                {
                    return;
                }
                if (!string.IsNullOrEmpty(hdfRecordId.Text))
                {
                    business.RecordId = Convert.ToInt32(hdfRecordId.Text);
                }
                if (!util.IsDateNull(dfUpdateDecisionDate.SelectedDate))
                {
                    business.DecisionDate = dfUpdateDecisionDate.SelectedDate;
                }
                business.DecisionNumber = txtUpdateDecisionNumber.Text;
                // upload file
                var path = string.Empty;
                if (uploadFileScan.HasFile)
                {
                    string directory = Server.MapPath("../");
                    path = UploadFile(uploadFileScan, Constant.PathAttachFile);
                }

                business.FileScan = path != "" ? path : hdfTepTinDinhKem.Text;
                if (!util.IsDateNull(dfUpdateEffectiveDate.SelectedDate))
                {
                    business.EffectiveDate = dfUpdateEffectiveDate.SelectedDate;
                }
                business.DecisionMaker         = txtUpdateDecisionMaker.Text;
                business.DecisionPosition      = makerPosition;
                business.CurrentPosition       = txtUpdateCurrentPosition.Text;
                business.CurrentDepartment     = txtUpdateCurrentDepartment.Text;
                business.ShortDecision         = txtUpdateShortDecision.Text;
                business.NewPosition           = txtUpdateNewPosition.Text;
                business.DestinationDepartment = destDepartment.Trim('-');
                business.Description           = txtUpdateDescription.Text;
                business.BusinessType          = hdfBusinessType.Text;
                business.CreatedDate           = DateTime.Now;
                business.EditedDate            = DateTime.Now;

                hr_BusinessHistoryServices.Update(business);
            }
            catch (Exception e)
            {
                Dialog.Alert("Có lỗi xảy ra trong quá trình cập nhật: {0}".FormatWith(e.Message));
            }
        }
예제 #46
0
 void HandleCancelClicked(object sender, EventArgs args)
 {
     Dialog.Destroy();
 }
예제 #47
0
파일: DialogBot.cs 프로젝트: naicud/BOT
 public DialogBot(BotStateService botStateService, T dialog, ILogger <DialogBot <T> > logger)
 {
     _botStateServices = botStateService ?? throw new ArgumentNullException(nameof(botStateService));
     _dialog           = dialog ?? throw new ArgumentNullException(nameof(dialog));
     _logger           = logger ?? throw new ArgumentNullException(nameof(logger));
 }
예제 #48
0
 private void ProceedConfirmation(object sender, EventArgs e)
 {
     Dialog.Dismiss();
 }
예제 #49
0
        public static TextMenu CreateMenu(bool inGame, EventInstance snapshot)
        {
            TextMenu menu = new TextMenu();

            menu.Add(new TextMenuExt.HeaderImage("menu/everest")
            {
                ImageColor   = Color.White,
                ImageOutline = true,
                ImageScale   = 0.5f
            });

            if (!inGame)
            {
                List <EverestModuleMetadata> missingDependencies = new List <EverestModuleMetadata>();

                lock (Everest.Loader.Delayed) {
                    if (Everest.Loader.Delayed.Count > 0)
                    {
                        menu.Add(new TextMenuExt.SubHeaderExt(Dialog.Clean("modoptions_coremodule_notloaded_a"))
                        {
                            HeightExtra = 0f, TextColor = Color.OrangeRed
                        });
                        menu.Add(new TextMenuExt.SubHeaderExt(Dialog.Clean("modoptions_coremodule_notloaded_b"))
                        {
                            HeightExtra = 0f, TextColor = Color.OrangeRed
                        });

                        foreach (Tuple <EverestModuleMetadata, Action> mod in Everest.Loader.Delayed)
                        {
                            string missingDepsString = "";
                            if (mod.Item1.Dependencies != null)
                            {
                                // check for missing dependencies
                                List <EverestModuleMetadata> missingDependenciesForMod = mod.Item1.Dependencies
                                                                                         .FindAll(dep => !Everest.Loader.DependencyLoaded(dep));
                                missingDependencies.AddRange(missingDependenciesForMod);

                                if (missingDependenciesForMod.Count != 0)
                                {
                                    // format their names and versions, and join all of them in a single string
                                    missingDepsString = string.Join(", ", missingDependenciesForMod.Select(dependency => dependency.Name + " | v." + dependency.VersionString));

                                    // ensure that string is not too long, or else it would break the display
                                    if (missingDepsString.Length > 40)
                                    {
                                        missingDepsString = missingDepsString.Substring(0, 40) + "...";
                                    }

                                    // wrap that in a " ({list} not found)" message
                                    missingDepsString = $" ({missingDepsString} {Dialog.Clean("modoptions_coremodule_notloaded_notfound")})";
                                }
                            }

                            menu.Add(new TextMenuExt.SubHeaderExt(mod.Item1.Name + " | v." + mod.Item1.VersionString + missingDepsString)
                            {
                                HeightExtra = 0f,
                                TextColor   = Color.PaleVioletRed
                            });
                        }
                    }
                }

                if (Everest.Updater.HasUpdate)
                {
                    menu.Add(new TextMenu.Button(Dialog.Clean("modoptions_coremodule_update").Replace("((version))", Everest.Updater.Newest.Build.ToString())).Pressed(() => {
                        Everest.Updater.Update(Instance.Overworld.Goto <OuiLoggedProgress>());
                    }));
                }

                if (missingDependencies.Count != 0)
                {
                    menu.Add(new TextMenu.Button(Dialog.Clean("modoptions_coremodule_downloaddeps")).Pressed(() => {
                        OuiDependencyDownloader.MissingDependencies = missingDependencies;
                        Instance.Overworld.Goto <OuiDependencyDownloader>();
                    }));
                }
            }

            // reorder Mod Options according to the modoptionsorder.txt file.
            List <EverestModule> modules = new List <EverestModule>(Everest._Modules);

            if (Everest.Loader._ModOptionsOrder != null && Everest.Loader._ModOptionsOrder.Count > 0)
            {
                foreach (string modName in Everest.Loader._ModOptionsOrder)
                {
                    if (modName.Equals("Everest", StringComparison.InvariantCultureIgnoreCase))
                    {
                        // the current entry is for Everest Core
                        createModMenuSectionAndDelete(modules, module => module.Metadata.Name == "Everest", menu, inGame, snapshot);
                    }
                    else
                    {
                        string modPath = Path.Combine(Everest.Loader.PathMods, modName);

                        // check for both PathDirectory and PathArchive for each module.
                        if (!createModMenuSectionAndDelete(modules, module => module.Metadata.PathDirectory == modPath, menu, inGame, snapshot))
                        {
                            createModMenuSectionAndDelete(modules, module => module.Metadata.PathArchive == modPath, menu, inGame, snapshot);
                        }
                    }
                }
            }

            foreach (EverestModule mod in modules)
            {
                mod.CreateModMenuSection(menu, inGame, snapshot);
            }

            if (menu.Height > menu.ScrollableMinSize)
            {
                menu.Position.Y = menu.ScrollTargetY;
            }

            return(menu);
        }
예제 #50
0
        //...

        void OnErrorOpening(string filePath) => Dialog.Show(nameof(Open), $"Cannot open '{filePath}'.", DialogImage.Error, Buttons.Ok);
예제 #51
0
        private async void Load()
        {
            _window?.ShowProgressIndicator();

            //Update Loading Indicator
            _window?.SetProgressStatus(strings.loadConf);

            try {
                Settings settings = ConfigHelper.JsonConfig;

                bool   usePrint   = settings.UsePrint;
                bool   runOnBoot  = settings.RunOnBoot;
                bool   autoUpdate = settings.AutoUpdate;
                string language   = settings.Language;
                Key    imgKey     = settings.ShortcutImgKey;
                Key    gifKey     = settings.ShortcutGifKey;

                //Use Print Key instead of default Shortcut
                PrintKeyBox.IsChecked = usePrint;

                //Run ImgurSniper on boot
                if (runOnBoot)
                {
                    RunOnBoot.IsChecked = true;
                    InstallerHelper.Autostart(true);
                }

                //Auto search for Updates
                if (autoUpdate)
                {
                    AutoUpdateBox.IsChecked = true;
                }

                //Set correct Language for Current Language Box
                switch (language)
                {
                case "en":
                    LanguageBox.SelectedItem = En;
                    break;

                case "de":
                    LanguageBox.SelectedItem = De;
                    break;
                }
                LanguageBox.SelectionChanged += LanguageBox_SelectionChanged;

                //GIF Hotkey
                HotkeyGifBox.Text = gifKey.ToString();

                //Image Hotkey
                HotkeyImgBox.Text = imgKey.ToString();
            } catch {
                await Dialog.ShowOkDialog(strings.couldNotLoad,
                                          string.Format(strings.errorConfig, ConfigHelper.ConfigPath));
            }

            //Search for Updates
            if (_window != null)
            {
                _window.SetProgressStatus(strings.checkingUpdate);
                BtnUpdate.IsEnabled = await InstallerHelper.CheckForUpdates(_window, false);
            }

            //Remove Loading Indicator
            _window?.HideProgressIndicator();
        }
예제 #52
0
 private Task OnShowDialog() => Dialog.Show(new DialogOption()
 {
     Title     = "弹窗中使用级联下拉框",
     Component = BootstrapDynamicComponent.CreateComponent <CustomerSelectDialog>()
 });
예제 #53
0
        protected override async Task ExecuteOnTarget(CharacterControl t)
        {
            await CombatManager.Instance.dialogManager.ShowDialog(DialogFilter.CombatStart, CharacterType.Bard,
                                                                  CharacterType.None, CombatManager.Instance.bard.instruments[1].sprite, "Theodore");

            await t.Heal(40);

            await CombatManager.Instance.dialogManager.ShowDialog(DialogFilter.Heal,
                                                                  CharacterType.None, Dialog.GetCharacterTypeFromCharacterControl(t),
                                                                  t.characterData.clientImage, t.characterName);
        }
예제 #54
0
 public TeamsBot(ConversationState conversationState, UserState userState, T dialog)
 {
     _dialog            = dialog;
     _conversationState = conversationState;
     _userState         = userState;
 }
예제 #55
0
 private void Awake()
 {
     Dialog = GetComponent <Dialog>();
 }
예제 #56
0
        private void Start()
        {
            m_parentDialog                 = GetComponentInParent <Dialog>();
            m_parentDialog.IsOkVisible     = true;
            m_parentDialog.IsCancelVisible = true;
            m_parentDialog.OkText          = "Select";
            m_parentDialog.CancelText      = "Cancel";
            m_parentDialog.Ok             += OnOk;

            m_toggleAssets.onValueChanged.AddListener(OnAssetsTabSelectionChanged);

            m_project       = IOC.Resolve <IProject>();
            m_windowManager = IOC.Resolve <IWindowManager>();

            IResourcePreviewUtility resourcePreview = IOC.Resolve <IResourcePreviewUtility>();

            AssetItem[] assetItems = m_project.Root.Flatten(true, false).Where(item =>
            {
                Type type = m_project.ToType((AssetItem)item);
                if (type == null)
                {
                    return(false);
                }
                return(type == ObjectType || type.IsSubclassOf(ObjectType));
            }).OfType <AssetItem>().ToArray();

            m_treeView.SelectionChanged += OnSelectionChanged;
            m_treeView.ItemDataBinding  += OnItemDataBinding;
            Editor.IsBusy = true;
            m_parentDialog.IsOkInteractable = false;
            m_project.GetAssetItems(assetItems, (error, assetItemsWithPreviews) =>
            {
                if (error.HasError)
                {
                    Editor.IsBusy = false;
                    m_windowManager.MessageBox("Can't GetAssets", error.ToString());
                    return;
                }

                AssetItem none = new AssetItem();
                none.Name      = "None";
                none.TypeGuid  = m_noneGuid;

                assetItemsWithPreviews = new[] { none }.Union(assetItemsWithPreviews).ToArray();

                m_previewsCreated = false;
                StartCoroutine(ProjectItemView.CoCreatePreviews(assetItemsWithPreviews, m_project, resourcePreview, () =>
                {
                    m_previewsCreated = true;
                    HandleSelectionChanged((AssetItem)m_treeView.SelectedItem);
                    m_treeView.ItemDoubleClick     += OnItemDoubleClick;
                    m_parentDialog.IsOkInteractable = m_previewsCreated && m_treeView.SelectedItem != null;
                    Editor.IsBusy = false;

                    if (m_filter != null)
                    {
                        if (!string.IsNullOrEmpty(m_filter.text))
                        {
                            ApplyFilter(m_filter.text);
                        }
                        m_filter.onValueChanged.AddListener(OnFilterValueChanged);
                    }
                }));

                m_assetsCache    = assetItemsWithPreviews;
                m_treeView.Items = m_assetsCache;

                List <AssetItem> sceneCache = new List <AssetItem>();
                sceneCache.Add(none);

                m_sceneObjects = new Dictionary <long, UnityObject>();
                ExposeToEditor[] sceneObjects = Editor.Object.Get(false, true).ToArray();
                for (int i = 0; i < sceneObjects.Length; ++i)
                {
                    ExposeToEditor exposeToEditor = sceneObjects[i];
                    UnityObject obj = null;
                    if (ObjectType == typeof(GameObject))
                    {
                        obj = exposeToEditor.gameObject;
                    }
                    else if (ObjectType.IsSubclassOf(typeof(Component)))
                    {
                        obj = exposeToEditor.GetComponent(ObjectType);
                    }

                    if (obj != null)
                    {
                        AssetItem assetItem = new AssetItem()
                        {
                            ItemID = m_project.ToID(exposeToEditor),
                            Name   = exposeToEditor.name,
                        };
                        assetItem.Preview = new Preview {
                            ItemID = assetItem.ItemID, PreviewData = new byte[0]
                        };
                        sceneCache.Add(assetItem);
                        m_sceneObjects.Add(assetItem.ItemID, obj);
                    }
                }
                m_sceneCache = sceneCache.ToArray();
            });
        }
예제 #57
0
    private Condition ProcessCondition(ActorBrain actorBrain, Dialog dialog, XmlNode childNode)
    {
        Condition condition = null;

        if (childNode.Name == "conditions" || childNode.Name == "conditionsAnd" || childNode.Name == "conditionsOr")
        {
            condition = ProcessConditionGroup(actorBrain, dialog, childNode);
        }
        else
        {
            switch (childNode.Name)
            {
            case "not":
                condition = ProcessConditionNot(actorBrain, dialog, childNode);
                break;

            case "refcondition":
                condition = ProcessConditionRefCondition(actorBrain, childNode);
                break;

            case "refexists":
                condition = ProcessConditionRefExists(actorBrain, childNode);
                break;

            case "refprev":
                condition = ProcessConditionRefPrev(actorBrain, childNode);
                break;

            case "exists":
            case "exist":
            case "existsvar":
            case "existvar":
                condition = ProcessConditionExistsVar(actorBrain, childNode);
                break;

            case "notexists":
            case "notexist":
            case "notexistsvar":
            case "notexistvar":
                condition = ProcessConditionNotExistsVar(actorBrain, childNode);
                break;

            case "saturated":
                condition = ProcessConditionSaturated(actorBrain, dialog, childNode, false);
                break;

            case "notsaturated":
                condition = ProcessConditionSaturated(actorBrain, dialog, childNode, true);
                break;

            case "ffunctrue":
                condition = ProcessConditionFuncBool(actorBrain, childNode, true);
                break;

            case "ffuncfalse":
                condition = ProcessConditionFuncBool(actorBrain, childNode, false);
                break;

            case "isinteger":
                condition = ProcessConditionIsInteger(actorBrain, childNode);
                break;

            case "exp":
                condition = ProcessConditionExpr(actorBrain, childNode);
                break;

            case "compare":
                condition = ProcessConditionCompare(actorBrain, childNode);
                break;
            }
        }

        if (condition != null)
        {
            condition.SetElem(childNode.Name);
        }
        return(condition);
    }
예제 #58
0
        private void Insert()
        {
            try
            {
                var makerPosition  = string.Empty;
                var destDepartment = string.Empty;
                if (hdfIsMakerPosition.Text == @"0")
                {
                    makerPosition = cbxMakerPosition.Text;
                }
                else
                {
                    makerPosition = cbxMakerPosition.SelectedItem.Text;
                }
                if (hdfIsDestDepartment.Text == @"0")
                {
                    destDepartment = cbxDestDepartment.Text;
                }
                else
                {
                    destDepartment = cbxDestDepartment.SelectedItem.Text;
                }
                var business = new hr_BusinessHistory
                {
                    DecisionNumber        = txtDecisionNumber.Text.Trim(),
                    DecisionDate          = dfDecisionDate.SelectedDate,
                    DecisionMaker         = txtDecisionMaker.Text.Trim(),
                    EffectiveDate         = dfEffectiveDate.SelectedDate,
                    ShortDecision         = txtShortDecision.Text,
                    CurrentPosition       = txtCurrentPosition.Text,
                    CurrentDepartment     = txtCurrentDepartment.Text,
                    NewPosition           = txtNewPosition.Text,
                    DestinationDepartment = destDepartment.TrimStart('-'),
                    DecisionPosition      = makerPosition,
                    BusinessType          = hdfBusinessType.Text,
                    CreatedDate           = DateTime.Now,
                    EditedDate            = DateTime.Now,
                    Description           = txtDescription.Text.Trim()
                };
                if (!string.IsNullOrEmpty(hdfChonCanBo.Text))
                {
                    business.RecordId = int.Parse("0" + hdfChonCanBo.Text);
                }
                // upload file
                var path = string.Empty;
                if (fufTepTinDinhKem.HasFile)
                {
                    string directory = Server.MapPath("../");
                    path = UploadFile(fufTepTinDinhKem, Constant.PathAttachFile);
                }

                business.FileScan = path != "" ? path : hdfTepTinDinhKem.Text;

                hr_BusinessHistoryServices.Create(business);
                gridMoveTo.Reload();
            }
            catch (Exception e)
            {
                Dialog.Alert("Có lỗi xảy ra trong quá trình thêm mới: {0}".FormatWith(e.Message));
            }
        }
예제 #59
0
        async void EndMeditation()
        {
            try
            {
                Dialog.ShowLoading();

                var OriginalUser = StoreManager.UserStore.User;

                var isAdded = await StoreManager.MeditationStore.AddMeditationTimeAsync((int)SeanceModel.Meditation.Length);

                var user = await StoreManager.UserStore.UpdateCurrentUser(StoreManager.UserStore.User);

                //var user = StoreManager.UserStore.User;
                var  meditiondone = user?.MeditationsDone?.Where((arg) => arg.id == SeanceModel?.Meditation.Id).First();
                bool isFirstTime  = false;
                if (meditiondone != null)
                {
                    if (SeanceModel.Level == 1)
                    {
                        if (meditiondone.level1Done == false)
                        {
                            isFirstTime = true;
                        }
                        meditiondone.level1Done = true;
                    }
                    else if (SeanceModel.Level == 2)
                    {
                        if (meditiondone.level2Done == false)
                        {
                            isFirstTime = true;
                        }
                        meditiondone.level2Done = true;
                    }
                    else if (SeanceModel.Level == 3)
                    {
                        if (meditiondone.level3Done == false)
                        {
                            isFirstTime = true;
                        }
                        meditiondone.level3Done = true;
                    }

                    user = await StoreManager.UserStore.UpdateCurrentUser(user);
                }


                Dialog.HideLoading();

                IsLoading = false;

                if (OriginalUser.CurrentLevel < user.CurrentLevel)
                {
                    await CoreMethods.PushPageModel <AvatarGrowPageModel>(null, modal : true);
                }
                if (isFirstTime)
                {
                    if (GetSeanceCount(SeanceModel.Meditation) == SeanceModel.Level)
                    {
                        await CoreMethods.PushPageModel <MeditationEndPageModel>(true, modal : true);
                    }
                    else
                    {
                        await CoreMethods.PushPageModel <MeditationEndPageModel>(SeanceModel.Meditation, modal : true);
                    }

                    Handle_PageWasPopped(null, null);
                    CoreMethods.RemoveFromNavigation <MeditationPlayPageModel>(true);
                }
                else
                {
                    await CoreMethods.PopPageModel(animate : false);
                }
            }
            catch (Exception ex)
            {
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)

        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource

            SetContentView(Resource.Layout.activity_main);

            //fatching information from login page

            myUserName = FindViewById <EditText>(Resource.Id.userNameID);

            myPass = FindViewById <EditText>(Resource.Id.pass);

            myLoginbtn = FindViewById <Button>(Resource.Id.button1);

            signupBtn = FindViewById <Button>(Resource.Id.signup);



            alert = new Android.App.AlertDialog.Builder(this);

            myDB = new DBHelperclass(this); //create constructor



            signupBtn.Click += delegate

            {
                SetContentView(Resource.Layout.signup);

                // Intent newScreen = new Intent(this, typeof(DBHelperClass));



                // StartActivity(newScreen);
                //fatching information from signup page

                s_username = FindViewById <EditText>(Resource.Id.s_userNameID);

                s_email = FindViewById <EditText>(Resource.Id.s_email);

                s_age = FindViewById <EditText>(Resource.Id.s_age);

                s_pass = FindViewById <EditText>(Resource.Id.s_pass);

                s_signupBtn = FindViewById <Button>(Resource.Id.s_button1);

                s_signupBtn.Click += delegate

                {
                    var value5 = s_username.Text;

                    var value6 = s_email.Text;

                    var value7 = s_age.Text;

                    var value8 = s_pass.Text;

                    if (value5.Trim().Equals("") || value5.Length < 0 || value6.Trim().Equals("") ||

                        value6.Length < 0 || value7.Trim().Equals("") ||

                        value7.Length < 0 || value8.Trim().Equals("") ||

                        value8.Length < 0)

                    {
                        //show alert dialog button

                        alert.SetTitle("Error");

                        alert.SetMessage("Please Enter Valid Data");

                        alert.SetPositiveButton("OK", alertOKButton);

                        alert.SetNegativeButton("Cancel", alertOKButton);

                        Dialog myDialog = alert.Create();

                        myDialog.Show();
                    }

                    else

                    {
                        //insert in database here

                        //order to insert (int id, string value_username, string value_email, string value_age, string value_pass)



                        myDB.InsertValue(1, value5, value6, value7, value8);

                        //System.Console.WriteLine(value,value2, value3, value4);

                        myDB.SelectMydata();



                        //SetContentView(Resource.Layout.activity_main);
                        Intent newScreen = new Intent(this, typeof(MainActivity));



                        StartActivity(newScreen);
                    }
                };
            };



            myLoginbtn.Click += delegate

            {
                var value = myUserName.Text;

                var value2 = myPass.Text;



                System.Console.WriteLine("Username: ---- > " + value);

                System.Console.WriteLine("Password: ---- > " + value2);

                if (value.Trim().Equals("") || value.Length < 0 || value2.Trim().Equals("") || value2.Length < 0)

                {
                    alert.SetTitle("Error");

                    alert.SetMessage("Please Enter Valid Data");

                    alert.SetPositiveButton("OK", alertOKButton);

                    alert.SetNegativeButton("Cancel", alertOKButton);

                    Dialog myDialog = alert.Create();

                    myDialog.Show();
                }

                else

                {  // some value
                   //myDB.insertValue(1, value);



                    //myDB.SelectMydata();

                    Intent newScreen1 = new Intent(this, typeof(WelcomeNew));
                    newScreen1.PutExtra("usernameLogin", value);
                    newScreen1.PutExtra("passwordLogin", value2);


                    StartActivity(newScreen1);
                }
            };
        }