public void OpenFile(object sender, ExecutedRoutedEventArgs e)
 {
     MEFile f = FileUtils.OpenFile();
     if (f != MEFile.ERROR_ME_FILE)
     {
         SetTabContent(0, f.Name + f.Extension, f.Content);
         currentFile = f;
     }
 }
Example #2
0
 public static void SaveFile(ref MEFile file)
 {
     Console.WriteLine(file.HasBeenSaved());
     if (file.HasBeenSaved())
     {
         File.WriteAllText(file.CompletePath, file.Content);
     }
     else
     {
         FileUtils.SaveFileAs(ref file);
     }
 }
Example #3
0
 public static void SaveFile(ref MEFile file)
 {
     Console.WriteLine(file.HasBeenSaved());
     if (file.HasBeenSaved())
     {
         File.WriteAllText(file.CompletePath, file.Content);
     }
     else
     {
         FileUtils.SaveFileAs(ref file);
     }
 }
Example #4
0
        public static void SaveFileAs(ref MEFile file)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            bool?result = sfd.ShowDialog();

            if (result == true)
            {
                file.CompletePath = sfd.FileName;
                file.Name         = Path.GetFileNameWithoutExtension(sfd.SafeFileName);
                file.Extension    = Path.GetExtension(sfd.SafeFileName);
                FileUtils.SaveFile(ref file);
            }
        }
Example #5
0
        public static void SaveFileAs(ref MEFile file)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            bool? result = sfd.ShowDialog();

            if (result == true)
            {
                file.CompletePath = sfd.FileName;
                file.Name = Path.GetFileNameWithoutExtension(sfd.SafeFileName);
                file.Extension = Path.GetExtension(sfd.SafeFileName);
                FileUtils.SaveFile(ref file);
            }
        }
Example #6
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            MEFile b = obj as MEFile;

            if (b == null)
            {
                return(false);
            }
            else
            {
                return(Name == b.Name && Extension == b.Extension &&
                       Content == b.Content && CompletePath == b.CompletePath);
            }
        }
 public MainWindow()
 {
     InitializeComponent();
     currentFile = new MEFile("Example", ".txt", "Hello, World", null);
 }