public SingleStatementCodeGenerator( InsertionPoint insertionPoint, SelectionResult selectionResult, AnalyzerResult analyzerResult) : base(insertionPoint, selectionResult, analyzerResult) { }
public ExpressionCodeGenerator( InsertionPoint insertionPoint, SelectionResult selectionResult, AnalyzerResult analyzerResult) : base(insertionPoint, selectionResult, analyzerResult) { }
protected override IEnumerator OnClick() { SelectionResult result = new SelectionResult(); yield return ShowSelectionDialog("What do you like?", result, "Gamers", "Programmers", "Artists"); GameData.SetBool("clickedTester", true); GameData.SetString("food", result.Title); yield return ShowDialog("You said you like " + result.Title + "?"); }
public static bool IsExtractMethodOnSingleStatement(SelectionResult code) { var result = (CSharpSelectionResult)code; var firstStatement = result.GetFirstStatement(); var lastStatement = result.GetLastStatement(); return firstStatement == lastStatement || firstStatement.Span.Contains(lastStatement.Span); }
public static async Task<CSharpTriviaResult> ProcessAsync(SelectionResult selectionResult, CancellationToken cancellationToken) { var preservationService = selectionResult.SemanticDocument.Document.Project.LanguageServices.GetService<ISyntaxTriviaService>(); var root = selectionResult.SemanticDocument.Root; var result = preservationService.SaveTriviaAroundSelection(root, selectionResult.FinalSpan); return new CSharpTriviaResult( await selectionResult.SemanticDocument.WithSyntaxRootAsync(result.Root, cancellationToken).ConfigureAwait(false), result); }
protected override async Task<SemanticDocument> ExpandAsync(SelectionResult selection, CancellationToken cancellationToken) { var lastExpression = selection.GetFirstTokenInSelection().GetCommonRoot(selection.GetLastTokenInSelection()).GetAncestors<ExpressionSyntax>().LastOrDefault(); if (lastExpression == null) { return selection.SemanticDocument; } var newExpression = await Simplifier.ExpandAsync(lastExpression, selection.SemanticDocument.Document, n => n != selection.GetContainingScope(), expandParameter: false, cancellationToken: cancellationToken).ConfigureAwait(false); return await selection.SemanticDocument.WithSyntaxRootAsync(selection.SemanticDocument.Root.ReplaceNode(lastExpression, newExpression), cancellationToken).ConfigureAwait(false); }
protected CSharpCodeGenerator( InsertionPoint insertionPoint, SelectionResult selectionResult, AnalyzerResult analyzerResult, OptionSet options, bool localFunction) : base(insertionPoint, selectionResult, analyzerResult, options, localFunction) { Contract.ThrowIfFalse(SemanticDocument == selectionResult.SemanticDocument); var nameToken = CreateMethodName(); _methodName = nameToken.WithAdditionalAnnotations(MethodNameAnnotation); }
public static Task <AnalyzerResult> AnalyzeAsync( SelectionResult selectionResult, bool localFunction, CancellationToken cancellationToken ) { var analyzer = new CSharpAnalyzer( selectionResult, localFunction, cancellationToken ); return(analyzer.AnalyzeAsync()); }
public override SelectionResult SelectCollection(IDbHelper db, IMappingProvider mappingProvider, IDictionary <object, string> tableMapping, IQueryExpression queryExpression) { //检查pageSize和pageIndex是否合法 Util.CheckPageSizeAndPageIndex(queryExpression.PageSize, queryExpression.PageIndex); SqlAnalyseResult sqlAnalyseResult = SqlAnalyzer.Analyse(mappingProvider, queryExpression); StringBuilder sb = new StringBuilder(); IDbCommand cmd = db.Connection.CreateCommand(); int counter = 1; GenerateSelectSql_SelectFromWhereOrder(sb, cmd.Parameters, ref counter, queryExpression, sqlAnalyseResult, mappingProvider, tableMapping); //执行sql cmd.CommandText = sb.ToString(); cmd.CommandType = CommandType.Text; if (queryExpression.PageIndex != null && queryExpression.PageSize != null) { //分页的时候需要包装分页语句 WrapPaging(db, cmd, queryExpression.PageSize.Value, queryExpression.PageIndex.Value); } SelectionResult result = new SelectionResult(); result.ObjectFiller = sqlAnalyseResult.ObjectFiller; //先关闭datarader if (queryExpression.ReturnMatchedCount) { if (sqlAnalyseResult.HasGroup) { result.TotalMatchedCount = SelectCountGroup(db, mappingProvider, tableMapping, queryExpression.EntityType, queryExpression, sqlAnalyseResult); } else { result.TotalMatchedCount = SelectCount(db, mappingProvider, tableMapping, queryExpression.EntityType, queryExpression.Wheres); } } result.DataReader = db.ExecuteReader(cmd); return(result); }
protected override IEnumerator OnClick() { yield return ShowDialog("I must say I appreciate your courage to reach and face me, but now what can you do to stop me?"); SelectionResult result = new SelectionResult(); yield return ShowSelectionDialog("Shall I tell you what is real horror?", result,"Fight now","Maybe later"); if (result.Index == 0) { yield return ShowDialog("You will regret your choice, kid."); yield return ShowDialog("....My combat system is not done yet, so I'll let you go this time, but mind my words, you will not be so lucky forever!"); ShowChatText("Please hit return to exit"); } else { yield return ShowDialog("I know you kids are weak, run your ass off!"); } }
public SelectionResult CreateSelectionResult(HierarchicalViewModelBase selectedItem) { var taxon = selectedItem as TaxonViewModel; if (taxon != null) { var result = new SelectionResult(); result.DataObject = taxon; result.ObjectID = taxon.TaxaID; result.Description = taxon.TaxaFullName; result.LookupType = LookupType.Taxon; return(result); } return(null); }
public void Set_NewSelection_CallGateway() { var extension = Make_SelectionExtension(); var selection = new SelectionResult { Name = "Selection name", Items = new [] { new Item { Identifier = "1" } } }; var result = extension.Set(selection); Assert.That(result.Identifier, Is.Not.Null); Assert.That(result.Name, Is.EqualTo(result.Name)); Assert.That(result.Items.First().Identifier, Is.EqualTo(result.Items.First().Identifier)); }
protected override Task <GeneratedCode> GenerateCodeAsync( InsertionPoint insertionPoint, SelectionResult selectionResult, AnalyzerResult analyzeResult, OptionSet options, CancellationToken cancellationToken ) => CSharpCodeGenerator.GenerateAsync( insertionPoint, selectionResult, analyzeResult, options, LocalFunction, cancellationToken );
public async Task <SelectionResult> SelectAsync(string path, CancellationToken ct, bool wrapSelection = true) { try { RequestLockManager.LockAndWait(path); int i = 0; SelectionResult ret = null; for (; i < FileChain.Length; i++) { var v = await FileChain[i].TrySelectAsync(path, ct); ret = v.result; if (v.success || i >= FileChain.Length - 1) { break; } } if (wrapSelection) { switch (ret.ResultType) { case SelectionResultType.FoundCollection: ICollection collection = new RoutedCollection(this, ret.Collection); ret = SelectionResult.Create(collection); break; case SelectionResultType.FoundDocument: IDocument document = new RoutedDocument(this, ret.Document); ret = SelectionResult.Create(document.Parent, document); break; case SelectionResultType.MissingCollection: break; case SelectionResultType.MissingDocumentOrCollection: break; } } for (i--; i >= 0; i--) { await FileChain[i].TrySelectAsync_Bubbleup(path, ret, ct); } return(ret); } finally { RequestLockManager.Unlock(path); } }
private static TextLineCollectionSelection Create(TextLineCollection lines, TextSpan span, int minCount, int maxCount) { if (lines == null) { return(null); } SelectionResult result = SelectionResult.Create(lines, span, minCount, maxCount); if (!result.Success) { return(null); } return(new TextLineCollectionSelection(lines, span, result)); }
public static bool IsExtractMethodOnMultipleStatements(SelectionResult code) { var result = (CSharpSelectionResult)code; var first = result.GetFirstStatement(); var last = result.GetLastStatement(); if (first != last) { var firstUnderContainer = result.GetFirstStatementUnderContainer(); var lastUnderContainer = result.GetLastStatementUnderContainer(); Contract.ThrowIfFalse(firstUnderContainer.Parent == lastUnderContainer.Parent); return true; } return false; }
public static bool IsExtractMethodOnMultipleStatements(SelectionResult code) { var result = (CSharpSelectionResult)code; var first = result.GetFirstStatement(); var last = result.GetLastStatement(); if (first != last) { var firstUnderContainer = result.GetFirstStatementUnderContainer(); var lastUnderContainer = result.GetLastStatementUnderContainer(); Contract.ThrowIfFalse(firstUnderContainer.Parent == lastUnderContainer.Parent); return(true); } return(false); }
public ActionResult Index(SelectionResult selectionResult) { ReportTemplateResult result = ToReportTemplate(selectionResult); string shortName = DateTime.Now.ToString("yyyyMMdd-hhmmss"); string filename = HttpContext.Server.MapPath(@"~/App/temp/") + shortName + ".docx"; result.Filename = shortName; using (DocxGenerator gen = new DocxGenerator(HttpContext.Server.MapPath(@"~/App/docTemplate/选型简表结果.docx"))) { gen.AddMachinePicture(MapPath(result.MachinePicture)) .AddSimulationPictures(MapPath(result.SimulationPictures.ToArray())) .AddContent(result) .SaveAs(filename); } return(View(result)); }
public static bool IsExtractMethodOnMultipleStatements(SelectionResult code) { var result = (CSharpSelectionResult)code; var first = result.GetFirstStatement(); var last = result.GetLastStatement(); if (first != last) { var firstUnderContainer = result.GetFirstStatementUnderContainer(); var lastUnderContainer = result.GetLastStatementUnderContainer(); Contract.ThrowIfFalse(CSharpSyntaxFacts.Instance.AreStatementsInSameContainer(firstUnderContainer, lastUnderContainer)); return(true); } return(false); }
public SelectionResult CreateSelectionResult(HierarchicalViewModelBase selectedItem) { var item = selectedItem as SiteExplorerNodeViewModel; if (item == null) { return(null); } var result = new SelectionResult(); result.ObjectID = item.ElemID; result.Description = item.Name; result.DataObject = item.Model; result.LookupType = MaterialExplorer.GetLookupTypeFromNodeType(item.NodeType); return(result); }
internal void SetupFileChain(IEnumerable <IFileChain> fileChain) { FileChain = fileChain.ToArray(); for (int i = 0; i < FileChain.Length; i++) { FileChain[i].FileSystem = this; } //StructureManager = new FileSystemStructureManager(this); //StructureManager.Initilize(FileChain).RunSync(); Root = new AsyncLazy <ICollection>(async() => { SelectionResult selRes = await SelectAsync("", CancellationToken.None); return(selRes.Collection); }); }
public static async Task <CSharpTriviaResult> ProcessAsync( SelectionResult selectionResult, CancellationToken cancellationToken ) { var preservationService = selectionResult.SemanticDocument.Document.Project.LanguageServices.GetService <ISyntaxTriviaService>(); var root = selectionResult.SemanticDocument.Root; var result = preservationService.SaveTriviaAroundSelection( root, selectionResult.FinalSpan ); return(new CSharpTriviaResult( await selectionResult.SemanticDocument .WithSyntaxRootAsync(result.Root, cancellationToken) .ConfigureAwait(false), result )); }
public async Task ExecuteOnServer() { SelectionResult selection = await FileSystem.SelectAsync(EntryFullPath, CancellationToken.None); SendBytes sb = new SendBytes(Transport); if (selection.ResultType == SelectionResultType.FoundDocument) { IDocument doc = selection.Document; using (Result = await doc.OpenReadAsync(CancellationToken.None)) { Result.Position = RestartPointer; sb.Stream = Result; await sb.AwaitFlowControl(); } } else { throw new InvalidOperationException("Requested Document is not a Document!"); } }
public async Task <SelectionResult> SelectAsync(string path, CancellationToken ct) { if (string.IsNullOrEmpty(path)) { return(SelectionResult.Create(CollectionFastAccess[path])); } else if (CollectionFastAccess.ContainsKey(path)) { return(SelectionResult.Create(CollectionFastAccess[path])); } else if (CollectionFastAccess.ContainsKey(path + '\\')) { return(SelectionResult.Create(CollectionFastAccess[path + '\\'])); } else if (CollectionFastAccess.ContainsKey(path + '/')) { return(SelectionResult.Create(CollectionFastAccess[path + '/'])); } else if (DocumentFastAccess.ContainsKey(path)) { ManagedDocument manDoc = DocumentFastAccess[path]; return(SelectionResult.Create(manDoc.Parent, manDoc)); } else { string[] pathParts = path.Split('\\', '/'); int i = 0; ManagedCollection mc = Root; for (; i < pathParts.Length; i++) { ManagedCollection nmc = mc.Collections.Where(x => x.Name.Equals(pathParts[i])).SingleOrDefault(); if (nmc == null) { break; } mc = nmc; } return(SelectionResult.CreateMissingDocumentOrCollection(mc, new ArraySegment <string>(pathParts, i, pathParts.Length - i))); } }
protected override ITypeSymbol GetSymbolType(SemanticModel semanticModel, ISymbol symbol) { var selectionOperation = semanticModel.GetOperation(SelectionResult.GetContainingScope()); switch (symbol) { case ILocalSymbol localSymbol when localSymbol.NullableAnnotation == NullableAnnotation.Annotated: case IParameterSymbol parameterSymbol when parameterSymbol.NullableAnnotation == NullableAnnotation.Annotated: // For local symbols and parameters, we can check what the flow state // for refences to the symbols are and determine if we can change // the nullability to a less permissive state. var references = selectionOperation.DescendantsAndSelf() .Where(IsSymbolReferencedByOperation); if (AreAllReferencesNotNull(references)) { return(base.GetSymbolType(semanticModel, symbol).WithNullableAnnotation(NullableAnnotation.NotAnnotated)); } return(base.GetSymbolType(semanticModel, symbol)); default: return(base.GetSymbolType(semanticModel, symbol)); } bool AreAllReferencesNotNull(IEnumerable <IOperation> references) => references.All(r => semanticModel.GetTypeInfo(r.Syntax).Nullability.FlowState == NullableFlowState.NotNull); bool IsSymbolReferencedByOperation(IOperation operation) => operation switch { ILocalReferenceOperation localReference => localReference.Local.Equals(symbol), IParameterReferenceOperation parameterReference => parameterReference.Parameter.Equals(symbol), IAssignmentOperation assignment => IsSymbolReferencedByOperation(assignment.Target), _ => false }; } }
private static CSharpCodeGenerator Create( InsertionPoint insertionPoint, SelectionResult selectionResult, AnalyzerResult analyzerResult) { if (ExpressionCodeGenerator.IsExtractMethodOnExpression(selectionResult)) { return(new ExpressionCodeGenerator(insertionPoint, selectionResult, analyzerResult)); } if (SingleStatementCodeGenerator.IsExtractMethodOnSingleStatement(selectionResult)) { return(new SingleStatementCodeGenerator(insertionPoint, selectionResult, analyzerResult)); } if (MultipleStatementsCodeGenerator.IsExtractMethodOnMultipleStatements(selectionResult)) { return(new MultipleStatementsCodeGenerator(insertionPoint, selectionResult, analyzerResult)); } return(Contract.FailWithReturn <CSharpCodeGenerator>("Unknown selection")); }
public static FileSystemTarget FromSelectionResult( [NotNull] SelectionResult selectionResult, [NotNull] Uri destinationUri, [NotNull] ITargetActions <CollectionTarget, DocumentTarget, MissingTarget> targetActions) { if (selectionResult.IsMissing) { if (selectionResult.MissingNames.Count != 1) { throw new InvalidOperationException(); } return(new FileSystemTarget(destinationUri, selectionResult.Collection, selectionResult.MissingNames.Single(), targetActions)); } if (selectionResult.ResultType == SelectionResultType.FoundCollection) { return(new FileSystemTarget(destinationUri, selectionResult.Collection, targetActions)); } Debug.Assert(selectionResult.Document != null, "selectionResult.Document != null"); return(new FileSystemTarget(destinationUri, selectionResult.Document, targetActions)); }
public NetworkSelectionResult(SelectionResult selectionResult) { SelectionResultType = selectionResult.ResultType; Collection = new NetworkClientCollection(selectionResult.Collection); if (SelectionResultType == SelectionResultType.FoundDocument) { Document = new NetworkClientDocument(selectionResult.Document); } else { Document = null; } if (SelectionResultType == SelectionResultType.MissingCollection || SelectionResultType == SelectionResultType.MissingDocumentOrCollection) { MissingNames = selectionResult.MissingNames.ToArray(); } else { MissingNames = new string[0]; } }
private static CSharpCodeGenerator Create( InsertionPoint insertionPoint, SelectionResult selectionResult, AnalyzerResult analyzerResult, CSharpCodeGenerationOptions options, bool localFunction) { if (ExpressionCodeGenerator.IsExtractMethodOnExpression(selectionResult)) { return(new ExpressionCodeGenerator(insertionPoint, selectionResult, analyzerResult, options, localFunction)); } if (SingleStatementCodeGenerator.IsExtractMethodOnSingleStatement(selectionResult)) { return(new SingleStatementCodeGenerator(insertionPoint, selectionResult, analyzerResult, options, localFunction)); } if (MultipleStatementsCodeGenerator.IsExtractMethodOnMultipleStatements(selectionResult)) { return(new MultipleStatementsCodeGenerator(insertionPoint, selectionResult, analyzerResult, options, localFunction)); } throw ExceptionUtilities.UnexpectedValue(selectionResult); }
protected override Task <AnalyzerResult> AnalyzeAsync(SelectionResult selectionResult, CancellationToken cancellationToken) { return(CSharpAnalyzer.AnalyzeAsync(selectionResult, cancellationToken)); }
public SelectionStoryDialog(NPCBehavior npc, string text, SelectionResult resultRef, string[] options) : base(npc, text, true) { this.resultRef = resultRef; this.options = options; }
private static void RunInSelectionMode() { bool ifExit = false; while (!ifExit) { Console.WriteLine( "Please, specify analysis parameters"); Console.WriteLine( "Please, specify type of model selection criterion as a number from the list:\r\n" + " 0 - Maximum likelihood; \r\n" + " 1 - Maximum mutial information; \r\n" + " 2 - Logarithm maximum mutial information"); SelectionCriterionType selectionCriterionType = ParseSelectionCriterionType(Console.ReadLine()); Console.WriteLine( "Please, specify model selector type as a number from the list:\r\n" + " 0 - Simple; \r\n" + " 1 - Segment"); ModelSelectorType modelSelectorType = ParseModelSelectorType(Console.ReadLine()); int segmentSize = 100; if (modelSelectorType == ModelSelectorType.Segment) { Console.WriteLine( "Enter segment size"); segmentSize = int.Parse(Console.ReadLine()); } string pathToModelsFolder = null; while (pathToModelsFolder == null) { Console.WriteLine( "Specify path to models directory:"); pathToModelsFolder = Console.ReadLine(); } string[] files = Directory.GetFiles(pathToModelsFolder, "*.json", SearchOption.AllDirectories); Dictionary <string, string> jsonModelsToNames = files.ToDictionary(f => f, f => ParseModelFile(f)); Console.WriteLine( "Specify path to sequence file:"); List <int> sequence = null; while (sequence == null) { Console.WriteLine( "Specify path to sequence file:"); string pathToFile = Console.ReadLine(); sequence = ParseSequenceFile(pathToFile); } Console.WriteLine("Starting selection"); SelectionManager manager = new SelectionManager(segmentSize); SelectionResult result = manager.Select(jsonModelsToNames, sequence); if (result.HasErrors()) { Console.WriteLine("Selection failed due to the following errors:" + result.Errors); } else { Console.WriteLine("The model selected according to the chosen criterion is " + result.Value); } Console.WriteLine("Do you want to continue? (y/n)"); ifExit = !ParseBoolean(Console.ReadLine()); } Console.WriteLine("Press Ctrl+C to exit..."); }
void txtReference_ObjectSelected(object source, SelectionResult result) { var current = lstReferences.SelectedItem as RefLinkViewModel; if (current != null && result.ObjectID.HasValue) { current.FullRTF = ""; var searchResult = result.DataObject as ReferenceSearchResult; if (searchResult != null) { current.FullRTF = searchResult.RefRTF; } else { var service = new SupportService(User); var reference = service.GetReference(result.ObjectID.Value); if (reference != null) { current.FullRTF = reference.FullRTF; } } } }
public static bool IsExtractMethodOnExpression(SelectionResult code) { return(code.SelectionInExpression); }
private ReportTemplateResult ToReportTemplate(SelectionResult result, string workPath) { ReportTemplateResult res = new ReportTemplateResult() { MachinePicture = result.MachineType.ImgUrl, TransmissionMethod = new TransmissionMethod() { XAxis = "减速器", YAxis = "联轴器", ZAxis = "带传动" }, Components = new List <Component>(), NCSystem = result.NCSystem, ServoMotor = new ServoMotor() { XAxis = new ServoMotorAxis(), YAxis = new ServoMotorAxis(), ZAxis = new ServoMotorAxis() }, ServoDriver = new ServoDriver() { XAxis = new ServoDriverAxis(), YAxis = new ServoDriverAxis(), ZAxis = new ServoDriverAxis() }, Guide = new Guide() { XAxis = new GuideAxis(), YAxis = new GuideAxis(), ZAxis = new GuideAxis() }, BallScrew = new BallScrew() { XAxis = new BallScrewAxis(), YAxis = new BallScrewAxis(), ZAxis = new BallScrewAxis() }, SimulationPictures = new List <string>() { Path.Combine(workPath, "X-t.png"), Path.Combine(workPath, "v-t.png"), Path.Combine(workPath, "a-t.png") } }; res.Components.Add(new Component() { AxisAndName = "X轴滚珠丝杠", TypeID = result.FeedSystemX.Ballscrew.TypeID, Manufacturer = result.FeedSystemX.Ballscrew.Manufacturer }); res.Components.Add(new Component() { AxisAndName = "X轴轴承", TypeID = result.FeedSystemX.Bearings.TypeID, Manufacturer = result.FeedSystemX.Bearings.Manufacturer }); res.Components.Add(new Component() { AxisAndName = "X轴联轴器", TypeID = result.FeedSystemX.Coupling.TypeID, Manufacturer = result.FeedSystemX.Coupling.Manufacturer }); res.Components.Add(new Component() { AxisAndName = "X轴伺服驱动", TypeID = result.FeedSystemX.Driver.TypeID, Manufacturer = result.FeedSystemX.Driver.Manufacturer }); res.Components.Add(new Component() { AxisAndName = "X轴伺服电机", TypeID = result.FeedSystemX.ServoMotor.TypeID, Manufacturer = result.FeedSystemX.ServoMotor.Manufacturer }); res.Components.Add(new Component() { AxisAndName = "X轴导轨", TypeID = result.FeedSystemX.Guide.TypeID, Manufacturer = result.FeedSystemX.Guide.Manufacturer }); res.Components.Add(new Component() { AxisAndName = "Y轴滚珠丝杠", TypeID = result.FeedSystemY.Ballscrew.TypeID, Manufacturer = result.FeedSystemY.Ballscrew.Manufacturer }); res.Components.Add(new Component() { AxisAndName = "Y轴轴承", TypeID = result.FeedSystemY.Bearings.TypeID, Manufacturer = result.FeedSystemY.Bearings.Manufacturer }); res.Components.Add(new Component() { AxisAndName = "Y轴联轴器", TypeID = result.FeedSystemY.Coupling.TypeID, Manufacturer = result.FeedSystemY.Coupling.Manufacturer }); res.Components.Add(new Component() { AxisAndName = "Y轴伺服驱动", TypeID = result.FeedSystemY.Driver.TypeID, Manufacturer = result.FeedSystemY.Driver.Manufacturer }); res.Components.Add(new Component() { AxisAndName = "Y轴伺服电机", TypeID = result.FeedSystemY.ServoMotor.TypeID, Manufacturer = result.FeedSystemY.ServoMotor.Manufacturer }); res.Components.Add(new Component() { AxisAndName = "Y轴导轨", TypeID = result.FeedSystemY.Guide.TypeID, Manufacturer = result.FeedSystemY.Guide.Manufacturer }); res.Components.Add(new Component() { AxisAndName = "Z轴滚珠丝杠", TypeID = result.FeedSystemZ.Ballscrew.TypeID, Manufacturer = result.FeedSystemZ.Ballscrew.Manufacturer }); res.Components.Add(new Component() { AxisAndName = "Z轴轴承", TypeID = result.FeedSystemZ.Bearings.TypeID, Manufacturer = result.FeedSystemZ.Bearings.Manufacturer }); res.Components.Add(new Component() { AxisAndName = "Z轴联轴器", TypeID = result.FeedSystemZ.Coupling.TypeID, Manufacturer = result.FeedSystemZ.Coupling.Manufacturer }); res.Components.Add(new Component() { AxisAndName = "Z轴伺服驱动", TypeID = result.FeedSystemZ.Driver.TypeID, Manufacturer = result.FeedSystemZ.Driver.Manufacturer }); res.Components.Add(new Component() { AxisAndName = "Z轴伺服电机", TypeID = result.FeedSystemZ.ServoMotor.TypeID, Manufacturer = result.FeedSystemZ.ServoMotor.Manufacturer }); res.Components.Add(new Component() { AxisAndName = "Z轴导轨", TypeID = result.FeedSystemZ.Guide.TypeID, Manufacturer = result.FeedSystemZ.Guide.Manufacturer }); res.Guide.XAxis.SizeOfGuideFixedBolt = result.FeedSystemX.Guide.SizeOfGuideFixedBolt; res.Guide.XAxis.RollerType = result.FeedSystemX.Guide.RollerType; res.Guide.XAxis.BasicRatedDynamicLoad = result.FeedSystemX.Guide.BasicRatedDynamicLoad_C; res.Guide.XAxis.BasicRatedStaticLoad = result.FeedSystemX.Guide.BasicRatedStaticLoad_C0; res.Guide.YAxis.SizeOfGuideFixedBolt = result.FeedSystemY.Guide.SizeOfGuideFixedBolt; res.Guide.YAxis.RollerType = result.FeedSystemY.Guide.RollerType; res.Guide.YAxis.BasicRatedDynamicLoad = result.FeedSystemY.Guide.BasicRatedDynamicLoad_C; res.Guide.YAxis.BasicRatedStaticLoad = result.FeedSystemY.Guide.BasicRatedStaticLoad_C0; res.Guide.ZAxis.SizeOfGuideFixedBolt = result.FeedSystemZ.Guide.SizeOfGuideFixedBolt; res.Guide.ZAxis.RollerType = result.FeedSystemZ.Guide.RollerType; res.Guide.ZAxis.BasicRatedDynamicLoad = result.FeedSystemZ.Guide.BasicRatedDynamicLoad_C; res.Guide.ZAxis.BasicRatedStaticLoad = result.FeedSystemZ.Guide.BasicRatedStaticLoad_C0; res.ServoMotor.XAxis.RatedTorque = result.FeedSystemX.ServoMotor.RatedTorque; res.ServoMotor.XAxis.RatedSpeed = result.FeedSystemY.ServoMotor.RatedTorque; res.ServoMotor.XAxis.RatedPower = result.FeedSystemX.ServoMotor.RatedPower; res.ServoMotor.XAxis.MomentOfInertia = result.FeedSystemX.ServoMotor.MomentOfInertia; res.ServoMotor.YAxis.RatedTorque = result.FeedSystemY.ServoMotor.RatedTorque; res.ServoMotor.YAxis.RatedSpeed = result.FeedSystemY.ServoMotor.RatedTorque; res.ServoMotor.YAxis.RatedPower = result.FeedSystemY.ServoMotor.RatedPower; res.ServoMotor.YAxis.MomentOfInertia = result.FeedSystemY.ServoMotor.MomentOfInertia; res.ServoMotor.ZAxis.RatedTorque = result.FeedSystemZ.ServoMotor.RatedTorque; res.ServoMotor.ZAxis.RatedSpeed = result.FeedSystemZ.ServoMotor.RatedTorque; res.ServoMotor.ZAxis.RatedPower = result.FeedSystemZ.ServoMotor.RatedPower; res.ServoMotor.ZAxis.MomentOfInertia = result.FeedSystemZ.ServoMotor.MomentOfInertia; res.ServoDriver.XAxis.ContinuousCurrent = result.FeedSystemX.Driver.ContinuousCurrent; res.ServoDriver.XAxis.PeakCurrent = result.FeedSystemX.Driver.PeakCurrent; res.ServoDriver.XAxis.SupplyVoltage = result.FeedSystemX.Driver.SupplyVoltage; res.ServoDriver.XAxis.MaxAdaptableMotorPower = result.FeedSystemX.Driver.MaxAdaptableMotorPower; res.ServoDriver.XAxis.ExternalBrakingResistance = result.FeedSystemX.Driver.ExternalBrakingResistance; res.ServoDriver.YAxis.ContinuousCurrent = result.FeedSystemY.Driver.ContinuousCurrent; res.ServoDriver.YAxis.PeakCurrent = result.FeedSystemY.Driver.PeakCurrent; res.ServoDriver.YAxis.SupplyVoltage = result.FeedSystemY.Driver.SupplyVoltage; res.ServoDriver.YAxis.MaxAdaptableMotorPower = result.FeedSystemY.Driver.MaxAdaptableMotorPower; res.ServoDriver.YAxis.ExternalBrakingResistance = result.FeedSystemY.Driver.ExternalBrakingResistance; res.ServoDriver.ZAxis.ContinuousCurrent = result.FeedSystemZ.Driver.ContinuousCurrent; res.ServoDriver.ZAxis.PeakCurrent = result.FeedSystemZ.Driver.PeakCurrent; res.ServoDriver.ZAxis.SupplyVoltage = result.FeedSystemZ.Driver.SupplyVoltage; res.ServoDriver.ZAxis.MaxAdaptableMotorPower = result.FeedSystemZ.Driver.MaxAdaptableMotorPower; res.ServoDriver.ZAxis.ExternalBrakingResistance = result.FeedSystemZ.Driver.ExternalBrakingResistance; res.BallScrew.XAxis.NominalDiameter = result.FeedSystemX.Ballscrew.NominalDiameter_d0; res.BallScrew.XAxis.NominalLead = result.FeedSystemX.Ballscrew.NominalLead_Ph0; res.BallScrew.XAxis.BasicRatedDynamicLoad = result.FeedSystemX.Ballscrew.BasicRatedDynamicLoad_Ca; res.BallScrew.YAxis.NominalDiameter = result.FeedSystemY.Ballscrew.NominalDiameter_d0; res.BallScrew.YAxis.NominalLead = result.FeedSystemY.Ballscrew.NominalLead_Ph0; res.BallScrew.YAxis.BasicRatedDynamicLoad = result.FeedSystemY.Ballscrew.BasicRatedDynamicLoad_Ca; res.BallScrew.ZAxis.NominalDiameter = result.FeedSystemZ.Ballscrew.NominalDiameter_d0; res.BallScrew.ZAxis.NominalLead = result.FeedSystemZ.Ballscrew.NominalLead_Ph0; res.BallScrew.ZAxis.BasicRatedDynamicLoad = result.FeedSystemZ.Ballscrew.BasicRatedDynamicLoad_Ca; return(res); }
public CSharpAnalyzer(SelectionResult selectionResult, CancellationToken cancellationToken) : base(selectionResult, cancellationToken) { }
protected abstract Task<SemanticDocument> ExpandAsync(SelectionResult selection, CancellationToken cancellationToken);
protected abstract Task<GeneratedCode> GenerateCodeAsync(InsertionPoint insertionPoint, SelectionResult selectionResult, AnalyzerResult analyzeResult, CancellationToken cancellationToken);
private void btnSelect_Click(object sender, RoutedEventArgs e) { var selected = tvwMaterial.SelectedItem as SiteExplorerNodeViewModel; if (selected != null && _selectionCallback != null) { var result = new SelectionResult(); result.ObjectID = selected.ElemID; result.Description = selected.Name; _selectionCallback(result); } }
public static Task<AnalyzerResult> AnalyzeAsync(SelectionResult selectionResult, CancellationToken cancellationToken) { var analyzer = new CSharpAnalyzer(selectionResult, cancellationToken); return analyzer.AnalyzeAsync(); }
protected override async Task <TriviaResult> PreserveTriviaAsync(SelectionResult selectionResult, CancellationToken cancellationToken) { return(await CSharpTriviaResult.ProcessAsync(selectionResult, cancellationToken).ConfigureAwait(false)); }
protected override Task <MethodExtractor.GeneratedCode> GenerateCodeAsync(InsertionPoint insertionPoint, SelectionResult selectionResult, AnalyzerResult analyzeResult, CancellationToken cancellationToken) { return(CSharpCodeGenerator.GenerateAsync(insertionPoint, selectionResult, analyzeResult, cancellationToken)); }
protected abstract Task<TriviaResult> PreserveTriviaAsync(SelectionResult selectionResult, CancellationToken cancellationToken);
public IActionResult GenerateDocument([FromQuery] string fileID, [FromQuery] string userName, [FromBody] SelectionResult selectionResult) { if (string.IsNullOrEmpty(fileID) || fileID == "null") { return(BadRequest()); } if (string.IsNullOrEmpty(userName) || userName == "null") { return(BadRequest()); } string workPath = Path.Combine(_webRootPath, "Users", userName, fileID, "report"); ReportTemplateResult result = ToReportTemplate(selectionResult, workPath); string shortName = "选型结果简表"; string filename = Path.Combine(workPath, shortName + ".docx"); using (DocxGenerator gen = new DocxGenerator(MapPath(@"选型简表结果.docx"))) { gen.AddMachinePicture(MapPath(result.MachinePicture)) .AddSimulationPictures(result.SimulationPictures.ToArray()) .AddContent(result) .SaveAs(filename); } return(Created(Path.Combine("Users", userName, fileID, "report"), null)); }
protected override Task<AnalyzerResult> AnalyzeAsync(SelectionResult selectionResult, CancellationToken cancellationToken) { return CSharpAnalyzer.AnalyzeAsync(selectionResult, cancellationToken); }
public async Task <IActionResult> GenerateDocument([FromQuery] string fileID, [FromQuery] string userName, [FromBody] SelectionResult selectionResult) { if (string.IsNullOrEmpty(fileID) || fileID == "null") { return(BadRequest()); } if (string.IsNullOrEmpty(userName) || userName == "null") { return(BadRequest()); } string workPath = Path.Combine(_webRootPath, "Users", userName, fileID, "report"); ReportTemplateResult result = ToReportTemplate(selectionResult, workPath); string shortName = "选型结果简表"; string filename = Path.Combine(workPath, shortName + ".docx"); var user = await _userManager.FindByNameAsync(User.Identity.Name); string companyName = $"./images/Report/{user.Company}.png"; using (DocxGenerator gen = new DocxGenerator(MapPath(@"选型简表结果.docx"))) { gen.AddCompanyLogo(MapPath(companyName)) .AddMachinePicture(MapPath(result.MachinePicture)) .AddSimulationPictures(result.SimulationPictures.ToArray()) .AddContent(result) .SaveAs(filename); } return(Created(Path.Combine("Users", userName, fileID, "report"), null)); }
protected override async Task<TriviaResult> PreserveTriviaAsync(SelectionResult selectionResult, CancellationToken cancellationToken) { return await CSharpTriviaResult.ProcessAsync(selectionResult, cancellationToken).ConfigureAwait(false); }
protected abstract Task<AnalyzerResult> AnalyzeAsync(SelectionResult selectionResult, CancellationToken cancellationToken);
protected override Task<MethodExtractor.GeneratedCode> GenerateCodeAsync(InsertionPoint insertionPoint, SelectionResult selectionResult, AnalyzerResult analyzeResult, CancellationToken cancellationToken) { return CSharpCodeGenerator.GenerateAsync(insertionPoint, selectionResult, analyzeResult, cancellationToken); }
public static bool IsExtractMethodOnExpression(SelectionResult code) { return code.SelectionInExpression; }
public MethodExtractor(SelectionResult selectionResult) { //Contract.ThrowIfNull(selectionResult); this.OriginalSelectionResult = selectionResult; }
/// <summary> /// Show a dialog along with several options for the user to select. /// </summary> /// <param name="text"> /// A <see cref="System.String"/>, the text to display. Typically it is a question. /// </param> /// <param name="resultRef"> /// A <see cref="SelectionResult"/>, the reference to store the result. It MUST NOT be null. The caller should call new SelectionResult() first. /// </param> /// <param name="options"> /// A <see cref="System.String[]"/> /// </param> /// <returns> /// A <see cref="SelectionStoryDialog"/> /// </returns> protected SelectionStoryDialog ShowSelectionDialog(string text, SelectionResult resultRef, params string[] options) { SelectionStoryDialog dialog = new SelectionStoryDialog(this, text, resultRef, options); return dialog; }
public SelectionResult CreateSelectionResult(HierarchicalViewModelBase selectedItem) { var taxon = selectedItem as TaxonViewModel; if (taxon != null) { var result = new SelectionResult(); result.DataObject = taxon; result.ObjectID = taxon.TaxaID; result.Description = taxon.TaxaFullName; result.LookupType = LookupType.Taxon; return result; } return null; }