Esempio n. 1
0
        void DownloadAttributeDefinitions(List <Dictionary <string, string> > attribList, AttribDefinitionDownloaded onCompletion)
        {
            // now build an array of the attributeIds we should request
            int[] attributeIds = new int[attribList.Count];
            for (int i = 0; i < attribList.Count; i++)
            {
                attributeIds[i] = int.Parse(attribList[i]["attributeId"]);
            }

            // and lastly, request them
            if (attribList.Count > 0)
            {
                ApplicationApi.GetAttribute(attributeIds,
                                            delegate(HttpStatusCode attribStatusCode, string attribStatusDescription, List <Rock.Client.Attribute> attribModel)
                {
                    if (attribModel != null && Rock.Mobile.Network.Util.StatusInSuccessRange(attribStatusCode))
                    {
                        Rock.Mobile.Util.Debug.WriteLine("Got attrib");
                        onCompletion(attribModel);
                    }
                    else
                    {
                        onCompletion(null);
                    }
                });
            }
            else
            {
                onCompletion(new List <Rock.Client.Attribute>( ));
            }
        }
 public static void DownloadConfigurationTemplates(TemplatesDownloaded onDownloaded)
 {
     // first resolve the Guid to the correct type ID
     ApplicationApi.GetDefinedTypeIdForGuid(FamilyManagerApi.ConfigurationTemplateDefinedTypeGuid,
                                            delegate(System.Net.HttpStatusCode statusCode, string statusDescription, List <Rock.Client.DefinedType> definedTypeModel)
     {
         // if the request for the defined type worked
         if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true && definedTypeModel != null && definedTypeModel.Count > 0)
         {
             // now get the actual values
             FamilyManagerApi.GetConfigurationTemplates(definedTypeModel[0].Id, 0,
                                                        delegate(System.Net.HttpStatusCode configStatusCode, string configStatusDescription, List <Rock.Client.DefinedValue> definedValueModels)
             {
                 if (Rock.Mobile.Network.Util.StatusInSuccessRange(configStatusCode) == true && definedValueModels != null)
                 {
                     onDownloaded(definedValueModels);
                 }
                 else
                 {
                     // fail
                     onDownloaded(null);
                 }
             });
         }
         else
         {
             // fail
             onDownloaded(null);
         }
     });
 }
        void RestoreFromBackground( )
        {
            // check to see if we should re-run the Start() process
            TimeSpan delta = DateTime.Now - LockTimer;

            if (delta.TotalMinutes > Settings.General_AutoLockTime)
            {
                // if they're not on the firstRun controller, we need to first verify Rock
                // is still where it should be, and second, force them to log back in.
                if (FirstRunViewController.Visible == false)
                {
                    // see if Rock is present
                    ApplicationApi.IsRockAtURL(Config.Instance.RockURL,
                                               delegate(System.Net.HttpStatusCode statusCode, string statusDescription)
                    {
                        // if it IS, show the login controller (if we're not already)
                        if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode))
                        {
                            DisplayLoginScreen(false);
                        }
                        // Rock wasn't found, so display the first run VC again
                        else
                        {
                            DisplayFirstRun( );
                        }
                    });
                }
            }
        }
Esempio n. 4
0
 /// <summary>
 /// On-click handler
 /// </summary>
 public virtual void OnClick()
 {
     if (_applicationInfo != null)
     {
         ApplicationApi.LaunchSession(_applicationInfo.GetUri());
     }
 }
Esempio n. 5
0
 static void UpdateFamilyAddress(Rock.Client.Group family, Rock.Client.GroupLocation address, List <KeyValuePair <string, string> > attributes, HttpRequest.RequestResult resultHandler)
 {
     // is there an address?
     if (address != null)
     {
         ApplicationApi.UpdateFamilyAddress(family, address,
                                            delegate(System.Net.HttpStatusCode statusCode, string statusDescription)
         {
             // if it updated ok, go to family attributes
             if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode))
             {
                 UpdateFamilyAttributes(family, address, attributes, resultHandler);
             }
             // address failed
             else
             {
                 resultHandler(statusCode, statusDescription);
             }
         });
     }
     // no, go to family attrubutes
     else
     {
         UpdateFamilyAttributes(family, address, attributes, resultHandler);
     }
 }
Esempio n. 6
0
        void PerformSearch( )
        {
            // only let them submit if they have something beyond "http://" (or some other short crap)
            if (RockUrlField.Text.IsValidURL( ))
            {
                // hide the keyboard
                RockUrlField.ResignFirstResponder( );

                // disable until we're done
                Submit.Enabled = false;

                BlockerView.BringToFront( );
                BlockerView.Show(delegate
                {
                    // see if Rock exists at this endpoint
                    ApplicationApi.IsRockAtURL(RockUrlField.Text, delegate(HttpStatusCode statusCode, string statusDesc)
                    {
                        if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode))
                        {
                            // attempt to contact Rock and get all the required information.
                            Config.Instance.TryBindToRockServer(RockUrlField.Text, RockAuthKeyField.Text,
                                                                delegate(bool result)
                            {
                                // it worked, so Rock is valid.
                                if (result == true)
                                {
                                    // take these as our values.
                                    Config.Instance.CommitRockSync( );

                                    Config.Instance.SetConfigurationDefinedValue(Config.Instance.ConfigurationTemplates[0],
                                                                                 delegate(bool configResult)
                                    {
                                        if (configResult == true)
                                        {
                                            HandlePerformSearchResult(true, Strings.General_RockBindSuccess);
                                        }
                                        else
                                        {
                                            // ROCK DATA ERROR
                                            HandlePerformSearchResult(false, Strings.General_RockBindError_Data);
                                        }
                                    });
                                }
                                else
                                {
                                    // ROCK DATA ERROR
                                    HandlePerformSearchResult(false, Strings.General_RockBindError_Data);
                                }
                            });
                        }
                        else
                        {
                            // Rock NOT FOUND
                            HandlePerformSearchResult(false, Strings.General_RockBindError_NotFound);
                        }
                    });
                });
            }
        }
Esempio n. 7
0
        static void TryUpdatePerson(bool isNewPerson,
                                    Rock.Client.Person person,
                                    bool isNewPhoneNumber,
                                    Rock.Client.PhoneNumber phoneNumber,
                                    List <KeyValuePair <string, string> > attributes,
                                    MemoryStream personImage,
                                    HttpRequest.RequestResult resultHandler)
        {
            // if they're a new person, flag them as a pending visitor.
            if (isNewPerson == true)
            {
                person.RecordStatusValueId     = Settings.Rock_RecordStatusValueId_Pending;
                person.ConnectionStatusValueId = Settings.Rock_ConnectionStatusValueId_Visitor;
            }

            ApplicationApi.UpdateOrAddPerson(person, isNewPerson, Config.Instance.CurrentPersonAliasId,
                                             delegate(System.Net.HttpStatusCode statusCode, string statusDescription)
            {
                if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true)
                {
                    // was this a new person?
                    if (isNewPerson == true)
                    {
                        // then we need to get their profile so we know the ID to use for updating the rest of their stuff.
                        TryGetNewlyCreatedProfile(person, isNewPhoneNumber, phoneNumber, attributes, personImage, resultHandler);
                    }
                    else
                    {
                        // now update pending attributes.
                        foreach (KeyValuePair <string, string> attribValue in attributes)
                        {
                            // just fire and forget these values.
                            FamilyManagerApi.UpdateOrAddPersonAttribute(person.Id, attribValue.Key, attribValue.Value, null);
                        }

                        // are we deleting an existing number?
                        if (string.IsNullOrWhiteSpace(phoneNumber.Number) == true && isNewPhoneNumber == false)
                        {
                            TryDeleteCellPhone(person, phoneNumber, personImage, resultHandler);
                        }
                        // are we updating or adding an existing?
                        else if (string.IsNullOrWhiteSpace(phoneNumber.Number) == false)
                        {
                            TryUpdateCellPhone(person, isNewPhoneNumber, phoneNumber, personImage, resultHandler);
                        }
                        else
                        {
                            TryUpdateProfilePic(person, personImage, resultHandler);
                        }
                    }
                }
                else
                {
                    // error
                    resultHandler(statusCode, statusDescription);
                }
            });
        }
Esempio n. 8
0
        void DownloadRockValues( )
        {
            // only let them submit if they have something beyond "http://" (or some other short crap)
            if (RockUrlField.Text.IsValidURL( ) == true)
            {
                // hide the keyboard
                RockUrlField.ResignFirstResponder( );

                // disable until we're done
                Sync.Enabled = false;
                ToggleSaveButton(false);

                BlockerView.BringToFront( );
                BlockerView.Show(delegate
                {
                    // see if Rock is AT this server.
                    ApplicationApi.IsRockAtURL(RockUrlField.Text,
                                               delegate(System.Net.HttpStatusCode statusCode, string statusDescription)
                    {
                        if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode))
                        {
                            // attempt to contact Rock and get all the required information.
                            Config.Instance.TryBindToRockServer(RockUrlField.Text, RockAuthKeyField.Text,
                                                                delegate(bool result)
                            {
                                // it worked, so Rock is valid.
                                if (result == true)
                                {
                                    ConfigurationTemplates = Config.Instance.TempConfigurationTemplates;
                                    Campuses = Config.Instance.TempCampuses;
                                    HandleDownloadResult(Strings.General_RockBindSuccess);
                                }
                                else
                                {
                                    // error - clear the lists
                                    ClearLists( );

                                    HandleDownloadResult(Strings.General_RockBindError_Data);
                                }
                            });
                        }
                        else
                        {
                            BlockerView.Hide(
                                delegate
                            {
                                // error - clear the lists
                                ClearLists( );

                                HandleDownloadResult(Strings.General_RockBindError_NotFound);
                            });
                        }
                    });
                });
            }
        }
Esempio n. 9
0
 public ItemViewModel(ApplicationApi.ApplicationInfo newApplicationInfo)
 {
     ApplicationInfo = newApplicationInfo;
     if (ApplicationInfo != null)
     {
         _title = ApplicationInfo.Title;
         _subText = ApplicationInfo.Author;
         _iconUri = newApplicationInfo.ApplicationIcon;
     }
 }
 private void SetupApis()
 {
     Error = new ErrorApi {
         Client = this
     };
     Account = new AccountApi {
         Client = this
     };
     Application = new ApplicationApi {
         Client = this
     };
     AvailableNumber = new AvailableNumberApi {
         Client = this
     };
     Bridge = new BridgeApi {
         Client = this
     };
     Domain = new DomainApi {
         Client = this
     };
     Call = new CallApi {
         Client = this
     };
     Conference = new ConferenceApi {
         Client = this
     };
     Message = new MessageApi {
         Client = this
     };
     NumberInfo = new NumberInfoApi {
         Client = this
     };
     PhoneNumber = new PhoneNumberApi {
         Client = this
     };
     Recording = new RecordingApi {
         Client = this
     };
     Transcription = new TranscriptionApi {
         Client = this
     };
     Media = new MediaApi {
         Client = this
     };
     Endpoint = new EndpointApi {
         Client = this
     };
     V2 = new ApiV2 {
         Message = new Bandwidth.Net.ApiV2.MessageApi {
             Client = this
         }
     };
 }
Esempio n. 11
0
 public static void UpdateOrAddPhoneNumber(Rock.Client.Person person, Rock.Client.PhoneNumber phoneNumber, bool isNew, HttpRequest.RequestResult <Rock.Client.PhoneNumber> resultHandler)
 {
     // is it blank?
     if (string.IsNullOrEmpty(phoneNumber.Number) == true)
     {
         // if it's not new, we should delete an existing
         if (isNew == false)
         {
             ApplicationApi.DeleteCellPhoneNumber(phoneNumber,
                                                  delegate(System.Net.HttpStatusCode statusCode, string statusDescription)
             {
                 if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true)
                 {
                     // return the blank number back to them
                     resultHandler(statusCode, statusDescription, phoneNumber);
                 }
             });
         }
         // otherwise, simply ignore it and say we're done.
         else
         {
             resultHandler(System.Net.HttpStatusCode.OK, "", phoneNumber);
         }
     }
     // not blank, so we're adding or updating
     else
     {
         // send it to the server
         ApplicationApi.AddOrUpdateCellPhoneNumber(person, phoneNumber, isNew, 0,
                                                   delegate(System.Net.HttpStatusCode statusCode, string statusDescription)
         {
             if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true)
             {
                 // if it was new, get it so we have its ID
                 if (isNew == true)
                 {
                     ApplicationApi.GetPhoneNumberByGuid(phoneNumber.Guid, resultHandler);
                 }
                 else
                 {
                     // it's updated, so now just return what we updated.
                     resultHandler(statusCode, statusDescription, phoneNumber);
                 }
             }
             // something went wrong, so return.
             else
             {
                 resultHandler(statusCode, statusDescription, null);
             }
         });
     }
 }
Esempio n. 12
0
                public void UpdateProfile(HttpRequest.RequestResult profileResult)
                {
                    ApplicationApi.UpdatePerson(Person, 0, delegate(System.Net.HttpStatusCode statusCode, string statusDescription)
                    {
                        if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true)
                        {
                            SaveToDevice( );
                        }

                        if (profileResult != null)
                        {
                            profileResult(statusCode, statusDescription);
                        }
                    });
                }
Esempio n. 13
0
 // UpdateFullFamily will update the family, address and attributes.
 // For simplicity, it's broken into 3 functions. This one,  and two private ones.
 public static void UpdateFullFamily(Rock.Client.Group family, Rock.Client.GroupLocation address, List <KeyValuePair <string, string> > attributes, HttpRequest.RequestResult resultHandler)
 {
     // start by updating the family group
     ApplicationApi.UpdateFamilyGroup(family, Config.Instance.CurrentPersonAliasId,
                                      delegate(System.Net.HttpStatusCode statusCode, string statusDescription)
     {
         if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode))
         {
             UpdateFamilyAddress(family, address, attributes, resultHandler);
         }
         else
         {
             resultHandler(statusCode, statusDescription);
         }
     });
 }
Esempio n. 14
0
                public void UpdateAddress(HttpRequest.RequestResult addressResult)
                {
                    // fire it off
                    ApplicationApi.UpdateFamilyAddress(PrimaryFamily, PrimaryAddress,
                                                       delegate(System.Net.HttpStatusCode statusCode, string statusDescription)
                    {
                        if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true)
                        {
                            SaveToDevice( );
                        }

                        if (addressResult != null)
                        {
                            addressResult(statusCode, statusDescription);
                        }
                    });
                }
Esempio n. 15
0
 static void TryUpdateProfilePic(Rock.Client.Person person, MemoryStream personImage, HttpRequest.RequestResult resultHandler)
 {
     // is there a picture needing to be uploaded?
     if (personImage != null)
     {
         // upload
         ApplicationApi.UploadSavedProfilePicture(person, personImage, Config.Instance.CurrentPersonAliasId,
                                                  delegate(System.Net.HttpStatusCode statusCode, string statusDescription)
         {
             resultHandler(statusCode, statusDescription);
         });
     }
     else
     {
         resultHandler(HttpStatusCode.OK, "");
     }
 }
Esempio n. 16
0
                public void UpdateHomeCampus(HttpRequest.RequestResult result)
                {
                    // unlike Profile and Address, it's possible they haven't selected a campus, in which
                    // case we don't want to update it.
                    ApplicationApi.UpdateHomeCampus(PrimaryFamily, 0,
                                                    delegate(System.Net.HttpStatusCode statusCode, string statusDescription)
                    {
                        if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true)
                        {
                            SaveToDevice( );
                        }

                        if (result != null)
                        {
                            result(statusCode, statusDescription);
                        }
                    });
                }
Esempio n. 17
0
        void GetCanCheckInGroupTypeRole(OnComplete onComplete)
        {
            ApplicationApi.GetGroupTypeRoleForGuid(Rock.Client.SystemGuid.GroupRole.GROUPROLE_KNOWN_RELATIONSHIPS_CAN_CHECK_IN,
                                                   delegate(System.Net.HttpStatusCode statusCode, string statusDescription, List <Rock.Client.GroupTypeRole> model)
            {
                if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true && model != null && model.Count > 0)
                {
                    TempCanCheckInRole = model[0];

                    GetAllowedToCheckInGroupTypeRole(onComplete);
                }
                // Can Check In Role Failed
                else
                {
                    onComplete(false);
                }
            });
        }
Esempio n. 18
0
        void GetFirstTimeVisitAttribValue(OnComplete onComplete)
        {
            ApplicationApi.GetAttributeForGuid("655D6FBA-F8C0-4919-9E31-C1C936653555",
                                               delegate(System.Net.HttpStatusCode statusCode, string statusDescription, Rock.Client.Attribute model)
            {
                if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true && model != null)
                {
                    TempFirstTimeVisit = model;

                    GetCanCheckInGroupTypeRole(onComplete);
                }
                // Child Role Failed
                else
                {
                    onComplete(false);
                }
            });
        }
Esempio n. 19
0
        void GetAdultGroupTypeRole(OnComplete onComplete)
        {
            ApplicationApi.GetGroupTypeRoleForGuid(Rock.Client.SystemGuid.GroupRole.GROUPROLE_FAMILY_MEMBER_ADULT,
                                                   delegate(System.Net.HttpStatusCode statusCode, string statusDescription, List <Rock.Client.GroupTypeRole> model)
            {
                if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true && model != null && model.Count > 0)
                {
                    TempAdultRole = model[0];

                    GetFirstTimeVisitAttribValue(onComplete);
                }
                // Adult Role Failed
                else
                {
                    onComplete(false);
                }
            });
        }
Esempio n. 20
0
        void GetSchoolGrades(OnComplete onComplete)
        {
            ApplicationApi.GetDefinedValuesForDefinedType(Rock.Client.SystemGuid.DefinedType.SCHOOL_GRADES,
                                                          delegate(System.Net.HttpStatusCode statusCode, string statusDescription, List <Rock.Client.DefinedValue> model)
            {
                if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true)
                {
                    TempSchoolGrades = model;

                    GetChildGroupTypeRole(onComplete);
                }
                // School Grades Failed
                else
                {
                    onComplete(false);
                }
            });
        }
Esempio n. 21
0
        void GetMaritalValues(OnComplete onComplete)
        {
            ApplicationApi.GetDefinedValuesForDefinedType(Rock.Client.SystemGuid.DefinedType.PERSON_MARITAL_STATUS,
                                                          delegate(System.Net.HttpStatusCode statusCode, string statusDescription, List <Rock.Client.DefinedValue> model)
            {
                if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true)
                {
                    TempMaritalStatus = model;

                    GetSchoolGrades(onComplete);
                }
                // Marital Status Failed
                else
                {
                    onComplete(false);
                }
            });
        }
Esempio n. 22
0
 public static void TryGetImpersonationToken(ImpersonationTokenResponse response)
 {
     // if the user is logged in and has an alias ID, try to get it
     if (MobileApp.Shared.Network.RockMobileUser.Instance.LoggedIn == true && MobileApp.Shared.Network.RockMobileUser.Instance.Person.PrimaryAliasId.HasValue == true)
     {
         // make the request
         ApplicationApi.GetImpersonationToken(MobileApp.Shared.Network.RockMobileUser.Instance.Person.Id,
                                              delegate(System.Net.HttpStatusCode statusCode, string statusDescription, string impersonationToken)
         {
             // whether it succeeded or not, hand them the response
             response(impersonationToken);
         });
     }
     else
     {
         // they didn't pass requirements, so hand back an empty string.
         response(string.Empty);
     }
 }
Esempio n. 23
0
        static void TryGetNewlyCreatedProfile(Rock.Client.Person person,
                                              bool isNewPhoneNumber,
                                              Rock.Client.PhoneNumber phoneNumber,
                                              List <KeyValuePair <string, string> > attributes,
                                              MemoryStream personImage,
                                              HttpRequest.RequestResult resultHandler)
        {
            ApplicationApi.GetPersonByGuid(person.Guid,
                                           delegate(System.Net.HttpStatusCode statusCode, string statusDescription, Rock.Client.Person model)
            {
                if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true)
                {
                    person = model;

                    // see if we should set their first time visit status
                    if (Config.Instance.RecordFirstVisit == true)
                    {
                        FamilyManagerApi.UpdateOrAddPersonAttribute(person.Id, Config.Instance.FirstTimeVisitAttrib.Key, DateTime.Now.ToString( ), null);
                    }

                    // now update pending attributes.
                    foreach (KeyValuePair <string, string> attribValue in attributes)
                    {
                        // just fire and forget these values.
                        FamilyManagerApi.UpdateOrAddPersonAttribute(person.Id, attribValue.Key, attribValue.Value, null);
                    }

                    // if there's a phone number to send, send it.
                    if (string.IsNullOrWhiteSpace(phoneNumber.Number) == false)
                    {
                        TryUpdateCellPhone(person, isNewPhoneNumber, phoneNumber, personImage, resultHandler);
                    }
                    else
                    {
                        TryUpdateProfilePic(person, personImage, resultHandler);
                    }
                }
                else
                {
                    resultHandler(statusCode, statusDescription);
                }
            });
        }
Esempio n. 24
0
 static void TryDeleteCellPhone(Rock.Client.Person person,
                                Rock.Client.PhoneNumber phoneNumber,
                                MemoryStream personImage,
                                HttpRequest.RequestResult resultHandler)
 {
     // remove the current number
     ApplicationApi.DeleteCellPhoneNumber(phoneNumber,
                                          delegate(System.Net.HttpStatusCode statusCode, string statusDescription)
     {
         if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true)
         {
             TryUpdateProfilePic(person, personImage, resultHandler);
         }
         else
         {
             resultHandler(statusCode, statusDescription);
         }
     });
 }
Esempio n. 25
0
        void GetAllowedToCheckInGroupTypeRole(OnComplete onComplete)
        {
            ApplicationApi.GetGroupTypeRoleForGuid(Rock.Client.SystemGuid.GroupRole.GROUPROLE_KNOWN_RELATIONSHIPS_ALLOW_CHECK_IN_BY,
                                                   delegate(System.Net.HttpStatusCode statusCode, string statusDescription, List <Rock.Client.GroupTypeRole> model)
            {
                if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true && model != null && model.Count > 0)
                {
                    TempAllowedCheckInByRole = model[0];

                    // Note: add more stuff here if you need.
                    onComplete(true);
                }
                // Allowed Check In By Role Failed
                else
                {
                    onComplete(false);
                }
            });
        }
Esempio n. 26
0
        public override void OnClick()
        {
            string internalName = InternalName;

            if (internalName == "Bluetooth")
            {
                var task = new ConnectionSettingsTask();
                task.ConnectionSettingsType = ConnectionSettingsType.Bluetooth;
                task.Show();
            }
            else if (internalName == "Wifi")
            {
                var task = new ConnectionSettingsTask();
                task.ConnectionSettingsType = ConnectionSettingsType.WiFi;
                task.Show();
            }
            else if (internalName == "Phone")
            {
                //ApplicationApi.LaunchSession("app://5B04B775-356B-4AA0-AAF8-6491FFEA5602/Start");
                ApplicationApi.LaunchSession("app://5B04B775-356B-4AA0-AAF8-6491FFEA561C/CallSettings");
            }
            else if (internalName == "Search")
            {
                ApplicationApi.LaunchSession("app://5B04B775-356B-4AA0-AAF8-6491FFEA5661/SearchHome?QuerySource=HardwareBtn");
            }
            else if (internalName == "BatterySaving")
            {
                ApplicationApi.LaunchSession("app://AFE91DD5-26FB-4ba6-A5A4-4BCEDE8FB3E6/_default");
            }
            else if (internalName == "DataConnection")
            {
                ApplicationApi.LaunchSession("app://5B04B775-356B-4AA0-AAF8-6491FFEA561F/_default");
            }
            else if (internalName == "Accelerometer")
            {
                ApplicationApi.LaunchSession("app://126b3759-8034-4fff-b987-3c0c6f9136f3/_default");
            }
            else if (internalName == "InternetSharing")
            {
                ApplicationApi.LaunchSession("app://5B04B775-356B-4AA0-AAF8-6491FFEA5629/_default");
            }
        }
Esempio n. 27
0
 static void TryUpdateCellPhone(Rock.Client.Person person,
                                bool isNewPhoneNumber,
                                Rock.Client.PhoneNumber phoneNumber,
                                MemoryStream personImage,
                                HttpRequest.RequestResult resultHandler)
 {
     // is their phone number new or existing?
     ApplicationApi.AddOrUpdateCellPhoneNumber(person, phoneNumber, isNewPhoneNumber, Config.Instance.CurrentPersonAliasId,
                                               delegate(System.Net.HttpStatusCode statusCode, string statusDescription)
     {
         if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true)
         {
             TryUpdateProfilePic(person, personImage, resultHandler);
         }
         else
         {
             resultHandler(statusCode, statusDescription);
         }
     });
 }
Esempio n. 28
0
        private static List <ItemViewModel> GetActualItemsList()
        {
            var list = new List <ItemViewModel>();

            foreach (var item in SpecialItemRepository.Items)
            {
                list.Add(item);
            }
            var apps = ApplicationApi.GetAllVisibleApplications();

            foreach (var app in apps)
            {
                string guid = app.ProductID().ToString().ToLower();
                if (guid.Contains("9b921ed5-73a9-4b36-88ea-1b8db509a5be"))
                {
                    string name    = app.Title;
                    string imgpath = app.ImagePath;
                    guid = "{" + guid.ToUpper() + "}";
                    //bool uninstallable = app.IsUninstallable;
                    //var a = new ApplicationApi.Application(Guid.Parse(guid));
                    //a.Uninstall();
                    //Thread.Sleep(3000);
                }
                var item = new ItemViewModel(app.Title, app.Author, null);
                item.ApplicationInfo = app;
                item.IconUri         = app.ApplicationIcon;
                list.Add(item);
            }

            /*
             * var apps = ApplicationApi.GetAllVisibleApplications();
             * foreach (var app in apps)
             * {
             *  var item = new ItemViewModel(app.Title(), app.Author(), null);
             *  item.ApplicationInfo = app;
             *  item.IconUri = app.ApplicationIcon;
             *  list.Add(item);
             * }*/
            return(list);
        }
Esempio n. 29
0
                public void UploadSavedProfilePicture(HttpRequest.RequestResult result)
                {
                    // first open the image.
                    MemoryStream imageStream = (MemoryStream)FileCache.Instance.LoadFile(PrivateSpringboardConfig.ProfilePic);

                    // verify it's valid and not corrupt, or otherwise unable to load. If it is, we'll stop here.
                    if (imageStream != null)
                    {
                        // if upload is called, the profile image implicitely becomes dirty.
                        // that way if it fails, we can know to sync it on next run.
                        ProfileImageDirty = true;

                        ApplicationApi.UploadSavedProfilePicture(Person, imageStream, 0,
                                                                 delegate(System.Net.HttpStatusCode statusCode, string statusDescription)
                        {
                            // now we know that the profile image group was updated correctly, and that's the last step
                            if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true)
                            {
                                // so now we can finally flag everything as good
                                ProfileImageDirty = false;

                                SaveToDevice( );
                            }

                            if (result != null)
                            {
                                result(statusCode, statusDescription);
                            }
                        });
                    }
                    else
                    {
                        // the picture failed to save, so all we can do is say it was fine and
                        // that it is no longer dirty. Both things are true.
                        ProfileImageDirty = false;
                        result(System.Net.HttpStatusCode.OK, "");
                    }
                }
Esempio n. 30
0
        public static void GetPersonForEdit(Rock.Client.GroupMember groupMember, PersonEditResponseDelegate response)
        {
            // get their attributes before presenting.
            ApplicationApi.GetPersonById(groupMember.Person.Id, true,
                                         delegate(System.Net.HttpStatusCode statusCode, string statusDescription, Rock.Client.Person refreshedPerson)
            {
                if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) && refreshedPerson != null)
                {
                    // get the people allowed to check them in
                    string query = string.Format("?personId={0}&relationshipRoleId={1}", groupMember.Person.Id, Config.Instance.AllowedCheckInByRole.Id);

                    RockApi.Get_GroupMembers_KnownRelationships(query, delegate(HttpStatusCode knownRelationshipCode, string knownRelationshipDesc, List <Rock.Client.GroupMember> groupMembers)
                    {
                        if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode))
                        {
                            // and lastly, from that, get the families of these group members
                            if (groupMembers.Count > 0)
                            {
                                GroupMembersToFamilyGroups(refreshedPerson, groupMembers, response);
                            }
                            else
                            {
                                response(refreshedPerson, null);
                            }
                        }
                        else
                        {
                            response(null, null);
                        }
                    });
                }
                else
                {
                    response(null, null);
                }
            });
        }
Esempio n. 31
0
        public MainWindow()
        {
            var appName = Process.GetCurrentProcess().ProcessName + ".exe";

            SetIE8KeyforWebBrowserControl(appName);

            InitializeComponent();

            //var bootstrapper = Bootstrapper.Current;
            //bootstrapper.Run();

            DispatcherHelper.SetDispatherAsDefault();
            WebWorker.SetBrowser((MyWebBrowser.Child as System.Windows.Forms.WebBrowser));

            ApplicationApi.Auth("penzin", "super");

            BoardApi.CheckIntegrity("Avito");
            //BoardApi.GetBulletins("Avito");
            //BoardApi.GetXlsBulletins("Avito");
            //BoardApi.EditBulletinsFromXls("Avito");
            //BoardApi.AddBulletinsFromXls("Avito");
            //BoardApi.GetXlsGroup("Avito");
            //BulletinContainerList.ExecuteAll();
        }