コード例 #1
0
 static void Main(string[] args)
 {
     try
     {
         NSApplication.Init();
         NSApplication.Main(args);
     }
     catch (Exception ex)
     {
         AlertRaiser.LandApplication(ex);
     }
 }
コード例 #2
0
        public void CloseDialog()
        {
            if (_availablityChanged)
            {
                // Save the availabilities.
                App.WriteFilmFanAvailabilities();

                // Trigger a local notification.
                string title = "Availabilities saved";
                string text  = $"Film fan availabilites have been saved in {AppDelegate.DocumentsFolder}.";
                AlertRaiser.RaiseNotification(title, text);
            }

            // Close the dialog.
            Presentor.DismissViewController(this);
        }
コード例 #3
0
        private void SaveFestivalData()
        {
            // Write film fan availability.
            WriteFilmFanAvailabilities(DocumentsFolder);

            // Write film ratings.
            WriteFilmFanFilmRatings(DocumentsFolder);

            // Write screening info.
            string screeningInfoFileName = Path.GetFileName(ScreeningInfoFile);
            string screeningInfosPath    = Path.Combine(DocumentsFolder, screeningInfoFileName);

            new ScreeningInfo().WriteListToFile(screeningInfosPath, ScreeningsPlan.ScreeningInfos);

            // Display where the files have been stored.
            string title = "Festival Data Saved";
            string text  = $"Files of {Festival}{FestivalYear} are saved in {DocumentsFolder}";

            AlertRaiser.RaiseNotification(title, text);
        }
コード例 #4
0
        private StreamReader GetStreamReader(string url)
        {
            FileStream fileStream;

            try
            {
                fileStream = new FileStream(url, FileMode.Open, FileAccess.Read);
            }
            catch (FileNotFoundException)
            {
                if (ListFileIsMandatory())
                {
                    string informativeText = $"We really need file {url}, but it's missing.";
                    AlertRaiser.QuitWithAlert("Read Error", informativeText);
                }
                return(null);
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("Read error, couldn't access file {0}", url), ex);
            }
            return(new StreamReader(fileStream));
        }