Пример #1
0
        private void HandleInvitationAccepted(MIDIControl control, Bundle rinfo)
        {
            if (DEBUG)
            {
                Log.Debug(TAG, "handleInvitationAccepted " + rinfo.ToString());
            }
            if (!this.isConnected && this.rinfo1 == null)
            {
                if (DEBUG)
                {
                    Log.Debug(TAG, "cancel connectFuture");
                }
                connectFuture.Stop();
                connectFuture = null;

                if (DEBUG)
                {
                    Log.Debug(TAG, "set rinfo1 " + rinfo.ToString());
                }
                rinfo1 = (Bundle)rinfo.Clone();
                rinfo1.PutString(midi.MIDIConstants.RINFO_NAME, control.name);
                rinfo.PutInt(midi.MIDIConstants.RINFO_PORT, rinfo.GetInt(midi.MIDIConstants.RINFO_PORT) + 1);
                connectTaskCount = 0;
                Connect(rinfo);
            }
            else
            if (!this.isConnected && rinfo2 == null)
            {
                if (DEBUG)
                {
                    Log.Debug(TAG, "cancel connectFuture");
                }
                connectFuture.Stop();
                connectFuture    = null;
                connectTaskCount = 0;

                this.isConnected = true;
                this.name        = control.name;
                this.ssrc        = control.ssrc;
                if (DEBUG)
                {
                    Log.Debug(TAG, "set rinfo2 " + rinfo.ToString());
                }
                rinfo2 = (Bundle)rinfo.Clone();
                MessagingCenter.Send <StreamConnectedEvent>(new StreamConnectedEvent(this.initiator_token), "StreamConnectedEvent");
                ResetSyncService(syncServicePrimaryFrequency);
            }
            else
            {
                if (DEBUG)
                {
                    Log.Debug("MIDI2Stream", "unhandled invitation accept");
                }
            }
        }
Пример #2
0
        protected override void OnCreate(Bundle bundle)
        {
            _design.ApplyTheme();
            base.OnCreate(bundle);


            SetContentView(Resource.Layout.file_storage_setup);

            Ioc = new IOConnectionInfo();
            Util.SetIoConnectionFromIntent(Ioc, Intent);

            Kp2aLog.Log("FSSA.OnCreate");

            ProcessName = Intent.GetStringExtra(FileStorageSetupDefs.ExtraProcessName);
            IsForSave   = Intent.GetBooleanExtra(FileStorageSetupDefs.ExtraIsForSave, false);
            if (bundle == null)
            {
                State = new Bundle();
            }
            else
            {
                State        = (Bundle)bundle.Clone();
                _isRecreated = true;
            }

            if (!_isRecreated)
            {
                App.Kp2a.GetFileStorage(Ioc).OnCreate(this, bundle);
            }
        }
Пример #3
0
        private void HandleInvitation(MIDIControl control, Bundle rinfo)
        {
            if (rinfo1 == null)
            {
                rinfo1 = (Bundle)rinfo.Clone();
                this.initiator_token = control.initiator_token;
                this.name            = control.name;
                this.ssrc            = control.ssrc;
                rinfo1.PutString(midi.MIDIConstants.RINFO_NAME, control.name);
                MessagingCenter.Send <MIDIConnectionRequestReceivedEvent>(new MIDIConnectionRequestReceivedEvent(rinfo1), "MIDIConnectionRequestReceivedEvent");
            }
            else
            if (rinfo.GetInt(midi.MIDIConstants.RINFO_PORT) == rinfo1.GetInt(midi.MIDIConstants.RINFO_PORT))
            {
                if (MIDISession.GetInstance().IsHostConnectionAllowed(rinfo))
                {
                    this.SendInvitationAccepted(rinfo);
                }
                else
                {
                    this.SendInvitationRejected(rinfo);
                }
                return;
            }
            else
            if (rinfo2 == null)
            {
                rinfo2           = (Bundle)rinfo.Clone();
                this.isConnected = true;
            }
            else
            {
                return;
            }

// this needs work...
            if (MIDISession.GetInstance().IsHostConnectionAllowed(rinfo))
            {
                this.SendInvitationAccepted(rinfo);
            }
            else
            {
                this.SendInvitationRejected(rinfo);
            }
        }
Пример #4
0
        public void TestBundleEquality()
        {
            Bundle bundle1 = BundleGenerator.GenerateTestBundle(0);
            Bundle bundle2 = bundle1.Clone();

            Assert.AreEqual(bundle1, bundle2, "After a Clone() operation, both Bundles must be equal");

            // Modify the new bundle
            bundle2.RemoveAnimationFromAnimationSheet(bundle2.Animations[0], bundle2.AnimationSheets[0]);

            Assert.AreNotEqual(bundle1, bundle2, "Equal bundles after a Clone() operation must not be equal after a successful call to RemoveAnimationFromAnimationSheet()");
        }
        protected override void OnCreate(Bundle bundle)
        {
            _design.ApplyTheme();
            base.OnCreate(bundle);



            Kp2aLog.Log("SelectStorageLocationActivity.OnCreate");


            if (IsStorageSelectionForSave)
            {
                throw new Exception("save is not yet implemented. In StartSelectFile, no handler for onCreate is passed.");
            }

            bool allowThirdPartyGet  = Intent.GetBooleanExtra(FileStorageSelectionActivity.AllowThirdPartyAppGet, false);
            bool allowThirdPartySend = Intent.GetBooleanExtra(FileStorageSelectionActivity.AllowThirdPartyAppSend, false);

            bool isRecreated = false;

            if (bundle == null)
            {
                State = new Bundle();
            }
            else
            {
                State = (Bundle)bundle.Clone();
                var selectedIocString = bundle.GetString(BundleKeySelectedIoc, null);
                if (selectedIocString != null)
                {
                    _selectedIoc = IOConnectionInfo.UnserializeFromString(selectedIocString);
                }
                isRecreated = true;
            }

            //todo: handle orientation change while dialog is shown

            if (!isRecreated)
            {
                StartFileStorageSelection(RequestCodeFileStorageSelectionForPrimarySelect, allowThirdPartyGet, allowThirdPartySend);
            }
        }
Пример #6
0
        // See the public Login method for more info
        private Promise<Gamer> Login(string network, string networkId, string networkSecret, bool preventRegistration = false, Bundle additionalOptions = null)
        {
            Bundle config = Bundle.CreateObject();
            config["network"] = network;
            config["id"] = networkId;
            config["secret"] = networkSecret;
            config["device"] = Managers.SystemFunctions.CollectDeviceInformation();

            Bundle options = additionalOptions != null ? additionalOptions.Clone() : Bundle.CreateObject();
            if (preventRegistration) options["preventRegistration"] = preventRegistration;
            if (!options.IsEmpty) config["options"] = options;

            HttpRequest req = MakeUnauthenticatedHttpRequest("/v1/login");
            req.BodyJson = config;
            return Common.RunInTask<Gamer>(req, (response, task) => {
                Gamer gamer = new Gamer(this, response.BodyJson);
                task.PostResult(gamer);
                Cotc.NotifyLoggedIn(this, gamer);
            });
        }
Пример #7
0
 // Clone because the properties are modified
 internal ProductInfo(Bundle serverData) : base(serverData.Clone())
 {
 }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            _design.ApplyTheme();

            Kp2aLog.Log("SelectStorageLocationActivity.OnCreate");

            if (IsStorageSelectionForSave)
            {
                throw new Exception("save is not yet implemented. In StartSelectFile, no handler for onCreate is passed.");
            }

            bool allowThirdPartyGet = Intent.GetBooleanExtra(FileStorageSelectionActivity.AllowThirdPartyAppGet, false);
            bool allowThirdPartySend = Intent.GetBooleanExtra(FileStorageSelectionActivity.AllowThirdPartyAppSend, false);

            bool isRecreated = false;
            if (bundle == null)
                State = new Bundle();
            else
            {
                State = (Bundle)bundle.Clone();
                var selectedIocString = bundle.GetString(BundleKeySelectedIoc, null);
                if (selectedIocString != null)
                    _selectedIoc = IOConnectionInfo.UnserializeFromString(selectedIocString);
                isRecreated = true;
            }

            //todo: handle orientation change while dialog is shown

            if (!isRecreated)
            {
                StartFileStorageSelection(RequestCodeFileStorageSelectionForPrimarySelect, allowThirdPartyGet, allowThirdPartySend);
            }
        }
Пример #9
0
 // Clone because the properties are modified
 internal ProductInfo(Bundle serverData)
     : base(serverData.Clone())
 {
 }