Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            NewName = newNameTextBox.Text;
            NewName = NewName.Trim().Replace(' ', '_').Trim();

            if (newNameTextBox.Text.Length == 0)
            {
                MessageBox.Show("Name can't be blank.");
                return;
            }

            Close();
            result = true;
        }
Example #2
0
    }                   // ボタンが押されたときに実行されるデリゲート

    void OnGUI()
    {
        NewName = EditorGUILayout.TextField(CaptionText, NewName);
        if (GUILayout.Button(ButtonText))
        {
            if (OnClickButtonDelegate != null)
            {
                // ボタンが押されたら、あらかじめ設定されたデリゲートに入力された名前を渡す
                OnClickButtonDelegate.Invoke(NewName.Trim());
            }

            Close();
            GUIUtility.ExitGUI();
        }
    }
Example #3
0
    }                                                           // 버튼을 눌렀을 때이 눌러졌을 때 실행되는 델리게이트

    void OnGUI()
    {
        NewName = EditorGUILayout.TextField(CaptionText, NewName);
        if (GUILayout.Button(ButtonText))
        {
            if (OnClickButtonDelegate != null)
            {
                // 버튼을 누르면이 눌러지면 미리 설정된 델리게이트에 입력된되어 있는 이름을 넘겨준다
                OnClickButtonDelegate.Invoke(NewName.Trim());
            }

            Close();
            GUIUtility.ExitGUI();
        }
    }
Example #4
0
        /// <summary>
        /// Add new item to <see cref="ScheduleDataViewModel.ItemCustomList"/>.
        /// </summary>
        private async Task AddItemCommandMethodAsync()
        {
            await RunCommandAsync(() => mModifyFlag, async() =>
            {
                IoC.Logger.Log("Creating new schedule custom item.", LogLevel.Debug);

                if (!IoC.DataContent.ScheduleData.CanAddCustomItem)
                {
                    return;
                }

                if (string.IsNullOrEmpty(NewName))
                {
                    return;
                }

                // Trim.
                string name     = NewName.Trim();
                string colorHex = "000000";

                // Add item.
                if (FormVM.AddItem(name, colorHex, false) == null)
                {
                    // Some error occured during adding item.
                    _ = IoC.UI.ShowNotification(new NotificationBoxDialogViewModel()
                    {
                        Title   = "ERROR OCCURRED!",
                        Message = $"The name of the item is already defined or some of the entered values are invalid. Please, check them again.",
                        Result  = NotificationBoxResult.Ok,
                    });

                    return;
                }

                // Log it.
                IoC.Logger.Log($"Created new schedule custom item '{name}'.", LogLevel.Info);

                // Sort list.
                FormVM.SortItemCustomList();

                await Task.Delay(1);
            });
        }