Ejemplo n.º 1
0
 public RoaApiTest()
 {
     context                  = new OffsiteContext(Constants.ConsumerKey, Constants.ConsumerSecret);
     openSocialv9             = new MySpaceID.SDK.Api.RoaApi(context);
     context.OAuthTokenKey    = Constants.OAuthTokenKey;
     context.OAuthTokenSecret = Constants.OAuthTokenSecret;
 }
Ejemplo n.º 2
0
        public RealTimeStreamTest()
        {
            context = new OffsiteContext(Constants.ConsumerKey, Constants.ConsumerSecret);

            realTimeStream           = new MySpaceID.SDK.Api.RealTimeStream(context);
            context.OAuthTokenKey    = Constants.OAuthTokenKey;
            context.OAuthTokenSecret = Constants.OAuthTokenSecret;
        }
Ejemplo n.º 3
0
        public OpenSearchTest()
        {
            context = new OffsiteContext(Constants.ConsumerKey, Constants.ConsumerSecret);


            openSearch               = new MySpaceID.SDK.Api.OpenSearch(context);
            context.OAuthTokenKey    = Constants.OAuthTokenKey;
            context.OAuthTokenSecret = Constants.OAuthTokenSecret;
        }
        /// <summary>
        /// MySpace
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnMyspace_Click(object sender, EventArgs e)
        {
            OffsiteContext   context = new OffsiteContext("", "");
            RestV1           service = new RestV1(context);
            FormMySpaceLogin form    = new FormMySpaceLogin(db, service);

            if (form.ShowDialog() == DialogResult.OK)
            {
                FormMySpacePublish form2 = new FormMySpacePublish(db, service);
                form2.ShowDialog();
            }
        }
Ejemplo n.º 5
0
 private static void RemoveInventory(Guid truckId)
 {
     using (var ctx = new OffsiteContext())
     {
         // if truck is found then remove it; otherwise, nothing to see here
         var truckInventory = ctx.Inventory.Where(x => x.Id == truckId).FirstOrDefault();
         if (truckInventory != null)
         {
             ctx.Inventory.Remove(truckInventory);
             ctx.SaveChanges();
         }
     }
 }
Ejemplo n.º 6
0
        private void GetRequestToken()
        {
            var context = new OffsiteContext(Constants.ConsumerKey, Constants.ConsumerSecret);
            //Get a Request Token
            var callbackUrl  = "http://localhost:9090/default.aspx?oauthreturn=true";
            var requestToken = context.GetRequestToken(callbackUrl);

            Session["requesttokenkey"]    = requestToken.TokenKey;
            Session["requesttokensecret"] = requestToken.TokenSecret;

            //Get the MySpace authentication page for the user to go to in order to authorize the Request Token.
            var authenticationUrl = context.GetAuthorizationUrl(requestToken, callbackUrl);

            Response.Redirect(authenticationUrl);
        }
Ejemplo n.º 7
0
 private static void MergeInventory(InventoryItem mergeTruck)
 {
     using (var context = new OffsiteContext())
     {
         // if truck already exists, then perform an update
         if (context.Inventory.Any(x => x.Id == mergeTruck.Id))
         {
             context.Inventory.Attach(mergeTruck);
         }
         // otherwise, insert the new truck
         else
         {
             context.Inventory.Add(mergeTruck);
         }
         context.SaveChanges();
     }
 }