Ejemplo n.º 1
0
        private void BtnSaveOnTouchUpInside(object sender, EventArgs e)
        {
            var alert = UIAlertController.Create("Save", "Select save paint", UIAlertControllerStyle.Alert);

            if (alert.PopoverPresentationController != null)
            {
                alert.PopoverPresentationController.BarButtonItem = sender as UIBarButtonItem;
            }

            alert.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null));

            alert.AddAction(UIAlertAction.Create("Save to File", UIAlertActionStyle.Default, action => {
                _drawKeeper = new DrawKeeperFactory().Create(EDrawKeeperType.File);
                _drawKeeper.Save(_drawModel);
            }));
            alert.AddAction(UIAlertAction.Create("Save to Realm", UIAlertActionStyle.Default, action => {
                _drawKeeper = new DrawKeeperFactory().Create(EDrawKeeperType.Realm);
                _drawKeeper.Save(_drawModel);
            }));
            alert.AddAction(UIAlertAction.Create("Save to SQLite", UIAlertActionStyle.Default, action => {
                _drawKeeper = new DrawKeeperFactory().Create(EDrawKeeperType.SQLite);
                _drawKeeper.Save(_drawModel);
            }));
            alert.AddAction(UIAlertAction.Create("Save to NSUserDefoult", UIAlertActionStyle.Default, action => {
                _drawKeeper = new DrawKeeperFactory().Create(EDrawKeeperType.Internal);
                _drawKeeper.Save(_drawModel);
            }));
            PresentViewController(alert, animated: true, completionHandler: null);
        }
Ejemplo n.º 2
0
        private UIAlertAction CreateLoadImageAction(string message, EDrawKeeperType loadType)
        {
            var loadAction = UIAlertAction.Create(message, UIAlertActionStyle.Default, action => {
                _drawKeeper = new DrawKeeperFactory().Create(loadType);
                LoadFile();
            });

            return(loadAction);
        }
Ejemplo n.º 3
0
        private UIAlertAction CreateSaveToFileAction(string message, EDrawKeeperType loadType)
        {
            var loadAction = UIAlertAction.Create(message, UIAlertActionStyle.Default, action =>
            {
                _drawKeeper = new DrawKeeperFactory().Create(loadType);
                _drawKeeper.Save(_drawModel);
            });

            return(loadAction);
        }
Ejemplo n.º 4
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.SaveToFile:
                _drawKeeper = new DrawKeeperFactory().Create(EDrawKeeperType.File);
                _drawKeeper.Save(_drawModel);
                return(true);

            case Resource.Id.SaveToSharedPreferance:
                _drawKeeper = new DrawKeeperFactory().Create(EDrawKeeperType.Internal);
                _drawKeeper.Save(_drawModel);
                return(true);

            case Resource.Id.SaveToRealm:
                _drawKeeper = new DrawKeeperFactory().Create(EDrawKeeperType.Realm);
                _drawKeeper.Save(_drawModel);
                return(true);

            case Resource.Id.SaveToSQLite:
                _drawKeeper = new DrawKeeperFactory().Create(EDrawKeeperType.SQLite);
                _drawKeeper.Save(_drawModel);
                return(true);

            case Resource.Id.ClickLoadToFile:
                _drawKeeper = new DrawKeeperFactory().Create(EDrawKeeperType.File);
                LoadFile();
                return(true);

            case Resource.Id.ClickLoadToSharedPreferance:
                _drawKeeper = new DrawKeeperFactory().Create(EDrawKeeperType.Internal);
                LoadFile();
                return(true);

            case Resource.Id.ClickLoadToRealm:
                _drawKeeper = new DrawKeeperFactory().Create(EDrawKeeperType.Realm);
                LoadFile();
                return(true);

            case Resource.Id.ClickLoadToSQLite:
                _drawKeeper = new DrawKeeperFactory().Create(EDrawKeeperType.SQLite);
                LoadFile();
                return(true);

            default: return(false);
            }
        }
Ejemplo n.º 5
0
 private void SaveFile(EDrawKeeperType saveType)
 {
     _drawKeeper = new DrawKeeperFactory().Create(saveType);
     _drawKeeper.Save(_drawModel);
 }
Ejemplo n.º 6
0
 private void LoadDataFromFile(EDrawKeeperType loadType)
 {
     _drawKeeper = new DrawKeeperFactory().Create(loadType);
     LoadFile();
 }