Showing posts with label cross platform. Show all posts
Showing posts with label cross platform. Show all posts

Thursday, July 31, 2014

Read/Write file Xamarin.Mac - File Management

Read/Write file from MYDocument Folder

Write File
            var documents = 
                Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments);
            var directoryname = Path.Combine (documents, "NewDirectory");
            Directory.CreateDirectory (directoryname);
            var filename = Path.Combine (directoryname, "Text.txt");
            Console.WriteLine("path"+filename);
            File.WriteAllText(filename, TextViewSave.Value);
        


Read File


       
            var documents =
                Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments);
            var directoryname = Path.Combine (documents, "NewDirectory");
            Directory.CreateDirectory (directoryname);
            var filename = Path.Combine (directoryname, "Text.txt");
            File.ReadAllText(filename);
       


Read/Write file from Library

Write File
             var documents = 
            Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "Library");
  

            var directoryname = Path.Combine (documents, "NewDirectory");
            Directory.CreateDirectory (directoryname);
            var filename = Path.Combine (directoryname, "Text.txt");
            Console.WriteLine("path"+filename);
            File.WriteAllText(filename, TextViewSave.Value);
        


Read File


       
            
 var documents = 
            Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "Library");
 
            var directoryname = Path.Combine (documents, "NewDirectory");
            Directory.CreateDirectory (directoryname);
            var filename = Path.Combine (directoryname, "Text.txt");
            File.ReadAllText(filename);
       

Tuesday, July 29, 2014

Xamarin Basics iOS -Button Click


Steps
1. You have to add button on UI (xib from xcode)
2.Create outlet for button (In xcode itself)
3.Go to corresponding .cs class (In Xamarin Studio)
4.Write the following code

btnName.Activated+=(Object sender,EventArgs e )=>{
               // You can write the code here,that you want to perform in button click
            };