本文整理汇总了C#中Project类的典型用法代码示例。如果您正苦于以下问题:C# Project类的具体用法?C# Project怎么用?C# Project使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Project类属于命名空间,在下文中一共展示了Project类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateFolders
public void CreateFolders(Project currentProject, string schedule, string projectName, string relativePath)
{
//Create a File under Properties Folder which will contain information about all WebJobs
//https://github.com/ligershark/webjobsvs/issues/6
// Check if the WebApp is C# or VB
string dir = GetProjectDirectory(currentProject);
var propertiesFolderName = "Properties";
if (currentProject.CodeModel.Language == CodeModelLanguageConstants.vsCMLanguageVB)
{
propertiesFolderName = "My Project";
}
DirectoryInfo info = new DirectoryInfo(Path.Combine(dir, propertiesFolderName));
string readmeFile = Path.Combine(info.FullName, "WebJobs.xml");
// Copy File if it does not exit
if (!File.Exists(readmeFile))
AddReadMe(readmeFile);
//Add a WebJob info to it
XDocument doc = XDocument.Load(readmeFile);
XElement root = new XElement("WebJob");
root.Add(new XAttribute("Project", projectName));
root.Add(new XAttribute("RelativePath", relativePath));
root.Add(new XAttribute("Schedule", schedule));
doc.Element("WebJobs").Add(root);
doc.Save(readmeFile);
currentProject.ProjectItems.AddFromFile(readmeFile);
}
示例2: CompileProject
public static void CompileProject(Project project)
{
if (project != null && !string.IsNullOrEmpty(project.FullName))
{
Task.Run(() => Compile(project));
}
}
示例3: AddProject
public void AddProject(Project project)
{
if (ProjectAdded != null)
{
ProjectAdded(this, new ProjectEventArgs(project));
}
}
示例4: TestUndoRedoCommand
public void TestUndoRedoCommand()
{
// Arrange
var project = new Project();
var context = new BlockCommandContext(project);
ProjectBlockCollection blocks = project.Blocks;
Block block = blocks[0];
using (block.AcquireBlockLock(RequestLock.Write))
{
block.SetText("abcd");
}
int blockVersion = block.Version;
BlockKey blockKey = block.BlockKey;
var command = new InsertTextCommand(new BlockPosition(blockKey, 2), "YES");
project.Commands.Do(command, context);
project.Commands.Undo(context);
// Act
project.Commands.Redo(context);
// Assert
Assert.AreEqual(1, blocks.Count);
Assert.AreEqual(
new BlockPosition(blocks[0], 5), project.Commands.LastPosition);
const int index = 0;
Assert.AreEqual("abYEScd", blocks[index].Text);
Assert.AreEqual(blockVersion + 3, blocks[index].Version);
}
示例5: SetGenerateTypeOptions
public void SetGenerateTypeOptions(
Accessibility accessibility = Accessibility.NotApplicable,
TypeKind typeKind = TypeKind.Class,
string typeName = null,
Project project = null,
bool isNewFile = false,
string newFileName = null,
IList<string> folders = null,
string fullFilePath = null,
Document existingDocument = null,
bool areFoldersValidIdentifiers = true,
string defaultNamespace = null,
bool isCancelled = false)
{
Accessibility = accessibility;
TypeKind = typeKind;
TypeName = typeName;
Project = project;
IsNewFile = isNewFile;
NewFileName = newFileName;
Folders = folders;
FullFilePath = fullFilePath;
ExistingDocument = existingDocument;
AreFoldersValidIdentifiers = areFoldersValidIdentifiers;
DefaultNamespace = defaultNamespace;
IsCancelled = isCancelled;
}
示例6: Main
public static void Main(string[] args)
{
try
{
Project project =
new Project("My Product",
new Dir(@"%ProgramFiles%\My Company\My Product",
new File(@"AppFiles\MyApp.exe",
new FileShortcut("MyApp", @"%Desktop%") { Advertise = true }),
new ExeFileShortcut("Uninstall MyApp", "[System64Folder]msiexec.exe", "/x [ProductCode]")),
new Dir(@"%ProgramMenu%\My Company\My Product",
new ExeFileShortcut("Uninstall MyApp", "[System64Folder]msiexec.exe", "/x [ProductCode]")));
project.GUID = new Guid("6fe30b47-2577-43ad-9095-1861ba25889b");
project.UI = WUI.WixUI_ProgressOnly;
project.OutFileName = "setup";
Compiler.BuildMsi(project);
}
catch (System.Exception ex)
{
Console.WriteLine(ex.Message);
}
}
示例7: CreateItem
public async Task<ICallHierarchyMemberItem> CreateItem(ISymbol symbol,
Project project, IEnumerable<Location> callsites, CancellationToken cancellationToken)
{
if (symbol.Kind == SymbolKind.Method ||
symbol.Kind == SymbolKind.Property ||
symbol.Kind == SymbolKind.Event ||
symbol.Kind == SymbolKind.Field)
{
symbol = GetTargetSymbol(symbol);
var finders = await CreateFinders(symbol, project, cancellationToken).ConfigureAwait(false);
ICallHierarchyMemberItem item = new CallHierarchyItem(symbol,
project.Id,
finders,
() => symbol.GetGlyph().GetImageSource(GlyphService),
this,
callsites,
project.Solution.Workspace);
return item;
}
return null;
}
示例8: ProjectRemoved
private void ProjectRemoved(Project project)
{
if (project.Name == ProjectHelpers.SolutionItemsFolder)
{
DeleteSolutionSettings();
}
}
示例9: AddStorageContexts
// Generates all of the Web Forms Pages (Default Insert, Edit, Delete),
private void AddStorageContexts(
Project project,
string selectionRelativePath,
string dbContextNamespace,
string dbContextTypeName,
CodeType modelType,
bool useMasterPage,
string masterPage = null,
bool overwriteViews = true
)
{
if (modelType == null)
{
throw new ArgumentNullException("modelType");
}
var webForms = new[] { "StorageContext", "StorageContext.KeyHelpers" };
// Now add each view
foreach (string webForm in webForms)
{
AddStorageContextTemplates(
selectionRelativePath: selectionRelativePath,
modelType: modelType,
dbContextNamespace: dbContextNamespace,
dbContextTypeName: dbContextTypeName,
webFormsName: webForm,
overwrite: overwriteViews);
}
}
示例10: Deserialize
public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
{
if (dictionary != null)
{
var project = new Project();
project.Id = dictionary.GetValue<int>(RedmineKeys.ID);
project.Description = dictionary.GetValue<string>(RedmineKeys.DESCRIPTION);
project.HomePage = dictionary.GetValue<string>(RedmineKeys.HOMEPAGE);
project.Name = dictionary.GetValue<string>(RedmineKeys.NAME);
project.Identifier = dictionary.GetValue<string>(RedmineKeys.IDENTIFIER);
project.Status = dictionary.GetValue<ProjectStatus>(RedmineKeys.STATUS);
project.CreatedOn = dictionary.GetValue<DateTime?>(RedmineKeys.CREATED_ON);
project.UpdatedOn = dictionary.GetValue<DateTime?>(RedmineKeys.UPDATED_ON);
project.Trackers = dictionary.GetValueAsCollection<ProjectTracker>(RedmineKeys.TRACKERS);
project.CustomFields = dictionary.GetValueAsCollection<IssueCustomField>(RedmineKeys.CUSTOM_FIELDS);
project.IsPublic = dictionary.GetValue<bool>(RedmineKeys.IS_PUBLIC);
project.Parent = dictionary.GetValueAsIdentifiableName(RedmineKeys.PARENT);
project.IssueCategories = dictionary.GetValueAsCollection<ProjectIssueCategory>(RedmineKeys.ISSUE_CATEGORIES);
project.EnabledModules = dictionary.GetValueAsCollection<ProjectEnabledModule>(RedmineKeys.ENABLED_MODULES);
return project;
}
return null;
}
示例11: UpdateForProject
private void UpdateForProject(Project project)
{
if (lastStatuses.ContainsKey(project.Url) && lastCompletedStatuses.ContainsKey(project.Url))
{
if (lastStatuses[project.Url].IsInProgress)
{
if (project.StatusValue == BuildStatusEnum.Successful)
{
if (BuildStatusUtils.IsErrorBuild(lastCompletedStatuses[project.Url]))
{
FixedProjects.Add(project);
}
else
{
SucceedingProjects.Add(project);
}
}
else if (TreatAsFailure(project.Status))
{
if (TreatAsFailure(lastCompletedStatuses[project.Url]))
{
StillFailingProjects.Add(project);
}
else
{
FailingProjects.Add(project);
}
}
}
}
}
示例12: CheckSanity
public override void CheckSanity(Project project, Whee.WordBuilder.ProjectV2.IProjectSerializer serializer)
{
if (_Position == 0)
{
serializer.Warn("The capitalize command requires the first argument to be a non-zero integer.", this);
}
}
示例13: FindNavigableDeclaredSymbolInfosAsync
private static async Task<ImmutableArray<INavigateToSearchResult>> FindNavigableDeclaredSymbolInfosAsync(
Project project, Document searchDocument, string pattern, CancellationToken cancellationToken)
{
var containsDots = pattern.IndexOf('.') >= 0;
using (var patternMatcher = new PatternMatcher(pattern, allowFuzzyMatching: true))
{
var result = ArrayBuilder<INavigateToSearchResult>.GetInstance();
foreach (var document in project.Documents)
{
if (searchDocument != null && document != searchDocument)
{
continue;
}
cancellationToken.ThrowIfCancellationRequested();
var declarationInfo = await document.GetSyntaxTreeIndexAsync(cancellationToken).ConfigureAwait(false);
foreach (var declaredSymbolInfo in declarationInfo.DeclaredSymbolInfos)
{
cancellationToken.ThrowIfCancellationRequested();
var patternMatches = patternMatcher.GetMatches(
GetSearchName(declaredSymbolInfo),
declaredSymbolInfo.FullyQualifiedContainerName,
includeMatchSpans: true);
if (!patternMatches.IsEmpty)
{
result.Add(ConvertResult(containsDots, declaredSymbolInfo, document, patternMatches));
}
}
}
return result.ToImmutableAndFree();
}
}
示例14: Initialize
public void Initialize(
Project project,
ProjectFolder projectFolder)
{
_project = project;
_projectFolder = projectFolder;
}
示例15: MetadataDbProvider
/// <summary>
/// Constructor for the class for Epi 2000 projects
/// </summary>
/// <param name="proj">Project the metadata belongs to</param>
public MetadataDbProvider(Project proj)
{
IDbDriverFactory dbFactory = DbDriverFactoryCreator.GetDbDriverFactory(Configuration.AccessDriver);
OleDbConnectionStringBuilder cnnStrBuilder = new OleDbConnectionStringBuilder();
cnnStrBuilder.DataSource = proj.FilePath;
this.db = dbFactory.CreateDatabaseObject(cnnStrBuilder);
}