private void LoadFile()
        {
            var relPathToFile = FileSelector.GetValue().ToString();
            var absPathToFile = URIHelper.ConvertToAbsPath(relPathToFile);

            if (this.ValidatePath(relPathToFile))
            {
                var fileContent = File.ReadAllText(absPathToFile);
                Editor.Text = fileContent;

                DisplaySuccessMessage($@"Successfully loaded file ( {absPathToFile} )");
            }
        }
Ejemplo n.º 2
0
        private void LoadFile()
        {
            var relPathToFile = FileSelector.GetValue().ToString();
            var absPathToFile = URIHelper.ConvertToAbsPath(relPathToFile);

            if (File.Exists(absPathToFile))
            {
                var fileContent = File.ReadAllText(absPathToFile);
                Editor.Text = fileContent;

                DisplaySuccessMessage($@"Successfully loaded file ( {absPathToFile} ) ");
            }
            else
            {
                DisplayErrorMessage($"File does not exist ( {absPathToFile} ) ");
            }
        }
Ejemplo n.º 3
0
        protected void Save_Click(object sender, EventArgs e)
        {
            var relPathToFile = FileSelector.GetValue().ToString();
            var absPathToFile = URIHelper.ConvertToAbsPath(relPathToFile);

            try
            {
                File.WriteAllText(absPathToFile, Editor.Text);

                DisplaySuccessMessage($@"Successfully saved ( {absPathToFile} )");
            }
            catch (Exception ex)
            {
                ErrorHelper.LogException(ex);

                DisplayErrorMessage("Error saving", ErrorHelper.CreateError(ex));
            }
        }