コード例 #1
0
        public void TestNotification()
        {
            logger.Info("test");
            //            Settings.TestSettings(typeof(NotificationServiceStub), null);
            using (TransactionScope scope = new TransactionScope())
            {
                TitleTableAdapter tta = new TitleTableAdapter();
                DataSet.TitleDataTable tdt = new DataSet.TitleDataTable();
                tdt.AddTitleRow("test title", "test push message", "test site root path", "test standby path");
                tta.Update(tdt);
                DataSet.TitleRow title = tdt[0];

                CredentialTableAdapter cta = new CredentialTableAdapter();
                DataSet.CredentialDataTable cdt = new DataSet.CredentialDataTable();
                cdt.AddCredentialRow(title, Credential.ApnsPkcs12FilePathKind, SecureConstant.P12File);
                cta.Update(cdt);
                cdt.AddCredentialRow(title, Credential.ApnsPkcs12FilePasswordKind, SecureConstant.P12FilePassword);
                cta.Update(cdt);
                cdt.AddCredentialRow(title, Credential.LvlRsaKeyValueKind, "test lvlrsakeyvalue");
                cta.Update(cdt);

                SubscriberTableAdapter sta = new SubscriberTableAdapter();
                DataSet.SubscriberDataTable sdt = new DataSet.SubscriberDataTable();
                sdt.AddSubscriberRow(title, "test authkey", "web", Constant.Ago);
                sta.Update(sdt);
                DataSet.SubscriberRow subscriber = sdt[0];

                APNsTableAdapter ata = new APNsTableAdapter();
                ata.Insert(subscriber.Id, "B9C83DAE377DDEEECB7C9EA662F7BFBC5D3FA95A5AD5E3CD4B0DD843E0D9EBED", false, 0, false);

                ApnsPusher p = ApnsPusher.GetInstance(title);
                p.PushReleaseNotification("test push message 2");
                System.Threading.Thread.Sleep(10000); // �����ɏI������ƒʐM���Ԃɍ���Ȃ��i���ۂɑ��M����ꍇ�j

                DataSet.APNsDataTable adt = ata.GetDataByTitleId(title.Id);
                Expect(adt[0].UnreadRelease, Is.EqualTo(1));
            }
        }
コード例 #2
0
ファイル: TitleListForm.cs プロジェクト: hajimen/flowerflower
        private void NewTitleButton_Click(object sender, EventArgs e)
        {
            DataSet.TitleDataTable dt = new DataSet.TitleDataTable();
            DataSet.TitleRow title = dt.AddTitleRow("", "", "", "");
            Credential c = new Credential();
            using (EditTitleForm f = new EditTitleForm(true, ref title, ref c))
            {
                if (f.ShowDialog() == DialogResult.OK)
                {
                    titleTableAdapter.Update(dt);
                    CredentialTableAdapter cta = new CredentialTableAdapter();
                    DataSet.CredentialDataTable cdt = new DataSet.CredentialDataTable();
                    cdt.AddCredentialRow(title, Credential.ApnsPkcs12FilePathKind, c.ApnsPkcs12FilePath);
                    cta.Update(cdt);
                    cdt.AddCredentialRow(title, Credential.ApnsPkcs12FilePasswordKind, c.ApnsPkcs12FilePassword);
                    cta.Update(cdt);
                    cdt.AddCredentialRow(title, Credential.ApnsIsSandboxKind, c.ApnsIsSandbox.ToString());
                    cta.Update(cdt);
                    cdt.AddCredentialRow(title, Credential.LvlRsaKeyValueKind, c.LvlRsaKeyValue);
                    cta.Update(cdt);
                    cdt.AddCredentialRow(title, Credential.LvlPackageNameKind, c.LvlPackageName);
                    cta.Update(cdt);

                    this.titleTableAdapter.Fill(this.dataSet.Title);
                    MessageBox.Show("�V�����z�M�^�C�g����lj����܂���");
                }
            }
        }