예제 #1
0
 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;
     }
 }
예제 #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);
     }
 }
예제 #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);
     }
 }
예제 #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);
            }
        }
예제 #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);
            }
        }
예제 #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);
            }
        }
예제 #7
0
 public MainWindow()
 {
     InitializeComponent();
     currentFile = new MEFile("Example", ".txt", "Hello, World", null);
 }