/// <summary>
 /// Request user confirmation for a file operation (delete/overwrite).
 /// </summary>
 /// <param name="opType"></param>
 /// <param name="fileName"></param>
 /// <param name="fileOp"></param>
 internal void ConfirmFileOp(string opType, string fileName, FileOpCallback fileOp)
 {
     existingSave  = fileName;
     dialogType    = opType;
     isVisible     = true;
     fileOperation = fileOp;
 }
 /// <summary>
 /// Resets and hides the dialog;
 /// </summary>
 internal void Hide()
 {
     fileOperation = null;
     dialogType    = string.Empty;
     existingSave  = string.Empty;
     isVisible     = false;
 }
        /// <summary>
        /// Handles initialization of the dialog
        /// </summary>
        void Start()
        {
            kissDialogHeight = 100;
            kissDialogWidth  = 200;

            windowRect = new Rect((Screen.width - kissDialogWidth) / 2, (Screen.height - kissDialogHeight) / 2, kissDialogWidth, kissDialogHeight);

            _dialogStyle = new GUIStyle(HighLogic.Skin.window);
            _dialogStyle.normal.background = HighLogic.Skin.textField.normal.background;

            _buttonStyle = new GUIStyle(HighLogic.Skin.button);

            fileOperation = null;
            dialogType    = string.Empty;
            existingSave  = string.Empty;
            isVisible     = false;
        }
Exemplo n.º 4
0
 /// <summary>
 /// Gets permission to perform some operation on a file, like deleting or overwriting.
 /// </summary>
 /// <param name="confirmRequired">If confirmation is disabled, the operation is performed directly.</param>
 /// <param name="opType">Type of file operation. Currently available: "Delete" and "Save".</param>
 /// <param name="filename">The name of the file to be manipulated.</param>
 /// <param name="fileOp">Callback for the dialog to execute in case user confirms action.</param>
 private void ConfirmFileOp(bool confirmRequired, string opType, string filename, FileOpCallback fileOp)
 {
     if (confirmRequired)
     {
         _kissDialog.parentWindow = windowPosSize;                 //update position of main window
         _kissDialog.ConfirmFileOp(opType, selectedFileName, fileOp);
     }
     else
     {
         fileOp(filename);
     }
 }