Exemplo n.º 1
0
            public override void Run()
            {
                if (Success)
                {
                    // Update the ongoing notification
                    App.Kp2a.UpdateOngoingNotification();

                    if (PreferenceManager.GetDefaultSharedPreferences(_activity).GetBoolean(_activity.GetString(Resource.String.RememberRecentFiles_key), _activity.Resources.GetBoolean(Resource.Boolean.RememberRecentFiles_default)))
                    {
                        // Add to recent files
                        FileDbHelper dbHelper = App.Kp2a.FileDbHelper;


                        //TODO: getFilename always returns "" -> bug?
                        dbHelper.CreateFile(_ioc, Filename);
                    }

                    GroupActivity.Launch(_activity, _activity._appTask);
                    _activity.Finish();
                }
                else
                {
                    DisplayMessage(_activity);
                    try
                    {
                        App.Kp2a.GetFileStorage(_ioc).Delete(_ioc);
                    }
                    catch (Exception e)
                    {
                        //not nice, but not a catastrophic failure if we can't delete the file:
                        Kp2aLog.Log("couldn't delete file after failure! " + e);
                    }
                }
            }
Exemplo n.º 2
0
            public override void Run()
            {
                if (Success)
                {
                    // Update the ongoing notification
                    App.Kp2a.UpdateOngoingNotification();

                    if (PreferenceManager.GetDefaultSharedPreferences(_activity).GetBoolean(_activity.GetString(Resource.String.RememberRecentFiles_key), _activity.Resources.GetBoolean(Resource.Boolean.RememberRecentFiles_default)))
                    {
                        // Add to recent files
                        FileDbHelper dbHelper = App.Kp2a.FileDbHelper;

                        dbHelper.CreateFile(_ioc, Filename, true);
                    }

                    Intent data = new Intent();
                    data.PutExtra("ioc", IOConnectionInfo.SerializeToString(_ioc));

                    _activity.SetResult(Result.Ok, data);


                    _activity.Finish();
                }
                else
                {
                    DisplayMessage(_activity);
                    try
                    {
                        App.Kp2a.GetFileStorage(_ioc).Delete(_ioc);
                    }
                    catch (Exception e)
                    {
                        //not nice, but not a catastrophic failure if we can't delete the file:
                        Kp2aLog.Log("couldn't delete file after failure! " + e);
                    }
                }
            }