本文整理汇总了C#中IServerConnection类的典型用法代码示例。如果您正苦于以下问题:C# IServerConnection类的具体用法?C# IServerConnection怎么用?C# IServerConnection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IServerConnection类属于命名空间,在下文中一共展示了IServerConnection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AppendUsageCommonFields
/// <summary>
/// Appends the usage common fields.
/// </summary>
/// <param name="uriBuilder">The URI.</param>
/// <param name="serverConnection">The server connection.</param>
public static void AppendUsageCommonFields(this UriBuilder uriBuilder, IServerConnection serverConnection)
{
AppendQuery(uriBuilder, StringTable.ApiKey, serverConnection.ClientId);
AppendQuery(uriBuilder, StringTable.AppName, serverConnection.AppName);
AppendQuery(uriBuilder, StringTable.Version, serverConnection.AppVersion);
AppendQuery(uriBuilder, StringTable.Udid, serverConnection.Udid);
}
示例2: HandleDrop
public bool HandleDrop(IServerConnection conn, string file, string folderId)
{
try
{
var wb = Workbench.Instance;
var exp = wb.ActiveSiteExplorer;
var fs = ObjectFactory.CreateFeatureSource(conn, "OSGeo.SQLite"); //NOXLATE
string fileName = Path.GetFileName(file);
string resName = Path.GetFileNameWithoutExtension(file);
int counter = 0;
string resId = folderId + resName + ".FeatureSource"; //NOXLATE
while (conn.ResourceService.ResourceExists(resId))
{
counter++;
resId = folderId + resName + " (" + counter + ").FeatureSource"; //NOXLATE
}
fs.ResourceID = resId;
fs.SetConnectionProperty("File", StringConstants.MgDataFilePath + fileName); //NOXLATE
conn.ResourceService.SaveResource(fs);
using (var stream = File.Open(file, FileMode.Open))
{
fs.SetResourceData(fileName, OSGeo.MapGuide.ObjectModels.Common.ResourceDataType.File, stream);
}
return true;
}
catch (Exception ex)
{
ErrorDialog.Show(ex);
return false;
}
}
示例3: EncryptingConnection
/// <summary>
/// Initialise a new <see cref="EncryptingConnection"/>.
/// </summary>
/// <param name="innerConnection">The connection for sending messages.</param>
public EncryptingConnection(IServerConnection innerConnection)
{
this.innerConnection = innerConnection;
innerConnection.SendMessageCompleted += PassOnSendMessageCompleted;
innerConnection.RequestSending += PassOnRequestSending;
innerConnection.ResponseReceived += PassOnResponseReceived;
}
示例4: HandleDrop
public bool HandleDrop(IServerConnection conn, string file, string folderId)
{
try
{
if (!MessageService.AskQuestion(Strings.ConfirmLoadPackage, Strings.Confirm))
return false;
var wb = Workbench.Instance;
var exp = wb.ActiveSiteExplorer;
var optDiag = new PackageUploadOptionDialog();
optDiag.ShowDialog();
DialogResult res;
if (optDiag.Method == PackageUploadMethod.Transactional)
{
res = PackageProgress.UploadPackage(wb, conn, file);
}
else
{
res = PackageProgress.StartNonTransactionalUploadLoop(wb, conn, file);
}
if (res == System.Windows.Forms.DialogResult.OK)
{
exp.RefreshModel(conn.DisplayName);
}
return false; //Already refreshed if successful
}
catch (Exception ex)
{
ErrorDialog.Show(ex);
return false;
}
}
示例5: HandleDrop
public bool HandleDrop(IServerConnection conn, string file, string folderId)
{
try
{
var wb = Workbench.Instance;
var exp = wb.ActiveSiteExplorer;
//The easiest way to tell if this XML file is legit
var res = ResourceTypeRegistry.Deserialize(File.ReadAllText(file));
int counter = 0;
string name = Path.GetFileNameWithoutExtension(file);
string resId = folderId + name + "." + res.ResourceType.ToString(); //NOXLATE
while (conn.ResourceService.ResourceExists(resId))
{
counter++;
resId = folderId + name + " (" + counter + ")." + res.ResourceType.ToString(); //NOXLATE
}
res.ResourceID = resId;
conn.ResourceService.SaveResource(res);
return true;
}
catch (Exception ex)
{
ErrorDialog.Show(ex);
return false;
}
}
示例6: ResourceEditorServiceBase
/// <summary>
/// Initializes a new instance of the <see cref="ResourceEditorServiceBase"/> class.
/// </summary>
/// <param name="resourceID">The resource ID.</param>
/// <param name="conn">The conn.</param>
/// <remarks>
/// The editor service does not do live edits of the resource you pass in to this constructor
///
/// When an editor is modifying a resource, it is not modifying the resource you specify here. It is instead modifying a
/// session-based copy of the resource that is created internally by the editor service. On a save action (a call to
/// <see cref="M:Maestro.Editors.ResourceEditorServiceBase.Save"/>), the session-based copy is copied back into the resource
/// id you specified, overwriting its contents and data files.
///
/// This provides an extra level of safety against unintentional edits, as such edits will only apply to the session-copy, only
/// being committed back to the resource id you specified on an explicit save action.
/// </remarks>
protected ResourceEditorServiceBase(string resourceID, IServerConnection conn)
{
this.IsNew = ResourceIdentifier.IsSessionBased(resourceID);
this.ResourceID = resourceID;
_conn = conn;
this.PreviewLocale = "en"; //NOXLATE
}
示例7: ProfilingDialog
/// <summary>
/// Initializes a new instance of the ProfilingDialog class
/// </summary>
/// <param name="item"></param>
/// <param name="resourceId"></param>
/// <param name="connection"></param>
public ProfilingDialog(IResource item, string resourceId, IServerConnection connection)
: this()
{
m_connection = connection;
m_item = item;
m_resourceId = resourceId;
}
示例8: PrepareSymbolDrawingSource
/// <summary>
/// Extracts the DWF symbol data store from the given symbol library to a new session-based drawing source
/// </summary>
/// <param name="conn"></param>
/// <param name="symResId"></param>
/// <returns></returns>
public static IDrawingSource PrepareSymbolDrawingSource(IServerConnection conn, string symResId)
{
//Extract the symbols.dwf resource data and copy to a session based drawing source
var dwf = conn.ResourceService.GetResourceData(symResId, "symbols.dwf"); //NOXLATE
if (!dwf.CanSeek)
{
//House in MemoryStream
var ms = new MemoryStream();
Utility.CopyStream(dwf, ms);
ms.Position = 0L;
//Replace old stream with new
dwf.Dispose();
dwf = ms;
}
var ds = OSGeo.MapGuide.ObjectModels.ObjectFactory.CreateDrawingSource(conn);
ds.SourceName = "symbols.dwf"; //NOXLATE
ds.ResourceID = "Session:" + conn.SessionID + "//" + Guid.NewGuid() + ".DrawingSource"; //NOXLATE
conn.ResourceService.SaveResource(ds);
using (dwf)
{
conn.ResourceService.SetResourceData(ds.ResourceID, "symbols.dwf", OSGeo.MapGuide.ObjectModels.Common.ResourceDataType.File, dwf); //NOXLATE
}
return ds;
}
示例9: ResourceEditorService
internal ResourceEditorService(string resourceID, IServerConnection conn, IUrlLauncherService launcher, ISiteExplorer siteExp, OpenResourceManager orm)
: base(resourceID, conn)
{
_siteExp = siteExp;
_launcher = launcher;
_orm = orm;
}
示例10: SymbolPicker
/// <summary>
/// Initializes a new instance of the <see cref="SymbolPicker"/> class.
/// </summary>
/// <param name="symbolLibrary">The symbol library.</param>
/// <param name="conn">The conn.</param>
public SymbolPicker(string symbolLibrary, IServerConnection conn)
: this(conn)
{
if (ResourceIdentifier.GetResourceType(symbolLibrary) != OSGeo.MapGuide.MaestroAPI.ResourceTypes.SymbolLibrary)
throw new ArgumentException(string.Format(Strings.ErrorInvalidSymbolLibraryResourceId, symbolLibrary));
txtSymbolLibrary.Text = symbolLibrary;
}
示例11: MapPreviewWindow
public MapPreviewWindow(IServerConnection conn)
{
InitializeComponent();
_conn = conn;
new MapViewerController(viewer, legend, this, propertyPane, toolbar);
this.Disposed += OnDisposed;
}
示例12: SessionTests
public SessionTests()
{
var mock = new Mock<IAuthentication>();
mock.Setup(a => a.Authenticate()).ReturnsAsync(UserInfoExample);
BasicAuthenticationMock = mock.Object;
BasicServerConnectionMock = new Mock<IServerConnection>().Object;
}
示例13: StartRequestingForFiles
public StartRequestingForFiles(
IServerConnection serverConnection,
ICurrentContext currentContext,
IEventAggregator eventAggregator)
{
_serverConnection = serverConnection;
_currentContext = currentContext;
_eventAggregator = eventAggregator;
}
示例14: ImageSymbolConverter
/// <summary>
/// Initializes a new instance of the ImageSymbolConverter class
/// </summary>
/// <param name="conn"></param>
/// <param name="symbolLibId"></param>
public ImageSymbolConverter(IServerConnection conn, string symbolLibId)
{
Check.NotNull(conn, "conn"); //NOXLATE
Check.NotEmpty(symbolLibId, "symbolLibId"); //NOXLATE
Check.Precondition(ResourceIdentifier.GetResourceType(symbolLibId) == ResourceTypes.SymbolLibrary, "ResourceIdentifier.GetResourceType(symbolLibId) == ResourceTypes.SymbolLibrary"); //NOXLATE
Check.Precondition(Array.IndexOf(conn.Capabilities.SupportedServices, (int)ServiceType.Drawing) >= 0, "Array.IndexOf(conn.Capabilities.SupportedServices, (int)ServiceType.Drawing) >= 0"); //NOXLATE
_symbolLibId = symbolLibId;
_conn = conn;
}
示例15: PackageEditorDialog
/// <summary>
/// Initializes a new instance of the <see cref="PackageEditorDialog"/> class.
/// </summary>
/// <param name="filename">The filename.</param>
/// <param name="conn">The conn.</param>
public PackageEditorDialog(string filename, IServerConnection conn)
: this()
{
_conn = conn;
m_filename = filename;
m_resources = new Dictionary<string, ResourceItem>();
ResourceTree.ImageList = RepositoryIcons.CreateImageList(); //owner.ResourceEditorMap.SmallImageList;
ResourceDataFileList.SmallImageList = RepositoryIcons.CreateImageList(); //ResourceEditors.ShellIcons.ImageList;
}