예제 #1
0
 static void loadVimeo()
 {
     var meta = AppSettings.GetValueOrDefault("vimeo_meta", string.Empty);
     if (meta == string.Empty)
     {
         VimeoInfo = null;
         return;
     }
     XmlSerializer xs = new XmlSerializer(typeof(VimeoUploadTask));
     using (TextReader tr = new StringReader(meta)) VimeoInfo = (VimeoUploadTask)xs.Deserialize(tr);
 }
예제 #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.LoggedInPanel);
            Settings.LoadInfos();

            FindViewById<Button>(Resource.Id.btnUploadNew).Click += delegate
            {
                PickFileActivity.OnFinishAction = (path) =>
                {
                    try
                    {
                        //New Upload: Get ticket, do meta, open upload activity
                        var info = new VimeoUploadTask();
                        info.Path = path;
                        info.Ticket = Settings.VimeoHook.GetTicket();
                        Settings.VimeoInfo = info;
                        Settings.SaveInfos();
                        StartActivity(new Intent(this, typeof(VimeoUploadActivity)));
                    }
                    catch (Exception e)
                    {
                        //Getting ticket failed, possibly because VimeoHook is null or
                        //its access is denied. Switch to main screen.
                        Console.WriteLine(e.Message);
                        StartActivity(new Intent(this, typeof(MainActivity)));
                    }
                };

                PickFileActivity.OnCancelAction = () =>
                    StartActivity(new Intent(this, typeof(VimeoPanelActivity)));

                StartActivity(new Intent(this, typeof(PickFileActivity)));
            };

            FindViewById<Button>(Resource.Id.btnUploadResume).Visibility =
                (Settings.VimeoInfo != null && !Settings.VimeoInfo.Done) ? ViewStates.Visible : ViewStates.Gone;

            FindViewById<Button>(Resource.Id.btnUploadResume).Click += delegate
            {
                //Resume Upload: Open upload activity
                VimeoUploadTask info = Settings.VimeoInfo;
                if (File.Exists(info.Path))
                {
                    StartActivity(new Intent(this, typeof(VimeoUploadActivity)));
                }
            };
        }