示例#1
0
    //Dynamically generate file name to be saved and open system storage application.
    //保存するファイル名を動的に生成し、システムストレージアプリを開く。
    public void SaveText()
    {
        if (storageSaveTextControl != null && displayText != null && !string.IsNullOrEmpty(displayText.text))
        {
            if (autoSaveFileName)
            {
                string file = filePrefix;
                if (appendDateTimeString)
                {
                    file += "_" + DateTime.Now.ToString("yyMMdd_HHmmss");
                }
                if (string.IsNullOrEmpty(file))
                {
                    file = "NewDocumet";
                }
                if (!file.EndsWith(".txt"))
                {
                    file += ".txt";
                }

                if (storageSaveTextControl.syncExtension)
                {
                    var ext = AndroidMimeType.GetExtension(storageSaveTextControl.MimeType);
                    if (ext != null)
                    {
                        file = Path.ChangeExtension(file, ext[0]);
                    }
                }
                storageSaveTextControl.CurrentValue = file;
            }

            storageSaveTextControl.Show(displayText.text);
        }
    }