private void Source_OnCommandOutput(IOutputCommand sender, object output) { if (output is ContentData) { var content = output as ContentData; if (content.Property[Name].PropertyValueType == typeof(int)) { content.SetValue(Name, int.Parse(Value)); } else if (content.Property[Name].PropertyValueType == typeof(bool)) { content.SetValue(Name, bool.Parse(Value)); } else if (content.Property[Name].PropertyValueType == typeof(ContentReference)) { content.SetValue(Name, ContentReference.Parse(Value)); } else if (content.Property[Name].PropertyValueType == typeof(XhtmlString)) { content.SetValue(Name, new XhtmlString(Value)); } else { content.SetValue(Name, Value); } } OnCommandOutput?.Invoke(this, output); }
public void Initialize(IOutputCommand Source, params string[] parameters) { //propertyname EQUAL CONTAINS MATCH NOTEQUAL GT LT value if (Source != null) { Source.OnCommandOutput += Source_OnCommandOutput; } if (parameters.Length == 3) { Property = parameters[0]; switch (parameters[1]) { case "=": Operator = Operators.Equals; break; case "!=": Operator = Operators.NotEquals; break; case ">": Operator = Operators.GreaterThan; break; case "<": Operator = Operators.LessThan; break; default: Operator = (Operators)Enum.Parse(typeof(Operators), parameters[1], true); break; } Value = parameters[2]; if (Value == "null" && Operator == Operators.Equals) { Operator = Operators.IsNull; } if (Value == "null" && Operator == Operators.NotEquals) { Operator = Operators.IsNotNull; } } }
private void Source_OnCommandOutput(IOutputCommand sender, object output) { var content = output as IContent; var r = _repo.Save(content, Action); OnCommandOutput?.Invoke(this, r); }
private void Source_OnCommandOutput(IOutputCommand sender, object output) { if (output is IDictionary <string, object> ) { var dic = output as IDictionary <string, object>; if (ChannelName == null && dic.ContainsKey("ChannelName")) { ChannelName = dic["ChannelName"].ToString(); } if (NotificationType == null && dic.ContainsKey("NotificationType")) { ChannelName = dic["NotificationType"].ToString(); } if (Sender == null && dic.ContainsKey("Sender")) { ChannelName = dic["Sender"].ToString(); } if (Recipient == null && dic.ContainsKey("Recipient")) { ChannelName = dic["Recipient"].ToString(); } if (Subject == null && dic.ContainsKey("Subject")) { ChannelName = dic["Subject"].ToString(); } if (Content == null && dic.ContainsKey("Content")) { ChannelName = dic["Content"].ToString(); } } else if (Content != null) { Content = output.ToString(); } }
private void cartLookup_ButtonClick(object sender, ButtonPressedEventArgs e) { if (e.Button.Kind == ButtonPredefines.Plus) { // TODO: Move to service layer ToteCreateCommandArguments args = new ToteCreateCommandArguments(m_purchaseOrder.Session, ToteType.Cart); IOutputCommand <Tote> command = m_frontController .RunCommand(ToteCommands.ToteCreate, args) as IOutputCommand <Tote>; //---> if (command != null && command.Output != null) { LoadCartList(); cartLookup.EditValue = command.Output; } return; } if (e.Button.Kind == ButtonPredefines.Redo) { LoadCartList(); return; } }
private void Source_OnCommandOutput(IOutputCommand sender, object output) { if (output is string) { if (contents == null) { contents = new List <string>(); } contents.Add(output as string); } else if (output is IDictionary <string, object> ) { //Check for contents and create attachment var dic = output as IDictionary <string, object>; if (dic.ContainsKey("Contents")) { var content = (dic["Contents"] is List <string>) ? string.Join("\n", (dic["Contents"] as List <string>).ToArray()) : dic["Contents"] as string; var file = new TransferFile(); file.FileName = FileName ?? GenerateFileName(); file.Mimetype = Mimetype ?? "text/plain"; file.Data = UTF8Encoding.UTF8.GetBytes(content); dic["Attachment"] = file; OnCommandOutput?.Invoke(this, dic); } } }
private void Source_OnCommandOutput(IOutputCommand sender, object output) { if (output is TransferFile) { transferFile = output as TransferFile; } }
public override void Draw(IOutputCommand output, DrawState state, object param) { int radius = 10; base.Draw(output, state, param); Point3D ptFrom = CalculatedEndPosition; output.DrawEllipse(this, param, Convert(MoveType.Normal, state), ptFrom, radius, radius); }
public static async Task <bool> TryWriteFileOutputAsync(this IOutputCommand command, string path, IConsoleHost host, Func <string> generator) { if (!string.IsNullOrEmpty(path)) { var directory = DynamicApis.PathGetDirectoryName(path); if (!string.IsNullOrEmpty(directory) && await DynamicApis.DirectoryExistsAsync(directory).ConfigureAwait(false) == false) { await DynamicApis.DirectoryCreateDirectoryAsync(directory).ConfigureAwait(false); } var data = generator(); if (!await DynamicApis.FileExistsAsync(path) || await DynamicApis.FileReadAllTextAsync(path) != data) { await DynamicApis.FileWriteAllTextAsync(path, data).ConfigureAwait(false); host?.WriteMessage("Code has been successfully written to file.\n"); } else { host?.WriteMessage("Code has been successfully generated but not written to file (no change detected).\n"); } return(true); } return(false); }
public void Initialize(IOutputCommand Source, params string[] parameters) { if (Source != null) { Source.OnCommandOutput += Source_OnCommandOutput; } }
public static Task <bool> TryWriteFileOutputAsync(this IOutputCommand command, string path, IConsoleHost host, NewLineBehavior newLineBehavior, Func <string> generator) { if (!string.IsNullOrEmpty(path)) { var directory = DynamicApis.PathGetDirectoryName(path); if (!string.IsNullOrEmpty(directory) && DynamicApis.DirectoryExists(directory) == false) { DynamicApis.DirectoryCreateDirectory(directory); } var data = generator(); data = data?.Replace("\r", "") ?? ""; data = newLineBehavior == NewLineBehavior.Auto ? data.Replace("\n", Environment.NewLine) : newLineBehavior == NewLineBehavior.CRLF ? data.Replace("\n", "\r\n") : data; if (!DynamicApis.FileExists(path) || DynamicApis.FileReadAllText(path) != data) { DynamicApis.FileWriteAllText(path, data); host?.WriteMessage("Code has been successfully written to file.\n"); } else { host?.WriteMessage("Code has been successfully generated but not written to file (no change detected).\n"); } return(Task.FromResult(true)); } return(Task.FromResult(false)); }
private void Source_OnCommandOutput(IOutputCommand sender, object output) { ContentReference cr = (output.GetType() == typeof(ContentReference)) ? (ContentReference)output : ContentReference.Parse(output.ToString()); var c = _repo.Get <IContent>(cr); OnCommandOutput?.Invoke(this, c); }
public string GetInput(string inputMessage, bool required) { IOutputCommand <string> command = FrontController.GetInstance().RunCommand ("input.userinput", inputMessage, required) as IOutputCommand <string>; return(command.Output); }
private void Source_OnCommandOutput(IOutputCommand sender, object output) { _seen++; if (_seen > Count) { OnCommandOutput?.Invoke(this, output); } }
private void Source_OnCommandOutput(IOutputCommand sender, object output) { if (!(output is IEnumerable)) { throw (new ApplicationException("Received input is not a list")); } //TODO: Sort on a named field }
public void Initialize(IOutputCommand Source, params string[] parameters) { if (string.IsNullOrEmpty(Format) && parameters.Length > 0) { Format = parameters.First(); } Source.OnCommandOutput += Source_OnCommandOutput; }
public void Initialize(IOutputCommand Source, params string[] parameters) { Source.OnCommandOutput += Source_OnCommandOutput; //if(string.IsNullOrEmpty(Key) && parameters.Length > 0) //{ // Key = parameters.First(); //} }
private void Source_OnCommandOutput(IOutputCommand sender, object output) { if (_taken < Count) { OnCommandOutput?.Invoke(this, output); _taken++; } }
public override void Draw(IOutputCommand output, CommandState state, object param) { if (state.UseLaser == false && string.IsNullOrEmpty(GCodeAdd) == false && GCodeAdd.StartsWith("; LaserOnCommand")) { state.UseLaser = true; } base.Draw(output, state, param); }
public override void Draw(IOutputCommand output, CommandState state, object param) { int radius = 10; base.Draw(output, state, param); Point3D ptFrom = CalculatedEndPosition; output.DrawEllipse(this, param, Convert(CommandMoveType.Normal, state), ptFrom, radius, radius); }
private void Source_OnCommandOutput(IOutputCommand sender, object output) { if (output is IEnumerable) { foreach (var o in (output as IEnumerable)) { OnCommandOutput?.Invoke(this, o); } } }
private void Source_OnCommandOutput(IOutputCommand sender, object output) { if (output is IDictionary <string, object> ) { _dictionary = output as IDictionary <string, object>; } else { _value = output; } }
private void Source_OnCommandOutput(IOutputCommand sender, object output) { if (output is ContentReference) { Copy((ContentReference)output); } else if (output is IContent) { Copy((output as IContent).ContentLink); } }
private void Source_OnCommandOutput(IOutputCommand sender, object output) { string json = JsonConvert.SerializeObject(output, new JsonSerializerSettings() { ReferenceLoopHandling = ReferenceLoopHandling.Ignore, NullValueHandling = NullValueHandling.Ignore, Formatting = Formatting.Indented }); OnCommandOutput?.Invoke(this, json); }
public void Initialize(IOutputCommand Source, params string[] parameters) { _seen = 0; if (parameters.Length == 1) { Count = int.Parse(parameters[0]); } if (Source != null) { Source.OnCommandOutput += Source_OnCommandOutput; } }
private void Source_OnCommandOutput(IOutputCommand sender, object output) { if (output is ContentReference) { LookupSoftlinks((ContentReference)output); } if (output is IContent) { LookupSoftlinks(((IContent)output).ContentLink); } //if(output is IDictionary<string,object>) }
public void Initialize(IOutputCommand Source, params string[] parameters) { if (parameters.Length > 0 && string.IsNullOrEmpty(Property)) { properties = parameters.ToList(); } else if (!string.IsNullOrEmpty(Property)) { properties = Property.Split(',').ToList(); } Source.OnCommandOutput += Source_OnCommandOutput; }
private void Source_OnCommandOutput(IOutputCommand sender, object output) { if (output is IDictionary <string, object> ) { var dic = output as IDictionary <string, object>; if (dic.ContainsKey("FromEmail")) { FromEmail = (string)dic["FromEmail"]; } if (dic.ContainsKey("FromName")) { FromName = (string)dic["FromName"]; } if (dic.ContainsKey("ToEmail")) { ToEmail = (string)dic["ToEmail"]; } if (dic.ContainsKey("ToName")) { ToEmail = (string)dic["ToName"]; } if (dic.ContainsKey("Attachment")) { _attachment = (TransferFile)dic["Attachement"]; } if (dic.ContainsKey("Subject")) { Subject = (string)dic["Subject"]; } if (dic.ContainsKey("Body")) { Body = (string)dic["Body"]; } } else if (output is string) { if (string.IsNullOrEmpty(Subject)) { Subject = output as string; } else if (string.IsNullOrEmpty(Body)) { Body = output as string; } } else if (output is TransferFile) { _attachment = output as TransferFile; } SendEmail(); }
private void Source_OnCommandOutput(IOutputCommand sender, object output) { object val = output; if (!string.IsNullOrEmpty(Property)) { val = FetchSingleProperty(output, Property); } //Evalutate if (((val is IList <object>) && (val as IList <object>).Any(o => Evaluate(o))) || Evaluate(val)) { OnCommandOutput?.Invoke(this, output); } }
public override void Draw(IOutputCommand output, DrawState state, object param) { double I, J; if (!TryGetVariable('I', out I)) { I = 0; } if (!TryGetVariable('J', out J)) { J = 0; } output.DrawArc(this,param, Convert(Movetype, state), CalculatedStartPosition, CalculatedEndPosition,new Framework.Tools.Drawing.Point3D() { X=I, Y=J},true); }
private void Source_OnCommandOutput(IOutputCommand sender, object output) { if (_type == null) { return; } bool isit = _type.IsAssignableFrom(output.GetType()); bool rt = (_not) ? !isit : isit; if (rt) { OnCommandOutput?.Invoke(this, output); } }
private void Source_OnCommandOutput(IOutputCommand sender, object output) { //accepts strings with urls string success = DownloadAsset((string)output); if (success == null) { OutputToConsole?.Invoke(this, $"Successfully downloaded asset {(string)output}"); } else { OutputToConsole?.Invoke(this, $"Failed to download asset {Url} with error: {success}"); } }
public override void Draw(IOutputCommand output, DrawState state, object param) { //base.Draw(output, state, param); state.LaserOn = false; state.UseLaser = true; }
public virtual void Draw(IOutputCommand output, DrawState state, object param) { output.DrawLine(this, param, Convert(Movetype, state), CalculatedStartPosition, CalculatedEndPosition); }