示例#1
0
    private static FieldDialog <T> DisplayWindow()
    {
        FieldDialog <T> window     = ScriptableObject.CreateInstance <FieldDialog <T> >();
        Vector2         windowSize = new Vector2(windowwidth, window_height);

        window.minSize = windowSize;
        window.maxSize = windowSize;
        PositionWindow(window);
        window.ShowPopup();
        return(window);
    }
示例#2
0
    public void ReFocus()
    {
        if (!Active)
        {
            return;
        }
        FieldDialog <T> window = GetWindow <FieldDialog <T> >();

        PositionWindow(window);
        window.ShowPopup();
    }
示例#3
0
    private void DrawButton(Texture2D background, OnClickActions actions, GUILayoutOption[] options)
    {
        GUIStyle style = new GUIStyle(GUI.skin.button);

        style.normal.background = background;
        if (GUILayout.Button(GUIContent.none, style, options))
        {
            actions?.Invoke();
            FieldDialog <T> window = GetWindow <FieldDialog <T> >();
            window.Close();
        }
    }
示例#4
0
    public static FieldDialog <T> Open(string title, string supportText, Texture2D ok = null, Texture2D cancel = null)
    {
        Title        = title;
        SupportText  = supportText;
        okButton     = ok;
        cancelButton = cancel;

        //FieldDialog<DS_Character> window = ScriptableObject.CreateInstance<FieldDialog<DS_Character>>();
        FieldDialog <T> window = EditorWindow.GetWindow <FieldDialog <T> >();

        if (window == null)
        {
            Debug.Log("Cant create window");
            return(null);
        }
        Vector2 windowSize = new Vector2(windowwidth, window_height);

        PositionWindow(window);
        window.minSize = windowSize;
        window.maxSize = windowSize;
        window.ShowPopup();
        return(window);
    }
        static void buttonInsertFieldDialog_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (FieldDialog == null)
            {
                FieldDialog = new InsertFieldDialog();
                Application curApp     = Application.Current;
                Window      mainWindow = curApp.MainWindow;
                FieldDialog.Owner = mainWindow;
                FieldDialog.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
            }
            MessageBoxResult result = FieldDialog.ShowDialog(MessageBoxButton.OKCancel);

            if (result == MessageBoxResult.OK)
            {
                IFieldParametersDialog parametersDialog = CurrentParametersDialog;
                if (parametersDialog != null)
                {
                    string fieldCode = InsertFieldRichEditHelper.CurrentVariableType;

                    string parametersString = parametersDialog.GenerateFieldParametersString();
                    if (parametersString == InsertFieldRichEditHelper.EmptyFieldCode)
                    {
                        return;
                    }

                    SubDocument currentDocument = CurrentRichEditControl.Document.CaretPosition.BeginUpdateDocument();

                    if (parametersDialog is ucIFFIELD)
                    {
                        ucIFFIELD IFFieldInsertDialog = parametersDialog as ucIFFIELD;
                        if (IFFieldInsertDialog.IsFieldParametersValid())
                        {
                            Field newField = currentDocument.Fields.Create(CurrentRichEditControl.Document.CaretPosition, fieldCode + " " + parametersString);

                            List <string> nestedFiueldsList = IFFieldInsertDialog.GetNestedFieldsList();

                            foreach (string nestedFieldCode in nestedFiueldsList)
                            {
                                DocumentRange[] ranges = currentDocument.FindAll(nestedFieldCode, SearchOptions.WholeWord);
                                foreach (DocumentRange range in ranges)
                                {
                                    currentDocument.Fields.Create(range);
                                }
                            }
                        }
                    }
                    else
                    {
                        if (parametersString != "")
                        {
                            currentDocument.Fields.Create(CurrentRichEditControl.Document.CaretPosition, fieldCode + " " + parametersString);
                        }
                        else
                        {
                            currentDocument.Fields.Create(CurrentRichEditControl.Document.CaretPosition, fieldCode);
                        }
                    }

                    currentDocument.Fields.Update();
                    CurrentRichEditControl.Document.CaretPosition.EndUpdateDocument(currentDocument);
                }
            }
        }