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


C# Request.Send方法代码示例

本文整理汇总了C#中Request.Send方法的典型用法代码示例。如果您正苦于以下问题:C# Request.Send方法的具体用法?C# Request.Send怎么用?C# Request.Send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Request的用法示例。


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

示例1: KillProcess

		public Task<ProcessKillResultArgs> KillProcess(int pid)
		{
			Request<ProcessKillResultArgs> request = new Request<ProcessKillResultArgs>(this);
			return request.Send(pid, 600).ContinueWith(t =>
			{
				if (!t.Result.IsFaulted || t.Result.Exception is ArgumentException)
				{
					ProcessItem firstOrDefault = Processes.FirstOrDefault(x => x.ID == pid);
					Processes.Remove(firstOrDefault);
				}

				return t.Result;
			}, Tcp.UiScheduler);
		}
开发者ID:heinzsack,项目名称:DEV,代码行数:14,代码来源:ProcessService.cs

示例2: RemoteIdentify

		private Task RemoteIdentify()
		{
			Request<InvestigationObject> dr = new Request<InvestigationObject>(this);
			return dr.Send(InvestigationObject.Get(), 0).ContinueWith(t =>
			{
				if (t.IsFaulted != true)
				{
					BaseConnection.RemoteHost.Info.FromInvestigationObject(t.Result);
				}
				else
				{
					this.BaseConnection.Log(this, "RI Failed: " + t.Exception.MostInner().Message);
				}
			}, TaskScheduler.Default);
		}
开发者ID:heinzsack,项目名称:DEV,代码行数:15,代码来源:RemoteIdentificationService.cs

示例3: SendHeartbeat

		public Task SendHeartbeat()
		{
			Request r = new Request(this) {Options = {TimeOut = TimeSpan.FromSeconds(5)}};
			return r.Send(null, 0).ContinueWith(t =>
			{
				if (t.IsFaulted)
				{
					BaseConnection.Statistic.IsResponsive = false;
				}
				else
				{
					BaseConnection.Statistic.IsResponsive = true;
					BaseConnection.Statistic.ResponseTime = (DateTime.Now - r.SendTime).TotalMilliseconds;
				}
			});
		}
开发者ID:heinzsack,项目名称:DEV,代码行数:16,代码来源:HeartbeatService.cs

示例4: RemoteScreenshot

		public Task<BitmapImage> RemoteScreenshot(Options options = null)
		{
			if (options == null)
				options = new Options();


			Request<byte[]> r = new Request<byte[]>(this);
			r.Options.TimeOut = TimeSpan.FromSeconds(20);
			return r.Send(options, 0).ContinueWith(t =>
			{
				if (t.IsFaulted)
					throw t.Exception;
				BitmapImage bitmapImage = t.Result.AsImage();
				LastRecivedImage = bitmapImage;
				LastRecivedImageTime = DateTime.Now;
				return bitmapImage;
			}, Tcp.UiScheduler);
		}
开发者ID:heinzsack,项目名称:DEV,代码行数:18,代码来源:ScreenshotService.cs

示例5: ReloadProcesses

		public Task<ObservableCollection<ProcessItem>> ReloadProcesses(double timeout = 15000)
		{
			Request<ObservableCollection<ProcessItem>> request = new Request<ObservableCollection<ProcessItem>>(this);
			request.Options.TimeOut = TimeSpan.FromMilliseconds(timeout);
			return request.Send(null, 500).ContinueWith(t =>
			{
				if (t.IsFaulted)
					throw t.Exception;

				if (_processes == null)
				{
					Processes = t.Result;
					return t.Result;
				}

				List<ProcessItem> currentItems = Processes.ToList();
				foreach (ProcessItem newItem in t.Result)
				{
					ProcessItem existing = currentItems.FirstOrDefault(x => x.ID == newItem.ID);
					if (existing == null)
					{
						Processes.Add(newItem);
					}
					else
					{
						currentItems.Remove(existing);
						existing.Name = newItem.Name;
						existing.FileName = newItem.FileName;
						existing.MainWindowName = newItem.MainWindowName;
						existing.Ram = newItem.Ram;
						existing.RamPercent = newItem.RamPercent;
						existing.Responding = newItem.Responding;
						existing.StartTime = newItem.StartTime;
					}
				}
				currentItems.ForEach(x => Processes.Remove(x));
				return t.Result;
			}, Tcp.UiScheduler);
		}
开发者ID:heinzsack,项目名称:DEV,代码行数:39,代码来源:ProcessService.cs

示例6: CreateAndSend

      public static Request CreateAndSend(Context context, string senderId) {
        Request request = new Request(context, senderId);
        request.Send();

        return request;
      }
开发者ID:mehul9595,项目名称:Parse-SDK-dotNET,代码行数:6,代码来源:GcmRegistrar.cs

示例7: Kill

		public Task Kill()
		{
			Request r = new Request(this);
			return r.Send(null, 4);
		}
开发者ID:heinzsack,项目名称:DEV,代码行数:5,代码来源:ApplicationService.cs

示例8: ReloadStatistics

		public Task<ConnectionStatistic> ReloadStatistics()
		{
			Request<ConnectionStatistic> r = new Request<ConnectionStatistic>(this);
			r.Options.TimeOut = TimeSpan.FromSeconds(5);
			return r.Send(null, 0).ContinueWith(t =>
			{
				Statistic = t.Result;
				StatisticReloadTime = DateTime.Now;
				return t.Result;
			}, Tcp.UiScheduler);
		}
开发者ID:heinzsack,项目名称:DEV,代码行数:11,代码来源:ConnectionService.cs

示例9: CloseConnection

		public Task<ConnectionCloseResultArgs> CloseConnection(int cId)
		{
			Request<ConnectionCloseResultArgs> r = new Request<ConnectionCloseResultArgs>(this);
			r.Options.TimeOut = new TimeSpan(0,0,0,4);
			return r.Send(cId, 2).ContinueWith(t =>
			{
				if ((t.Result.Exception == null || t.Result.Exception is KeyNotFoundException) && Hop != null && Hop.OpenedConnections != null)
				{
					Hop hop = Hop.OpenedConnections.FirstOrDefault(x=>x.RemoteID == cId);
					if (hop != null)
						Hop.OpenedConnections.Remove(hop);
				}
				return t.Result;
			}, Tcp.UiScheduler);
		}
开发者ID:heinzsack,项目名称:DEV,代码行数:15,代码来源:ConnectionService.cs

示例10: ReloadHopInformation

		public Task<Hop> ReloadHopInformation()
		{
			Request<Hop> r = new Request<Hop>(this);
			r.Options.TimeOut = TimeSpan.FromSeconds(5);
			return r.Send(null, 1).ContinueWith(t =>
			{
				Hop = t.Result;
				HopReloadTime = DateTime.Now;
				return t.Result;
			}, Tcp.UiScheduler);
		}
开发者ID:heinzsack,项目名称:DEV,代码行数:11,代码来源:ConnectionService.cs

示例11: Lock

		public Task Lock()
		{
			Request r = new Request(this);
			return r.Send(null, 3);
		}
开发者ID:heinzsack,项目名称:DEV,代码行数:5,代码来源:OsService.cs

示例12: LogOff

		public Task LogOff()
		{
			Request r = new Request(this);
			return r.Send(null, 2);
		}
开发者ID:heinzsack,项目名称:DEV,代码行数:5,代码来源:OsService.cs

示例13: Restart

		public Task Restart()
		{
			Request r = new Request(this);
			return r.Send(null, 1);
		}
开发者ID:heinzsack,项目名称:DEV,代码行数:5,代码来源:OsService.cs

示例14: Shutdown

		public Task Shutdown()
		{
			Request r = new Request(this);
			return r.Send(null, 0);
		}
开发者ID:heinzsack,项目名称:DEV,代码行数:5,代码来源:OsService.cs

示例15: Push

        public void Push()
        {
            if (Mod.DEBUG_LOG_LEVEL > 1) { Helper.dbgLog("Push triggered. " + DateTime.Now.ToString()); }
            Hashtable hashtables = new Hashtable();

            if (Account.currentAccount == null)
            {
                hashtables.Add("userid", PlatformService.userID.ToString());
                if (PlatformService.apiBackend == APIBackend.Steam)
                {
                    hashtables.Add("universe", "steam");
                }
                else if (PlatformService.apiBackend == APIBackend.Rail)
                {
                    if (PlatformService.platformType == PlatformType.TGP)
                    {
                        hashtables.Add("universe", "tgp");
                    }
                    else if (PlatformService.platformType == PlatformType.QQGame)
                    {
                        hashtables.Add("universe", "qq");
                    }
                }
            }
            else
            {
                hashtables.Add("userid", Account.currentAccount.id);
                hashtables.Add("universe", "accounts");
            }

            hashtables.Add("game", DataLocation.productName.ToLower());
            hashtables.Add("steamid", PlatformService.userID.ToString());
            ArrayList arrayLists = new ArrayList();
            foreach (KeyValuePair<string, List<Telemetry.Pair>> mDatum in this.m_Data)
            {
                int num = (this.IsStandardTelemetry(mDatum.Key) ? 3 : 6);
                Hashtable item = null;
                if (mDatum.Value.Count != 0)
                {
                    for (int i = 0; i < mDatum.Value.Count; i++)
                    {
                        if (i % num == 0)
                        {
                            item = new Hashtable()
                            {
                                { "event", mDatum.Key }
                            };
                            DateTime universalTime = DateTime.Now.ToUniversalTime();
                            item.Add("timestamp", universalTime.ToString("yyyy-MM-ddTHH:mm:ss.fff"));
                            arrayLists.Add(item);
                        }
                        Telemetry.Pair pair = mDatum.Value[i];
                        item[pair.key] = mDatum.Value[i][email protected];
                    }
                }
                else
                {
                    item = new Hashtable()
                    {
                        { "event", mDatum.Key }
                    };
                    DateTime dateTime = DateTime.Now.ToUniversalTime();
                    item.Add("timestamp", dateTime.ToString("yyyy-MM-ddTHH:mm:ss.fff"));
                    arrayLists.Add(item);
                }
            }
            hashtables.Add("data", arrayLists);

            if (Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.DisableAll) ||
                Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.NoOpThePush))
            {
                if (Mod.DEBUG_LOG_ON)
                { Helper.dbgLog("NoOp'd the Push and clearing the hashtables.  \r\n" + JSON.JsonEncode(hashtables)); }

                this.Clear();
                return;
            }

            if (Telemetry.debug || Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.EnableAllButLogToFileInstead))
            {
                if (Mod.DEBUG_LOG_ON) { Helper.dbgLog("Dumping telemetry to log enabled:"); }
                Helper.dbgLog("logging data that would be pushed:\n" + JSON.JsonEncode(hashtables));
                this.Clear();
                return;
            }
            if (Mod.DEBUG_LOG_ON)
            { Helper.dbgLog("debug mode, Pushing data.  :\r\n" + JSON.JsonEncode(hashtables)); }
            Request request2 = new Request("post", Telemetry.paradoxApiURL, hashtables);
            request2.Send(delegate(Request request)
            {
                this.Clear();
            });
        }
开发者ID:Knighth,项目名称:Telemetry-Control,代码行数:93,代码来源:TelemetryKH.cs


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