当前位置: 首页>>代码示例>>C#>>正文


C# Google类代码示例

本文整理汇总了C#中Google的典型用法代码示例。如果您正苦于以下问题:C# Google类的具体用法?C# Google怎么用?C# Google使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Google类属于命名空间,在下文中一共展示了Google类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AnalyticsService

 public AnalyticsService(Google.Apis.Services.BaseClientService.Initializer initializer)
     : base(initializer)
 {
     this._management = new ManagementResource(this, Authenticator);
     this._data = new DataResource(this, Authenticator);
     this.InitParameters();
 }
开发者ID:Anupamsdesk,项目名称:GoogleAnalytics,代码行数:7,代码来源:AnalyticsService.cs

示例2: Subscribe

        public override void Subscribe(Google.ProtocolBuffers.IRpcController controller, bnet.protocol.presence.SubscribeRequest request, System.Action<bnet.protocol.NoData> done)
        {
            switch (request.EntityId.GetHighIdType())
            {
                case EntityIdHelper.HighIdType.AccountId:
                    var account = AccountManager.GetAccountByPersistentID(request.EntityId.Low);
                    if (account != null)
                    {
                        Logger.Trace("Subscribe() {0} {1}", this.Client, account);
                        account.AddSubscriber(this.Client, request.ObjectId);
                    }
                    break;
                case EntityIdHelper.HighIdType.ToonId:
                    var toon = ToonManager.GetToonByLowID(request.EntityId.Low);                    
                    if (toon != null) 
                    {
                        Logger.Trace("Subscribe() {0} {1}", this.Client, toon);
                        toon.AddSubscriber(this.Client, request.ObjectId); // The client will send us a Subscribe with ToonId of 0 the first time it tries to create a toon with a name that already exists. Let's handle that here.
                    }
                    break;
                default:
                    Logger.Warn("Recieved an unhandled Presence.Subscribe request with type {0}", request.EntityId.GetHighIdType());
                    break;
            }

            var builder = bnet.protocol.NoData.CreateBuilder();
            done(builder.Build());
        }
开发者ID:wow4all,项目名称:mooege,代码行数:28,代码来源:PresenceService.cs

示例3: Subscribe

        public override void Subscribe(Google.ProtocolBuffers.IRpcController controller, bnet.protocol.presence.SubscribeRequest request, System.Action<bnet.protocol.NoData> done)
        {
            switch (request.EntityId.GetHighIdType())
            {
                case EntityIdHelper.HighIdType.AccountId:
                    var account = AccountManager.GetAccountByPersistentID(request.EntityId.Low);
                    if (account != null)
                    {
                        Logger.Trace("Subscribe() {0} {1}", this.Client, account);
                        account.AddSubscriber(this.Client, request.ObjectId);
                    }
                    break;
                case EntityIdHelper.HighIdType.GameAccountId:
                    var gameaccount = GameAccountManager.GetAccountByPersistentID(request.EntityId.Low);
                    if (gameaccount != null)
                    {
                        Logger.Trace("Subscribe() {0} {1}", this.Client, gameaccount);
                        gameaccount.AddSubscriber(this.Client, request.ObjectId);
                    }
                    break;
                default:
                    Logger.Warn("Recieved an unhandled Presence.Subscribe request with type {0} (0x{1})", request.EntityId.GetHighIdType(), request.EntityId.High.ToString("X16"));
                    break;
            }

            var builder = bnet.protocol.NoData.CreateBuilder();
            done(builder.Build());
        }
开发者ID:ReptileZ,项目名称:mooege,代码行数:28,代码来源:PresenceService.cs

示例4: SendNotification

        public override void SendNotification(Google.ProtocolBuffers.IRpcController controller, bnet.protocol.notification.Notification request, Action<bnet.protocol.NoData> done)
        {
            Logger.Trace("SendNotification()");
            //Logger.Debug("notification:\n{0}", request.ToString());

            switch (request.GetNotificationType())
            {
                case NotificationTypeHelper.NotificationType.Whisper:
                    
                    // NOTE: Real implementation doesn't even handle the situation where neither client knows about the other.
                    // Client requires prior knowledge of sender and target (and even then it cannot whisper by using the /whisper command).

                    Logger.Trace(string.Format("NotificationRequest by {0} to {1}", this.Client.CurrentToon, ToonManager.GetToonByLowID(request.TargetId.Low)));

                    var account = ToonManager.GetOwnerAccountByToonLowId(request.TargetId.Low);
                    if (account.LoggedInClient == null) return;

                    var notification = bnet.protocol.notification.Notification.CreateBuilder(request)
                        .SetSenderId(this.Client.CurrentToon.BnetEntityID)
                        .Build();

                    var method = bnet.protocol.notification.NotificationListener.Descriptor.FindMethodByName("OnNotificationReceived");
                    account.LoggedInClient.CallMethod(method, notification);
                    break;
                default:
                    Logger.Warn("Unhandled notification type: {0}", request.Type);
                    break;
            }

            var builder = bnet.protocol.NoData.CreateBuilder();
            done(builder.Build());
        }
开发者ID:Sanchen,项目名称:mooege,代码行数:32,代码来源:NotificationService.cs

示例5: SendNotification

        public override void SendNotification(Google.ProtocolBuffers.IRpcController controller, bnet.protocol.notification.Notification request, Action<bnet.protocol.NoData> done)
        {
            switch (request.GetNotificationType())
            {
                case NotificationTypeHelper.NotificationType.Whisper:
                    
                    // NOTE: Real implementation doesn't even handle the situation where neither client knows about the other.
                    // Client requires prior knowledge of sender and target (and even then it cannot whisper by using the /whisper command).

                    Logger.Trace(string.Format("NotificationRequest.Whisper by {0} to {1}", this.Client.CurrentToon, ToonManager.GetToonByLowID(request.TargetId.Low)));

                    var account = ToonManager.GetOwnerAccountByToonLowId(request.TargetId.Low);
                    if (account.LoggedInClient == null) return;

                    if (account is CommandHandlerAccount) // hackish way to enable server commands for players that are not in party.
                        CommandHandlerAccount.Instance.ParseCommand(request, this.Client);
                    else
                    {
                        var notification = bnet.protocol.notification.Notification.CreateBuilder(request)
                            .SetSenderId(this.Client.CurrentToon.BnetEntityID)
                            .Build();

                        account.LoggedInClient.MakeRPC(() => bnet.protocol.notification.NotificationListener.CreateStub(account.LoggedInClient).
                                      OnNotificationReceived(controller, notification, callback => { }));
                    }
                    break;
                default:
                    Logger.Warn("Unhandled notification type: {0}", request.Type);
                    break;
            }

            var builder = bnet.protocol.NoData.CreateBuilder();
            done(builder.Build());
        }
开发者ID:Velhenn,项目名称:mooege,代码行数:34,代码来源:NotificationService.cs

示例6: CreateUITasklist

        private Expander CreateUITasklist(TaskList list, Google.Apis.Tasks.v1.Data.Tasks tasks)
        {
            var expander = new Expander();

            // Add a bold title.
            expander.Header = list.Title;
            expander.FontWeight = FontWeights.Bold;

            // Add the taskItems (if applicable).
            if (tasks.Items != null)
            {
                var container = new StackPanel();
                foreach (CheckBox box in tasks.Items.Select(CreateUITask))
                {
                    container.Children.Add(box);
                }
                expander.Content = container;
            }
            else
            {
                expander.Content = "There are no tasks in this list.";
            }

            return expander;
        }
开发者ID:Cyril12740,项目名称:google-api-dotnet-client-samples,代码行数:25,代码来源:MainWindow.xaml.cs

示例7: SendNotification

        public override void SendNotification(Google.ProtocolBuffers.IRpcController controller, bnet.protocol.notification.Notification request, Action<bnet.protocol.NoData> done)
        {
            switch (request.GetNotificationType())
            {
                case NotificationTypeHelper.NotificationType.Whisper:

                    // NOTE: Real implementation doesn't even handle the situation where neither client knows about the other.
                    // Client requires prior knowledge of sender and target (and even then it cannot whisper by using the /whisper command).

                    Logger.Trace(string.Format("NotificationRequest.Whisper by {0} to {1}", this.Client.CurrentToon, ToonManager.GetToonByLowID(request.TargetId.Low)));

                    var targetAccount = ToonManager.GetOwnerAccountByToonLowId(request.TargetId.Low);
                    if (targetAccount.LoggedInClient == null) return;

                    if (targetAccount == this.Client.Account) // check if whisper targets the account itself.
                        CommandManager.TryParse(request.AttributeList[0].Value.StringValue, this.Client); // try parsing it as a command and respond it if so.
                    else
                    {
                        var notification = bnet.protocol.notification.Notification.CreateBuilder(request)
                            .SetSenderId(this.Client.CurrentToon.BnetEntityID)
                            .Build();

                        targetAccount.LoggedInClient.MakeRPC(() => 
                            bnet.protocol.notification.NotificationListener.CreateStub(targetAccount.LoggedInClient).OnNotificationReceived(controller, notification, callback => { }));
                    }
                    break;
                default:
                    Logger.Warn("Unhandled notification type: {0}", request.Type);
                    break;
            }

            var builder = bnet.protocol.NoData.CreateBuilder();
            done(builder.Build());
        }
开发者ID:wow4all,项目名称:mooege,代码行数:34,代码来源:NotificationService.cs

示例8: Logon

		public override void Logon(Google.ProtocolBuffers.IRpcController controller, LogonRequest request, Action<LogonResponse> done) {
			/*var client_auth = client.GetImportedService<bnet.protocol.authentication.AuthenticationClient>();
			var mod_load_req = ModuleLoadRequest.CreateBuilder();
			var mod_handle = ContentHandle.CreateBuilder();
			mod_handle.SetRegion(0x00005553);
			mod_handle.SetUsage(0x61757468);
			var password_hash = new byte[] { 0x8f, 0x52, 0x90, 0x6a, 0x2c, 0x85, 0xb4, 0x16, 0xa5, 0x95, 0x70, 0x22, 0x51, 0x57, 0xf, 0x96, 0xd3, 0x52, 0x2f, 0x39, 0x23, 0x76, 0x3, 0x11, 0x5f, 0x2f, 0x1a, 0xb2, 0x49, 0x62, 0x4, 0x3c };
			mod_handle.SetHash(ByteString.CopyFrom(password_hash));
			mod_load_req.SetModuleHandle(mod_handle);

			client_auth.ModuleLoad(null, mod_load_req.Build(), res => {
				Console.WriteLine(res);
			});*/


			var response = LogonResponse.CreateBuilder();
			var account = bnet.protocol.EntityId.CreateBuilder();
			var game_account = bnet.protocol.EntityId.CreateBuilder();

			account.SetHigh(0x100000000000000).SetLow(1234);

			game_account.SetHigh(0x200006200004433).SetLow(1234);

			response.SetAccount(account).SetGameAccount(game_account);

			done(response.Build());
		}
开发者ID:fry,项目名称:d3,代码行数:27,代码来源:AuthenticationServerImpl.cs

示例9: Update

        public override void Update(Google.ProtocolBuffers.IRpcController controller, bnet.protocol.presence.UpdateRequest request, System.Action<bnet.protocol.NoData> done)
        {            
            //Logger.Warn("request:\n{0}", request.ToString());
            // This "UpdateRequest" is not, as it may seem, a request to update the client on the state of an object,
            // but instead the *client* requesting to change fields on an object that it has subscribed to.
            // Check docs/rpc/presence.txt in branch wip-docs (or master)

            switch (request.EntityId.GetHighIdType())
            {
                case EntityIdHelper.HighIdType.AccountId:
                    var account = AccountManager.GetAccountByPersistantID(request.EntityId.Low);
                    Logger.Trace("Update:Account: {0} {1}", request.EntityId.GetHighIdType(), request.EntityId.Low);
                    break;
                case EntityIdHelper.HighIdType.ToonId:
                    var toon = ToonManager.GetToonByLowID(request.EntityId.Low);
                    Logger.Trace("Update:Toon: {0}", toon);
                    break;
                default:
                    Logger.Warn("Recieved an unhandled Presence.Update request with type {0}", request.EntityId.GetHighIdType());
                    break;
            }

            var builder = bnet.protocol.NoData.CreateBuilder();
            done(builder.Build());
        }
开发者ID:sexywop,项目名称:mooege,代码行数:25,代码来源:PresenceService.cs

示例10: DeclineInvitation

        public override void DeclineInvitation(Google.ProtocolBuffers.IRpcController controller, bnet.protocol.invitation.GenericRequest request, Action<bnet.protocol.NoData> done)
        {
            var respone = bnet.protocol.NoData.CreateBuilder();
            done(respone.Build());

            this._invitationManager.HandleDecline(this.Client, request);
        }
开发者ID:rosebud,项目名称:mooege,代码行数:7,代码来源:ChannelInvitationService.cs

示例11: RevokeInvitation

        public override void RevokeInvitation(Google.ProtocolBuffers.IRpcController controller, bnet.protocol.channel_invitation.RevokeInvitationRequest request, Action<bnet.protocol.NoData> done)
        {
            var builder = bnet.protocol.NoData.CreateBuilder();
            done(builder.Build());

            this._invitationManager.Revoke(this.Client, request);
        }
开发者ID:rosebud,项目名称:mooege,代码行数:7,代码来源:ChannelInvitationService.cs

示例12: AcceptInvitation

        public override void AcceptInvitation(Google.ProtocolBuffers.IRpcController controller, bnet.protocol.channel_invitation.AcceptInvitationRequest request, Action<bnet.protocol.channel_invitation.AcceptInvitationResponse> done)
        {
            var response = bnet.protocol.channel_invitation.AcceptInvitationResponse.CreateBuilder().SetObjectId(this._invitationManager.DynamicId).Build();
            done(response);

            this._invitationManager.HandleAccept(this.Client, request);
        }
开发者ID:rosebud,项目名称:mooege,代码行数:7,代码来源:ChannelInvitationService.cs

示例13: GetFacebookContactSuggestion

        public List<dynamic> GetFacebookContactSuggestion(Google.GData.Extensions.Name gName)
        {
            var list = GetFacebookContacts();
            var suggestions = new List<dynamic>();

            // Try to find on both parts
            foreach (dynamic user in list)
            {
                var name = (user.name as string);
                if (name == null)
                    continue;

                if (name.IndexOf(gName.GivenName, StringComparison.Ordinal) > -1 && name.IndexOf(gName.FamilyName, StringComparison.Ordinal) > -1)
                    suggestions.Add(user);
            }

            // If nothing found try more general search
            if(suggestions.Count <= 0)
            {
                suggestions.Clear();
                foreach (dynamic user in list)
                {
                    var name = (user.name as string);
                    if (name == null)
                        continue;

                    if ((gName.FamilyName != null && name.IndexOf(gName.FamilyName, StringComparison.Ordinal) > -1) || name.IndexOf(gName.GivenName, StringComparison.Ordinal) > -1)
                        suggestions.Add(user);
                }
            }

            return suggestions;
        }
开发者ID:bhaveshsorathiya1,项目名称:Googlebook,代码行数:33,代码来源:ContactManager.cs

示例14: Create

        public static FullVideo Create(Google.YouTube.Video ytVideo = null)
        {
            if (ytVideo == null) {
                throw new Exception("Invalid link");
            }
            CurtDevDataContext db = new CurtDevDataContext();
            Video new_video = new Video {
                embed_link = ytVideo.VideoId,
                title = ytVideo.Title,
                screenshot = (ytVideo.Thumbnails.Count > 0) ? ytVideo.Thumbnails[2].Url : "/Content/img/noimage.jpg",
                description = ytVideo.Description,
                watchpage = ytVideo.WatchPage.ToString(),
                youtubeID = ytVideo.VideoId,
                dateAdded = DateTime.Now,
                sort = (db.Videos.Count() == 0) ? 1 : db.Videos.OrderByDescending(x => x.sort).Select(x => x.sort).First() + 1
            };
            db.Videos.InsertOnSubmit(new_video);
            db.SubmitChanges();

            FullVideo fullvideo = new FullVideo {
                videoID = new_video.videoID,
                embed_link = new_video.embed_link,
                dateAdded = new_video.dateAdded,
                sort = new_video.sort,
                videoTitle = new_video.title,
                thumb = (ytVideo.Thumbnails.Count > 0) ? ytVideo.Thumbnails[0].Url : "/Content/img/noimage.jpg"
            };

            return fullvideo;
        }
开发者ID:janiukjf,项目名称:CurtAdmin,代码行数:30,代码来源:VideoModel.cs

示例15: JoinChannel

        public override void JoinChannel(Google.ProtocolBuffers.IRpcController controller, bnet.protocol.channel.JoinChannelRequest request, System.Action<bnet.protocol.channel.JoinChannelResponse> done)
        {
            Logger.Trace("JoinChannel()");

            var builder = bnet.protocol.channel.JoinChannelResponse.CreateBuilder().SetObjectId(67122); // should be fixed with the actual joined channel object id.
            done(builder.Build());
        }
开发者ID:Rianon,项目名称:mooege,代码行数:7,代码来源:ChannelOwnerService.cs


注:本文中的Google类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。