本文整理汇总了C#中System.Proxy类的典型用法代码示例。如果您正苦于以下问题:C# Proxy类的具体用法?C# Proxy怎么用?C# Proxy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Proxy类属于System命名空间,在下文中一共展示了Proxy类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SetAxosoftProxy
public void SetAxosoftProxy(Proxy axosoftProxy)
{
AxosoftProxy = axosoftProxy;
// set Axosoft host label
AxosoftHostLabel.Text = new Uri(Program.Settings.Url).Host;
GetProjects();
if (Projects.Count == 0)
{
// there are no projects. ask the user if they want to create a new project.
var dialogResult = MessageBox.Show(
"Your Axosoft database has no projects. To use this example, you will need to create a project. Would you like to create a new project called \"API Example Project\" now?",
"Create an Axosoft scrum project",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question);
if (dialogResult == DialogResult.Yes)
{
var project = new Project
{
Name = "API Example Project"
};
AxosoftProxy.Projects.Create(project);
GetProjects();
}
else
{
Application.Exit();
return;
}
}
GetItems();
}
开发者ID:jeremysimmons,项目名称:OnTimeAPIExample,代码行数:35,代码来源:ItemsControl.cs
示例2: AssembleDocument
/// <summary>
/// <c>AssembleDocument</c> assembles (creates) a document from the given template, answers and settings.
/// </summary>
/// <param name="template">An instance of the Template class, from which the document will be assembled.</param>
/// <param name="answers">The set of answers that will be applied to the template to assemble the document</param>
/// <param name="settings">settings that will be used to assemble the document.
/// These settings include the assembled document format (file extension), markup syntax, how to display fields with unanswered variables, etc</param>
/// <param name="logRef">A string to display in logs related to this request.</param>
/// <returns>returns information about the assembled document, the document type, the unanswered variables, the resulting answers, etc.</returns>
public AssembleDocumentResult AssembleDocument(Template template, TextReader answers, AssembleDocumentSettings settings, string logRef)
{
// Validate input parameters, creating defaults as appropriate.
string logStr = logRef == null ? string.Empty : logRef;
if (template == null)
throw new ArgumentNullException("template", string.Format(@"WebService.Services.AssembleDocument: the ""template"" parameter passed in was null, logRef: {0}", logStr));
if (settings == null)
settings = new AssembleDocumentSettings();
AssembleDocumentResult result = null;
AssemblyResult asmResult = null;
using (Proxy client = new Proxy(_endPointName))
{
OutputFormat outputFormat = ConvertFormat(settings.Format);
AssemblyOptions assemblyOptions = ConvertOptions(settings);
string fileName = GetRelativePath(template.GetFullPath());
asmResult = client.AssembleDocument(
fileName,
answers == null ? null : new BinaryObject[] { Util.GetBinaryObjectFromTextReader(answers) }, // answers
outputFormat,
assemblyOptions,
null);
SafeCloseClient(client, logRef);
}
if (asmResult != null)
{
result = Util.ConvertAssemblyResult(template, asmResult, settings.Format);
}
return result;
}
开发者ID:W800RDY,项目名称:hotdocs-open-sdk,代码行数:44,代码来源:WebService.Services.cs
示例3: PopulateVersionInfo
private void PopulateVersionInfo( string libraryUrl, string documentName, Proxy.NavigatorRef.ItemKind kind )
{
this.Items.Clear( );
FileIconManager iconManager = new FileIconManager( this.SmallImageList, this.LargeImageList );
int versionCount = Proxy.ArtifactProxy.GetVersionCount( libraryUrl, documentName );
int i = 0;
for( i = 0; i < versionCount; ++i )
{
string versionLabel = Proxy.ArtifactProxy.GetVersionLabel( libraryUrl, documentName, i );
VersionInfo info = new VersionInfo( i, versionLabel );
ListViewItem item = new ListViewItem( documentName );
ListViewItem.ListViewSubItem subItem = new ListViewItem.ListViewSubItem( item, versionLabel );
item.Tag = info;
SetIcon( iconManager, item, documentName, kind );
item.SubItems.Add( subItem );
this.versionInfo = info;
this.Items.Add( item );
}
this.Items[ i - 1 ].Selected = true;
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:25,代码来源:VersionsListView.cs
示例4: ConClient
public ConClient(Proxy proxy, Client client)
{
_toConnect = client;
_proxy = proxy;
currentServ = _proxy.defServer;
lastRealm = "Nexus";
Save(currentServ);
_vault.IsFromArena = false;
_vault.GameId = -5;
_vault.Host = "localhost"; // (reconnect.Host == "" ? _proxy.getRemoteAddress(client) : reconnect.Host);
_vault.Port = 2050;
_vault.Key = new byte[0];
_vault.KeyTime = 0;
_vault.Name = "{\"text\":\"server.vault\"}";
_vault.Send = true;
_yard.IsFromArena = false;
_yard.GameId = 3235;
_yard.Host = "localhost"; // (reconnect.Host == "" ? _proxy.getRemoteAddress(client) : reconnect.Host);
_yard.Port = 2050;
_yard.Key = new byte[0];
_yard.KeyTime = 0;
_yard.Name = "Pet Yard";
_yard.Send = true;
_ghall.IsFromArena = false;
_ghall.GameId = 3244;
_ghall.Host = "localhost"; // (reconnect.Host == "" ? _proxy.getRemoteAddress(client) : reconnect.Host);
_ghall.Port = 2050;
_ghall.Key = new byte[0];
_ghall.KeyTime = 0;
_ghall.Name = "Guild Hall";
_ghall.Send = true;
}
开发者ID:JuixGames,项目名称:K_Relay,代码行数:35,代码来源:ConClient.cs
示例5: Initialize
public void Initialize(Proxy proxy)
{
proxy.HookPacket(PacketType.UPDATE, OnUpdate);
proxy.HookPacket(PacketType.MAPINFO, GetMapInfo);
proxy.HookPacket(PacketType.CREATESUCCESS, OnEnterMap);
initialized = false;
}
开发者ID:JuixGames,项目名称:K_Relay,代码行数:7,代码来源:MapCacher.cs
示例6: Initialize
public void Initialize(Proxy proxy)
{
proxy.HookPacket(PacketType.UPDATE, OnUpdate);
proxy.HookPacket(PacketType.NEWTICK, OnUpdate);
proxy.ClientConnected += (client) => _fame.Add(client, -1);
proxy.ClientDisconnected += (client) => _fame.Remove(client);
}
开发者ID:Zeroeh,项目名称:K_Relay,代码行数:7,代码来源:FameNotifier.cs
示例7: Main
static void Main(string[] args)
{
int port;
int maxPackageLength;
var settings = Settings.Load();
ParseArgs(args, out port, out maxPackageLength);
Console.WriteLine("Ember+ Proxy v{0} (GlowDTD v{1} - EmBER v{2}) started.",
typeof(Program).Assembly.GetName().Version,
GlowReader.UshortVersionToString(EmberLib.Glow.GlowDtd.Version),
GlowReader.UshortVersionToString(EmberLib.EmberEncoding.Version));
using(var proxy = new Proxy(settings.EndPoints, maxPackageLength))
{
proxy.Connect();
using(var listener = new Provider.GlowListener(port, maxPackageLength, proxy))
{
Console.WriteLine("Listening on port {0}. Press enter to quit...", port);
Console.ReadLine();
}
}
}
开发者ID:jv42,项目名称:ember-plus,代码行数:25,代码来源:Program.cs
示例8: CreateRelationship
public Proxy.IRelationship CreateRelationship(TransactionFramework.ISoapTransactionLink transactionLink, Guid domainId, Guid rootMapId, Dictionary<Proxy.ConnectionType, Proxy.INode> nodes, Proxy.RelationshipType relationshipType, string originalId)
{
FacadeRelationship facadeRelationship = new FacadeRelationship();
InProcess.InProcessRelationship relationship = new InProcess.InProcessRelationship(MapManager);
relationship.OriginLink = transactionLink;
relationship.Facade = facadeRelationship;
relationship.Id = Guid.NewGuid();
relationship.DomainId = domainId;
relationship.RootMapId = rootMapId;
relationship.RelationshipType = relationshipType;
relationship.OriginalId = originalId;
relationship.Status = Proxy.LoadState.Full;
facadeRelationship.BaseRelationship = relationship;
foreach (KeyValuePair<Proxy.ConnectionType, Proxy.INode> relationshipContext in nodes)
{
Proxy.ConnectionSet connection = Proxy.ConnectionSetFactory.Instance.GetConnection(relationshipContext.Value, facadeRelationship, relationshipContext.Key);
Proxy.INodeManager newRelationshipNodes = relationship.Nodes;
newRelationshipNodes.Load(connection);
Proxy.IRelationshipManager nodeRelationships = relationshipContext.Value.Relationships;
nodeRelationships.Load(connection);
}
InProcessRelationships.Add(transactionLink, facadeRelationship);
return facadeRelationship;
}
开发者ID:chris-tomich,项目名称:Glyma,代码行数:31,代码来源:SoapRelationshipManager.cs
示例9: SendAndReceive
public void SendAndReceive()
{
using (var context = NetMQContext.Create())
using (var front = context.CreateRouterSocket())
using (var back = context.CreateDealerSocket())
{
front.Bind("inproc://frontend");
back.Bind("inproc://backend");
var proxy = new Proxy(front, back);
Task.Factory.StartNew(proxy.Start);
using (var client = context.CreateRequestSocket())
using (var server = context.CreateResponseSocket())
{
client.Connect("inproc://frontend");
server.Connect("inproc://backend");
client.SendFrame("hello");
Assert.AreEqual("hello", server.ReceiveFrameString());
server.SendFrame("reply");
Assert.AreEqual("reply", client.ReceiveFrameString());
}
proxy.Stop();
}
}
开发者ID:romanros,项目名称:netmq,代码行数:27,代码来源:ProxyTests.cs
示例10: Initialize
public void Initialize(Proxy proxy)
{
proxy.HookPacket<HelloPacket>(OnHelloPacket);
proxy.HookPacket<MapInfoPacket>(OnMapInfoPacket);
proxy.HookPacket<UpdatePacket>(OnUpdatePacket);
proxy.HookPacket<NewTickPacket>(OnNewTickPacket);
}
开发者ID:Zeroeh,项目名称:K_Relay,代码行数:7,代码来源:Plugin.cs
示例11: ProvideValue
public override object ProvideValue(IServiceProvider serviceProvider)
{
var pvt = serviceProvider as IProvideValueTarget;
if (pvt == null)
{
return null;
}
_frameworkElement = pvt.TargetObject as FrameworkElement;
if (_frameworkElement == null)
{
return this;
}
_target = pvt.TargetProperty as DependencyProperty;
if (_target == null)
{
return this;
}
_frameworkElement.DataContextChanged += FrameworkElement_DataContextChanged;
var proxy = new Proxy();
var binding = new Binding()
{
Source = proxy,
Path = new PropertyPath("Value")
};
// Make sure we don't leak subscriptions
_frameworkElement.Unloaded += (e, v) => _subscription.Dispose();
return binding.ProvideValue(serviceProvider);
}
开发者ID:Evangelink,项目名称:WPF-Rethought,代码行数:34,代码来源:ReactiveBinding.cs
示例12: LoginButton_Click
private void LoginButton_Click(object sender, EventArgs e)
{
var axosoftProxy = new Proxy
{
Url = Program.Settings.Url,
ClientId = Program.Settings.ClientId,
ClientSecret = Program.Settings.ClientSecret
};
try
{
axosoftProxy.ObtainAccessTokenFromUsernamePassword
(
username: LoginIdText.Text,
password: PasswordText.Text,
scope: ScopeEnum.ReadWrite
);
}
catch (AxosoftAPIException<ErrorResponse> ex)
{
MessageBox.Show(
"An error occurred when obtaining access token from Axosoft: " + ex.Message,
"Error obtaining access token",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
if (!string.IsNullOrWhiteSpace(axosoftProxy.AccessToken))
{
LoggedIn(this, new LoginEventArgs(axosoftProxy));
}
}
开发者ID:jeremysimmons,项目名称:OnTimeAPIExample,代码行数:32,代码来源:LoginControl.cs
示例13: InternetOptionsItem
public InternetOptionsItem()
{
timeout = InternetClient.DefaultTimeout;
currentEncoding = Encoding.GetEncoding("shift_jis");
boardTableSourceUrl = "http://menu.2ch.net/bbsmenu.html";
Proxy = new Proxy();
}
开发者ID:omega227,项目名称:DeanCC,代码行数:7,代码来源:InternetOptionsItem.cs
示例14: Main
static void Main(string[] args)
{
IPAddress ip = null;
int port = 0;
var p = new OptionSet()
.Add("a|address=", v => ip = IPAddress.Parse(v))
.Add("p|port=", v => port = int.Parse(v));
p.Parse(args);
var proxy = new Proxy
{
ListenToIp = ip,
ListenOnPort = port
};
proxy.Start();
Console.WriteLine("Proxy is started ans listening on {0}:{1}", proxy.ListenToIp, proxy.ListenOnPort);
Console.WriteLine("Press 'Q' to stop the proxy");
while (true)
{
if (Console.KeyAvailable)
{
var key = Console.ReadKey(true);
if (key.Key == ConsoleKey.Q)
{
proxy.Stop();
Console.WriteLine("Proxy is stopped");
break;
}
}
}
}
开发者ID:JuergenGutsch,项目名称:async-proxy,代码行数:35,代码来源:Program.cs
示例15: FrmMainMetro_Load
private async void FrmMainMetro_Load(object sender, EventArgs e)
{
Action[] workers =
{
GameData.Load,
// suppress obsolete warnings here
#pragma warning disable 618
Serializer.SerializeServers,
Serializer.SerializeGameObjects,
Serializer.SerializePacketIds,
Serializer.SerializePacketTypes,
#pragma warning restore 618
InitPackets,
InitSettings
};
await Task.Run(() =>
{
Parallel.ForEach(workers, (worker) =>
{
//try
{
worker.Invoke();
}/*
catch (Exception ex)
{
MessageBox.Show(
"There was an error while initializing K Relay.\n" +
"Please make sure:\n" +
"- All files are extracted and in the same directory\n" +
"- AntiVirus is not blocking K Relay's connection\n" +
"- Another proxy isn't running on your computer\n\n" +
"You can try to restart your computer and see if the issue is fixed.\n" +
"Additional info is as follows:\n\n" + ex,
"K Relay", MessageBoxButtons.OK, MessageBoxIcon.Error);
Environment.Exit(ex.HResult);
}*/
});
});
_proxy = new Proxy();
_proxy.ProxyListenStarted += _ => SetStatus("Running", Color.Green);
_proxy.ProxyListenStopped += _ => SetStatus("Stopped", Color.Red);
InitPlugins();
//if (Serializer.Servers.ContainsKey((string)lstServers.SelectedItem))
if (GameData.Servers.Map.Where(s => s.Value.Name == (string)lstServers.SelectedItem).Any())
//Proxy.DefaultServer = Serializer.GetServerByFullName((string)lstServers.SelectedItem);
Proxy.DefaultServer = GameData.Servers.ByName((string)lstServers.SelectedItem).Address;
else
PluginUtils.Log("K Relay", "Default server wasn't found, using USWest.");
PluginUtils.Log("K Relay", "Initialization complete.");
if (Config.Default.StartProxyByDefault)
btnToggleProxy_Click(null, null);
}
开发者ID:Zeroeh,项目名称:K_Relay,代码行数:59,代码来源:FrmMainMetro.cs
示例16: SharePointView
public SharePointView( Proxy.NavigatorRef.Item item )
{
if( item.Kind != Proxy.NavigatorRef.ItemKind.View )
throw new ArgumentException( "Item must be of ItemKind.View" );
this.guid = item.Guid;
this.title = item.Title;
this.url = item.Url;
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:8,代码来源:SharePointView.cs
示例17: CreateWindow
protected override INiIsolationClient CreateWindow()
{
var window = new Proxy(this);
ErrorUtil.ThrowOnFailure(window.Initialize());
return window;
}
开发者ID:netide,项目名称:netide,代码行数:8,代码来源:PageHost.cs
示例18: Client
public Client(Proxy proxy, TcpClient client)
{
_proxy = proxy;
_clientConnection = client;
_clientStream = _clientConnection.GetStream();
_clientConnection.NoDelay = true;
BeginRead(0, 4, true);
}
开发者ID:Zeroeh,项目名称:K_Relay,代码行数:8,代码来源:Client.cs
示例19: NodesAndRelationshipBuildEventArgs
public void NodesAndRelationshipBuildEventArgs(Proxy.NodesEventArgs eventArgs, IDictionary<Guid, ServerObjects.Node> nodes, IDictionary<Guid, ServerObjects.Relationship> relationships)
{
foreach (ServerObjects.Node serviceNode in nodes.Values)
{
Proxy.INode proxyNode = NodeManager.FindNode(serviceNode);
eventArgs.Nodes.Add(proxyNode.Id, proxyNode);
}
foreach (ServerObjects.Relationship serviceRelationship in relationships.Values)
{
RelationshipManager.CreateRelationship(serviceRelationship);
}
foreach (ServerObjects.Node serviceNode in nodes.Values)
{
Proxy.INode proxyNode = NodeManager.FindNode(serviceNode);
SoapNode soapNode = proxyNode as SoapNode;
/// Not all the nodes that are stored in the NodeManager are SoapNodes, some are FacadeNodes. In this scenario we want to check if they have an inner SoapNode and use that instead.
if (soapNode == null)
{
if (proxyNode is FacadeNode)
{
FacadeNode facadeNode = proxyNode as FacadeNode;
soapNode = facadeNode.BaseNode as SoapNode;
}
}
if (soapNode != null)
{
soapNode.LoadNode(RelationshipManager);
}
}
foreach (ServerObjects.Relationship serviceRelationship in relationships.Values)
{
Proxy.IRelationship proxyRelationship = RelationshipManager.FindRelationship(serviceRelationship);
SoapRelationship soapRelationship = proxyRelationship as SoapRelationship;
/// Not all the relationships that are stored in the RelationshipManager are SoapRelationships, some are FacadeRelationships. In this scenario we want to check if they have an inner SoapRelationship and use that instead.
if (soapRelationship == null)
{
if (proxyRelationship is FacadeRelationship)
{
FacadeRelationship facadeRelationship = proxyRelationship as FacadeRelationship;
soapRelationship = facadeRelationship.BaseRelationship as SoapRelationship;
}
}
if (soapRelationship != null)
{
soapRelationship.LoadRelationship(NodeManager);
}
}
}
开发者ID:chris-tomich,项目名称:Glyma,代码行数:58,代码来源:InMemoryGraph.cs
示例20: DocumentationTests
public DocumentationTests()
{
var processes = System.Diagnostics.Process.GetProcessesByName("Moksy.Host");
Assert.AreEqual(1, processes.Length, "Moksy.Host is not running. Right click the Moksy.Host project, add 10011 to the Debug / Command Line Arguments and then run Moksy.Host without a debugger. Then try to run this test again. ");
Proxy = new Proxy(PortNumber);
Assert.IsTrue(Proxy.Start(), string.Format("Moksy could not start. Try to manually launch 'Moksy.Host.exe {0}' from the Command Line. ", PortNumber));
Proxy.DeleteAll();
}
开发者ID:aidancasey,项目名称:Moksy,代码行数:9,代码来源:DocumentationTests.cs
注:本文中的System.Proxy类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论