本文整理汇总了C#中Workspace.Open方法的典型用法代码示例。如果您正苦于以下问题:C# Workspace.Open方法的具体用法?C# Workspace.Open怎么用?C# Workspace.Open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Workspace
的用法示例。
在下文中一共展示了Workspace.Open方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitWorkspace
private static Workspace InitWorkspace()
{
try
{
var workspace = new Workspace();
var workspaceConnectionInfo = new WorkspaceConnectionInfo
{
Type = WorkspaceType.SQL,
Driver = ConfigHelper.GetConfig("WorkspaceDriver"),
Server = ConfigHelper.GetConfig("WorkspaceServer"),
Database = ConfigHelper.GetConfig("WorkspaceDatabase"),
Name = ConfigHelper.GetConfig("WorkspaceName"),
User = ConfigHelper.GetConfig("WorkspaceUser"),
Password = ConfigHelper.GetConfig("WorkspacePassword")
};
if (workspace.Open(workspaceConnectionInfo))
{
return workspace;
}
}
catch (Exception ex)
{
Logger.Error(string.Format("打开工作空间失败:{0}",ex));
}
return null;
}
示例2: OpenWorkspace
public Boolean OpenWorkspace(String WorkSpacePath, Workspace workspace, string password = "")
{
Boolean result = false;
try
{
WorkspaceConnectionInfo conInfo = new WorkspaceConnectionInfo(WorkSpacePath);
conInfo.Password = password;
result = workspace.Open(conInfo);
}
catch (Exception ex)
{
//Output.OutputClass.Infomation = ex.Message;
}
return result;
}
示例3: btn_Test_Click
private void btn_Test_Click(object sender, EventArgs e)
{
if(!dxValidationProvider1.Validate())
{
XtraMessageBox.Show("请填写完整信息!", "提示");
return;
}
_server = txt_WorkspaceServer.Text.Trim();
_database = txt_WorkspaceDatabase.Text.Trim();
_name = txt_WorkspaceName.Text.Trim();
_user = txt_WorkspaceUsername.Text.Trim();
_password = txt_WorkspacePassword.Text.Trim();
var workspaceConnectionInfo = new WorkspaceConnectionInfo()
{
Driver = "SQL Server",
Server = _server,
Database = _database,
Name = _name,
User = _user,
Password = _password,
Type = WorkspaceType.SQL
};
var workspace = new Workspace();
if(workspace.Open(workspaceConnectionInfo))
{
XtraMessageBox.Show("测试成功,请保存!","提示");
btn_Save.Enabled = true;
btn_Test.Enabled = false;
}else
{
XtraMessageBox.Show("配置不正确,请重新填写。","提示");
btn_Save.Enabled = false;
}
}
示例4: init
void init()
{
scon = new SceneControl();
scon.Dock = DockStyle.Fill;
this.Controls.Add(scon);
string wsPath = @"D:\模型找正面\ws.smwu";
ws = new Workspace();
WorkspaceConnectionInfo wsCon = new WorkspaceConnectionInfo()
{
Server = wsPath,
Type = WorkspaceType.SMWU
};
ws.Open(wsCon);
scon.Scene.Workspace = ws;
scon.Scene.Open(ws.Scenes[0]);
scon.Scene.EnsureVisible(scon.Scene.Layers[0]);
}
示例5: InitWorkspace
/// <summary>
/// 初始化工作空间
/// </summary>
private void InitWorkspace()
{
SplashScreenManager.ShowForm(typeof(MyWaitForm), false, true);
SplashScreenManager.Default.SetWaitFormCaption("系统初始化");
SplashScreenManager.Default.SetWaitFormDescription("正在初始化工作空间,请稍候...");
Workspace = new Workspace();
var workspaceConnectionInfo = new WorkspaceConnectionInfo
{
Type = WorkspaceType.SQL,
Driver = ConfigHelper.GetConfig("WorkspaceDriver"),
Server = ConfigHelper.GetConfig("WorkspaceServer"),
Database = ConfigHelper.GetConfig("WorkspaceDatabase"),
Name = ConfigHelper.GetConfig("WorkspaceName"),
User = ConfigHelper.GetConfig("WorkspaceUser"),
Password = ConfigHelper.GetConfig("WorkspacePassword")
};
var workspaceOpened = Workspace.Open(workspaceConnectionInfo);
SplashScreenManager.CloseForm();
if (workspaceOpened)
{
var datasoureName = ConfigHelper.GetConfig("StationDatasourceName");
if (Workspace.Datasources.Contains(datasoureName))
{
var datasource = Workspace.Datasources[datasoureName];
if (!datasource.IsConnected)
{
Workspace.Datasources.Close(datasoureName);
Workspace.Datasources.Open(CreateDatasourceConnectionInfo(datasoureName));
Workspace.Save();
}
}
else
{
var datasource = Workspace.Datasources.Open(CreateDatasourceConnectionInfo(datasoureName));
Workspace.Save();
}
}
else
{
var dlgConfigWorkspace = new DlgConfigWorkspace();
if (dlgConfigWorkspace.ShowDialog() == DialogResult.Cancel)
{
this.Close();
}
}
}
示例6: axPushButton_ClickEvent
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void axPushButton_ClickEvent( object sender, EventArgs e )
{
MessageBox.Show( "解压的可能时间比较长 请等待分钟 或更长的时间" );
if ( m_FolderBrowserDialog.ShowDialog() == DialogResult.OK )
{
for ( int i = 0; i < m_SGLEditorDocumentForm.m_SglFileInfo.SGLImage.Length; i++ )
{
SGLImage sglImage = m_SGLEditorDocumentForm.m_SglFileInfo.SGLImage[i];
for ( int i2 = 0; i2 < sglImage.SGLFrames.Length; i2++ )
{
SGLFrame sglFrame = sglImage.SGLFrames[i2];
if ( sglFrame.SGLFrameFormat11Or12Or22.DecodeFrame32Stream == null )
{
if ( sglFrame.SGLFrameFormat11Or12Or22.LoadImage() == false )
break;
else
{
Workspace workspace = new Workspace();
workspace.Open( sglFrame.SGLFrameFormat11Or12Or22.DecodeFrame32Stream );
TgaEncoder encoder = new TgaEncoder();
StringBuilder strBuilder = new StringBuilder();
strBuilder.Append( m_FolderBrowserDialog.SelectedPath );
strBuilder.Append( "\\[" );
strBuilder.Append( Path.GetFileNameWithoutExtension( m_SGLEditorDocumentForm.m_SglFileName ) );
strBuilder.Append( "]Image[" );
strBuilder.Append( i.ToString( "D5" ) );
strBuilder.Append( "]" );
strBuilder.Append( "Frame[" );
strBuilder.Append( i2.ToString( "D3" ) );
strBuilder.Append( "]" );
strBuilder.Append( "Offset[" );
strBuilder.Append( sglFrame.CenterX.ToString( "D4" ) );
strBuilder.Append( "X" );
strBuilder.Append( sglFrame.CenterY.ToString( "D4" ) );
strBuilder.Append( "]" );
strBuilder.Append( ".tga" );
string imageName = strBuilder.ToString();
workspace.Save( imageName, encoder );
}
}
}
}
MessageBox.Show( "文件全部解压完成" );
}
}
示例7: Main
static void Main(string[] args)
{
string wsPath = @"D:\模型找正面\ws.smwu";
Workspace ws = new Workspace();
WorkspaceConnectionInfo wsCon = new WorkspaceConnectionInfo()
{
Server = wsPath,
Type = WorkspaceType.SMWU
};
ws.Open(wsCon);
foreach (Datasource datasource in ws.Datasources)
{
foreach (Dataset dataset in datasource.Datasets)
{
switch (dataset.Type)
{
case DatasetType.CAD:
//case DatasetType.Model:
Console.WriteLine(dataset.Name);
Phineas p = new Phineas()
{
dv = dataset as DatasetVector
};
p.run();
break;
}
}
}
Console.Read();
}