本文整理汇总了C#中IEnvironmentModel类的典型用法代码示例。如果您正苦于以下问题:C# IEnvironmentModel类的具体用法?C# IEnvironmentModel怎么用?C# IEnvironmentModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IEnvironmentModel类属于命名空间,在下文中一共展示了IEnvironmentModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SecurityViewModel
public SecurityViewModel(SecuritySettingsTO securitySettings, IResourcePickerDialog resourcePicker, DirectoryObjectPickerDialog directoryObjectPicker, IWin32Window parentWindow, IEnvironmentModel environment)
{
VerifyArgument.IsNotNull("resourcePicker", resourcePicker);
VerifyArgument.IsNotNull("directoryObjectPicker", directoryObjectPicker);
VerifyArgument.IsNotNull("parentWindow", parentWindow);
VerifyArgument.IsNotNull("environment", environment);
_resourcePicker = resourcePicker;
_directoryObjectPicker = directoryObjectPicker;
_parentWindow = parentWindow;
_environment = environment;
_directoryObjectPicker.AllowedObjectTypes = ObjectTypes.BuiltInGroups | ObjectTypes.Groups;
_directoryObjectPicker.DefaultObjectTypes = ObjectTypes.Groups;
_directoryObjectPicker.AllowedLocations = Locations.All;
_directoryObjectPicker.DefaultLocations = Locations.JoinedDomain;
_directoryObjectPicker.MultiSelect = false;
_directoryObjectPicker.TargetComputer = string.Empty;
_directoryObjectPicker.ShowAdvancedView = false;
PickWindowsGroupCommand = new DelegateCommand(PickWindowsGroup);
PickResourceCommand = new DelegateCommand(PickResource);
InitializeHelp();
InitializePermissions(securitySettings == null ? null : securitySettings.WindowsGroupPermissions);
}
示例2: SharepointServerSourceViewModel
public SharepointServerSourceViewModel(SharepointServerSource serverSource, IEnvironmentModel environment)
{
IsLoading = false;
TestComplete = false;
_environment = environment;
ServerName = "";
AuthenticationType = AuthenticationType.Windows;
IsWindows = true;
SaveCommand = new RelayCommand(o =>
{
serverSource.DialogResult = true;
serverSource.Close();
}, o => TestComplete);
CancelCommand = new RelayCommand(o =>
{
serverSource.DialogResult = false;
serverSource.Close();
});
TestCommand = new RelayCommand(o =>
{
IsLoading = true;
Dev2JsonSerializer serializer = new Dev2JsonSerializer();
var source = CreateSharepointServerSource();
var comsController = new CommunicationController { ServiceName = "TestSharepointServerService" };
comsController.AddPayloadArgument("SharepointServer", serializer.SerializeToBuilder(source));
TestResult = comsController.ExecuteCommand<string>(environment.Connection, GlobalConstants.ServerWorkspaceID);
IsLoading = false;
}, o => !TestComplete);
}
示例3: Save
/// <summary>
/// Saves the specified connection - method provided for testing.
/// </summary>
/// <param name="jsonObj"></param>
/// <param name="defaultEnvironment">The environment where the connection will be saved - must ALWAYS be .</param>
/// <exception cref="System.ArgumentNullException">connectionID</exception>
public void Save(dynamic jsonObj, IEnvironmentModel defaultEnvironment)
{
if(jsonObj == null)
{
throw new ArgumentNullException();
}
Connection newConnection = JsonConvert.DeserializeObject<Connection>(jsonObj.ToString());
var resourceId = newConnection.ResourceID;
ServerProxy connection;
if(newConnection.AuthenticationType == AuthenticationType.Windows || newConnection.AuthenticationType == AuthenticationType.Anonymous)
{
connection = new ServerProxy(new Uri(newConnection.WebAddress));
}
else
{
//
// NOTE: Public needs to drop through to User for the rest of the framework to pick up properly behind the scenes ;)
//
connection = new ServerProxy(newConnection.WebAddress, newConnection.UserName, newConnection.Password);
}
var environmentModel = CurrentEnvironmentRepository.Get(resourceId);
if(environmentModel == null)
{
var newEnvironment = new EnvironmentModel(resourceId, connection) { Name = newConnection.ResourceName, Category = newConnection.ResourcePath };
CurrentEnvironmentRepository.Save(newEnvironment);
}
else
{
environmentModel.Connection = connection;
environmentModel.Name = newConnection.ResourceName;
environmentModel.Category = newConnection.ResourcePath;
}
}
示例4: CreateModels
protected static StudioResourceRepository CreateModels(bool isChecked, out IEnvironmentModel environmentModel, out IExplorerItemModel resourceVm)
{
Mock<IContextualResourceModel> resourceModel = Dev2MockFactory.SetupResourceModelMock(ResourceType.WorkflowService, Guid.NewGuid());
var connection = new Mock<IEnvironmentConnection>();
var mockEnvironmentModel = new Mock<IEnvironmentModel>();
mockEnvironmentModel.Setup(e => e.Connection).Returns(connection.Object);
var env = Dev2MockFactory.SetupEnvironmentModel(resourceModel, new List<IResourceModel>());
env.Setup(a => a.AuthorizationService).Returns(new Mock<IAuthorizationService>().Object);
environmentModel = env.Object;
var serverItemModel = new ExplorerItemModel { DisplayName = "localhost", ResourceType = Common.Interfaces.Data.ResourceType.Server, EnvironmentId = environmentModel.ID, ResourceId = Guid.NewGuid(), ResourcePath = "" };
ExplorerItemModel workflowsFolder = new ExplorerItemModel { DisplayName = "WORKFLOWS", ResourceType = Common.Interfaces.Data.ResourceType.Folder, ResourcePath = "WORKFLOWS", ResourceId = Guid.NewGuid(), EnvironmentId = mockEnvironmentModel.Object.ID };
serverItemModel.Children.Add(workflowsFolder);
var studioResourceRepository = new StudioResourceRepository(serverItemModel, Invoke);
resourceModel.Setup(model => model.Category).Returns("WORKFLOWS\\" + resourceModel.Object.DisplayName);
TestEnvironmentRespository testEnvironmentRespository = new TestEnvironmentRespository(environmentModel);
// ReSharper disable ObjectCreationAsStatement
new EnvironmentRepository(testEnvironmentRespository);
// ReSharper restore ObjectCreationAsStatement
IEnvironmentModel internalEnvironmentModel = environmentModel;
studioResourceRepository.GetCurrentEnvironment = () => internalEnvironmentModel.ID;
studioResourceRepository.AddResouceItem(resourceModel.Object);
resourceVm = workflowsFolder.Children[0];
resourceVm.IsChecked = isChecked;
return studioResourceRepository;
}
示例5: CreateResourceModel
public static IContextualResourceModel CreateResourceModel(IEnvironmentModel environment)
{
return new ResourceModel(environment)
{
UserPermissions = Permissions.Contribute
};
}
示例6: NavigationItemViewModel
public NavigationItemViewModel(string name,
string iconPath,
NavigationItemViewModelBase parent,
object dataContext,
bool isExpanded = false,
bool isSelected = false,
string activityFullName = null,
bool isServerLevel = false,
bool isCategory = false,
IEnvironmentModel environment = null,
Func<NavigationItemViewModelBase, bool> childCountPredicate = null,
bool isChecked = false)
: base(name, iconPath, parent, dataContext, isExpanded, isSelected, childCountPredicate, isChecked)
{
ActivityFullName = activityFullName;
IsServerLevel = isServerLevel;
IsCategory = isCategory;
EnvironmentModel = environment;
DisplayName = name;
_environmentConnectedMediatorKey = Mediator.RegisterToReceiveMessage(MediatorMessages.EnvironmentConnected,
a => RaisePropertyChangedForCommands());
_environmentDisconnectedMediatorKey =
Mediator.RegisterToReceiveMessage(MediatorMessages.EnvironmentDisconnected,
a => RaisePropertyChangedForCommands());
}
示例7: Save
protected override void Save(IEnvironmentModel environmentModel, dynamic jsonObj)
{
// ReSharper disable once MaximumChainedReferences
string resName = jsonObj.resourceName;
string resCat = HelperUtils.SanitizePath((string)jsonObj.resourcePath, resName);
var dropBoxSource = new OauthSource { Key = Token, Secret = Secret, ResourceName = resName, ResourcePath = resCat, IsNewResource = true, ResourceID = Guid.NewGuid() }.ToStringBuilder();
environmentModel.ResourceRepository.SaveResource(environmentModel,dropBoxSource , GlobalConstants.ServerWorkspaceID);
}
示例8: ClientScheduledResourceModel
public ClientScheduledResourceModel([Annotations.NotNull] IEnvironmentModel model)
{
if(model == null)
{
throw new ArgumentNullException("model");
}
_model = model;
}
示例9: DropBoxUploadFileViewModel
public DropBoxUploadFileViewModel(ModelItem modelItem, IEnvironmentModel environmentModel, IEventAggregator eventPublisher)
: base(modelItem)
{
_environmentModel = environmentModel;
_eventPublisher = eventPublisher;
EditDropboxSourceCommand = new RelayCommand(o => EditDropBoxSource(), o => IsDropboxSourceSelected);
Sources = LoadOAuthSources();
SetSelectedOAuthSource(SelectedSource);
}
示例10: TestResourceModel
public TestResourceModel(IEnvironmentModel environmentModel, Guid serverID)
{
WorkflowActivity = null;
TagList = new List<string>();
Error = "";
HasErrors = false;
Environment = environmentModel;
_serverID = serverID;
}
示例11: DropBoxHelper
// ReSharper disable once TooManyDependencies
public DropBoxHelper(DropBoxViewWindow dropBoxViewWindow, IEnvironmentModel activeEnvironment, string resourceType, string resourcePath)
{
VerifyArgument.AreNotNull(new Dictionary<string, object>{{"dropBoxViewWindow",dropBoxViewWindow},{"activeEnvironment",activeEnvironment},{"resourceType",resourceType},{"resourcePath",resourcePath}});
ActiveEnvironment = activeEnvironment;
ResourceType = resourceType;
ResourcePath = resourcePath;
DropBoxViewWindow = dropBoxViewWindow;
}
示例12: UpdateSelectedServer
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Object"/> class.
/// </summary>
public UpdateSelectedServer(IEnvironmentModel environmentModel,bool isSourceServer)
{
if(environmentModel == null)
{
throw new ArgumentNullException("environmentModel");
}
EnvironmentModel = environmentModel;
IsSourceServer = isSourceServer;
}
示例13: GetDependanciesOnList
/// <summary>
/// Gets a list of dependencies for the given ResourceModel's.
/// </summary>
/// <param name="resourceModels">The resource models to get dependancies for.</param>
/// <param name="environmentModel"></param>
/// <param name="getDependsOnMe"></param>
/// <returns>
/// A list of resource name string's.
/// </returns>
public List<string> GetDependanciesOnList(List<IContextualResourceModel> resourceModels,IEnvironmentModel environmentModel,bool getDependsOnMe = false)
{
if(!resourceModels.Any() || environmentModel == null)
{
return new List<string>();
}
var result = environmentModel.ResourceRepository.GetDependanciesOnList(resourceModels, environmentModel, getDependsOnMe);
return result;
}
示例14: TestLoadEnvironmentRespository
public TestLoadEnvironmentRespository(IEnvironmentModel source, params IEnvironmentModel[] environments)
: base(source)
{
if(environments != null)
{
foreach(var environment in environments)
{
Environments.Add(environment);
}
}
}
示例15: Save
protected override void Save(IEnvironmentModel environmentModel, dynamic jsonObj)
{
// ReSharper disable once MaximumChainedReferences
string resName = jsonObj.resourceName;
string resCat = HelperUtils.SanitizePath((string)jsonObj.resourcePath, resName);
var sharepointSource = new SharepointSource { Server = Server,UserName = _userName,Password = _password,AuthenticationType = _authenticationType, ResourceName = resName, ResourcePath = resCat, IsNewResource = true, ResourceID = Guid.NewGuid() };
var source = sharepointSource.ToStringBuilder();
environmentModel.ResourceRepository.SaveResource(environmentModel, source, GlobalConstants.ServerWorkspaceID);
environmentModel.ResourceRepository.ReloadResource(sharepointSource.ResourceID, ResourceType.Source, ResourceModelEqualityComparer.Current, true);
}