public void NewItem(string name, string location, ContentItemTemplate template) { var action = new NewAction(this, name, location, template); action.Do(); _actionStack.Add(action); }
static void Main(string[] args) { //XiaozhaoAction.GetApplicantIdsByDateAndStatus(); //NewAction.Exec(); //NewAction.ExecForID(163693377); //return; Console.WriteLine("启动成功"); int Step = 1; //ShezhaoAction._exec(163764755); timer.Elapsed += (n, m) => { bool success = true; string errmsg = string.Empty; try { //上海大通校招 if (Step == 1 || Step == 4) { XiaozhaoAction.GetApplicantIdsByDateAndStatus(); } //上海大通社招 else if (Step == 2 || Step == 5) { ShezhaoAction.Exec(); } //Zoho联系人读取 else if (Step == 3 || Step == 6) { NewAction.Exec(); //code //GetZohoInfoAction.Exec(); } //系统数据监测 else { //ToZohoAction.Exec(); } } catch (Exception ex) { success = false; errmsg = ex.Message; } Console.WriteLine(DateTime.Now + "执行步骤?:" + Step + "、通过?:" + success + "、错误消息?:" + errmsg); Step = Step == 6 ? 0 : Step; Step++; }; Console.ReadKey(); }
private void cmdOK_Click(object sender, EventArgs e) { if (IfCreateNewAction) { if (NewAction.OnOK(sender, e)) { this.DialogResult = System.Windows.Forms.DialogResult.OK; } } else { if (NewTarget.OnOK(sender, e)) { this.DialogResult = System.Windows.Forms.DialogResult.OK; } } }
public void NewItem() { var path = GetFullPath(GetCurrentPath()); string name; ContentItemTemplate template; if (!View.ChooseItemTemplate(path, out template, out name)) { return; } var action = new NewAction(this, name, path, template); if (action.Do()) { _actionStack.Add(action); } }
internal static void Send(NewAction action, int delay) { DateTime time = DateTime.Now; if (!actions.Any(a => a.Id == action.Id)) { NewAction(action, time); return; } if (actions.SingleOrDefault(a => a.Id == action.Id) is NewAction currentAction) { int index = actions.IndexOf(currentAction); if ((time.Ticks - times[index].Ticks) / TimeSpan.TicksPerMillisecond > delay) { times.RemoveAt(index); actions.RemoveAt(index); NewAction(action, time); } }
public void AddAction(Object sender, EventArgs e) { if (ActionList.SelectedItem != null && ActionName.Text != "") { string locActionListID = ActionList.SelectedItem.Value; if (locActionListID == "-") { locActionListID = "0"; } if (locActionListID != "") { Database locDB = new Database(); locDB.ConectDB("AddAction( '" + (string)Session["UserName"] + "', '" + ActionName.Text + "', " + locActionListID + ")", ReaderAddAction); } if (IsOk1 == "1") { Label locError = NewAction.FindControl("Error1") as Label; locError.Visible = false; DataBind(); ActionList.DataSource = CreateActionListDataSource(); ActionList.DataBind(); /*ActionList2.DataSource = CreateActionListDataSource(); * ActionList2.DataBind(); * ActionList3.DataSource = CreateActionListDataSource(); * ActionList3.DataBind();*/ } else { Label locError = NewAction.FindControl("Error1") as Label; locError.Visible = true; DataBind(); } } }
public ActionBase(string title, string description, bool suppressHistory, bool completeImmediately, string error) { Title = title; _description = description; log.Debug(_description); if (completeImmediately) { if (!string.IsNullOrEmpty(error)) { _exception = new Exception(error); } Finished = DateTime.Now; _percentComplete = 100; _isCompleted = true; } if (!suppressHistory) { NewAction?.Invoke(this); } }
// perform post intialization protected override void OnInitialized() { base.OnInitialized(); ProductIdProperty.Editable = true; ProductIdProperty.IsKey = true; OrderQtyProperty.Editable = true; CarrierTrackingNumberProperty.Editable = true; SpecialOfferIdProperty.Editable = true; SpecialOfferIdProperty.LocalCacheLoader = new SpecialOfferProductReadListCacheLoader(ServiceProvider); SpecialOfferIdProperty.SetCacheLoaderParameters(Enumerations.SpecialOfferProduct.Parameters.ProductId, ProductIdProperty); Expression <Func <EnumIntProperty, DataRow, object> > xPrice = (prod, row) => prod.IsNull(row) ? null : prod.GetValue(row)[Enumerations.Product.Attributes.ListPrice]; UnitPriceProperty.SetComputedValue(xPrice, ProductIdProperty); Expression <Func <EnumProperty, DataRow, object> > xDiscount = (spOf, row) => spOf.IsNull(row) ? null : spOf.GetValue(row)[Enumerations.SpecialOfferProduct.Attributes.Discount]; UnitPriceDiscountProperty.SetComputedValue(xDiscount, SpecialOfferIdProperty); Expression <Func <MoneyProperty, PercentFractionProperty, SmallIntegerProperty, DataRow, decimal> > xLineTotal = (price, discount, qty, row) => GetLineTotal(price.GetValue(row), discount.GetValue(row), qty.GetValue(row)); LineTotalProperty.SetComputedValue(xLineTotal, UnitPriceProperty, UnitPriceDiscountProperty, OrderQtyProperty); // defer setting up NewAction enabling conditions until the parent is set, which it depends upon PropertyChanged += (s, e) => { if (e.PropertyName == nameof(Parent) && Parent != null) { Expression <Func <DataObject, bool> > xNewEnabled = obj => !obj.IsNew && obj.Editable; NewAction.SetComputedEnabled(xNewEnabled, Parent); } }; }
public override string ToString() { StringBuilder __sb = new StringBuilder("THCustomNotification("); bool __first = true; if (UserIds != null && __isset.userIds) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("UserIds: "); __sb.Append(UserIds); } if (__isset.action) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Action: "); __sb.Append(Action); } if (ActionData != null && __isset.actionData) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("ActionData: "); __sb.Append(ActionData); } if (Text != null && __isset.text) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Text: "); __sb.Append(Text); } if (Title != null && __isset.title) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Title: "); __sb.Append(Title); } if (Image != null && __isset.image) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Image: "); __sb.Append(Image); } if (Video != null && __isset.video) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Video: "); __sb.Append(Video); } if (TemplateName != null && __isset.templateName) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("TemplateName: "); __sb.Append(TemplateName); } if (TemplateData != null && __isset.templateData) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("TemplateData: "); __sb.Append(TemplateData); } if (NewAction != null && __isset.newAction) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("NewAction: "); __sb.Append(NewAction == null ? "<null>" : NewAction.ToString()); } if (ActionButtons != null && __isset.actionButtons) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("ActionButtons: "); __sb.Append(ActionButtons); } if (Media != null && __isset.media) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Media: "); __sb.Append(Media == null ? "<null>" : Media.ToString()); } if (PlatformMedia != null && __isset.platformMedia) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("PlatformMedia: "); __sb.Append(PlatformMedia); } if (Badge != null && __isset.badge) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Badge: "); __sb.Append(Badge == null ? "<null>" : Badge.ToString()); } if (__isset.expiration) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Expiration: "); __sb.Append(Expiration); } __sb.Append(")"); return(__sb.ToString()); }
public void Write(TProtocol oprot) { oprot.IncrementRecursionDepth(); try { TStruct struc = new TStruct("THCustomNotification"); oprot.WriteStructBegin(struc); TField field = new TField(); if (UserIds != null && __isset.userIds) { field.Name = "userIds"; field.Type = TType.List; field.ID = 1; oprot.WriteFieldBegin(field); { oprot.WriteListBegin(new TList(TType.String, UserIds.Count)); foreach (string _iter27 in UserIds) { oprot.WriteString(_iter27); } oprot.WriteListEnd(); } oprot.WriteFieldEnd(); } if (__isset.action) { field.Name = "action"; field.Type = TType.I32; field.ID = 2; oprot.WriteFieldBegin(field); oprot.WriteI32(Action); oprot.WriteFieldEnd(); } if (ActionData != null && __isset.actionData) { field.Name = "actionData"; field.Type = TType.Map; field.ID = 3; oprot.WriteFieldBegin(field); { oprot.WriteMapBegin(new TMap(TType.String, TType.String, ActionData.Count)); foreach (string _iter28 in ActionData.Keys) { oprot.WriteString(_iter28); oprot.WriteString(ActionData[_iter28]); } oprot.WriteMapEnd(); } oprot.WriteFieldEnd(); } if (Text != null && __isset.text) { field.Name = "text"; field.Type = TType.String; field.ID = 4; oprot.WriteFieldBegin(field); oprot.WriteString(Text); oprot.WriteFieldEnd(); } if (Title != null && __isset.title) { field.Name = "title"; field.Type = TType.String; field.ID = 5; oprot.WriteFieldBegin(field); oprot.WriteString(Title); oprot.WriteFieldEnd(); } if (Image != null && __isset.image) { field.Name = "image"; field.Type = TType.String; field.ID = 6; oprot.WriteFieldBegin(field); oprot.WriteString(Image); oprot.WriteFieldEnd(); } if (Video != null && __isset.video) { field.Name = "video"; field.Type = TType.String; field.ID = 7; oprot.WriteFieldBegin(field); oprot.WriteString(Video); oprot.WriteFieldEnd(); } if (TemplateName != null && __isset.templateName) { field.Name = "templateName"; field.Type = TType.String; field.ID = 8; oprot.WriteFieldBegin(field); oprot.WriteString(TemplateName); oprot.WriteFieldEnd(); } if (TemplateData != null && __isset.templateData) { field.Name = "templateData"; field.Type = TType.Map; field.ID = 9; oprot.WriteFieldBegin(field); { oprot.WriteMapBegin(new TMap(TType.String, TType.String, TemplateData.Count)); foreach (string _iter29 in TemplateData.Keys) { oprot.WriteString(_iter29); oprot.WriteString(TemplateData[_iter29]); } oprot.WriteMapEnd(); } oprot.WriteFieldEnd(); } if (NewAction != null && __isset.newAction) { field.Name = "newAction"; field.Type = TType.Struct; field.ID = 10; oprot.WriteFieldBegin(field); NewAction.Write(oprot); oprot.WriteFieldEnd(); } if (ActionButtons != null && __isset.actionButtons) { field.Name = "actionButtons"; field.Type = TType.List; field.ID = 11; oprot.WriteFieldBegin(field); { oprot.WriteListBegin(new TList(TType.Struct, ActionButtons.Count)); foreach (THActionButton _iter30 in ActionButtons) { _iter30.Write(oprot); } oprot.WriteListEnd(); } oprot.WriteFieldEnd(); } if (Media != null && __isset.media) { field.Name = "media"; field.Type = TType.Struct; field.ID = 12; oprot.WriteFieldBegin(field); Media.Write(oprot); oprot.WriteFieldEnd(); } if (PlatformMedia != null && __isset.platformMedia) { field.Name = "platformMedia"; field.Type = TType.Map; field.ID = 13; oprot.WriteFieldBegin(field); { oprot.WriteMapBegin(new TMap(TType.I32, TType.Struct, PlatformMedia.Count)); foreach (THDeviceOs _iter31 in PlatformMedia.Keys) { oprot.WriteI32((int)_iter31); PlatformMedia[_iter31].Write(oprot); } oprot.WriteMapEnd(); } oprot.WriteFieldEnd(); } if (Badge != null && __isset.badge) { field.Name = "badge"; field.Type = TType.Struct; field.ID = 14; oprot.WriteFieldBegin(field); Badge.Write(oprot); oprot.WriteFieldEnd(); } if (__isset.expiration) { field.Name = "expiration"; field.Type = TType.I32; field.ID = 15; oprot.WriteFieldBegin(field); oprot.WriteI32(Expiration); oprot.WriteFieldEnd(); } oprot.WriteFieldStop(); oprot.WriteStructEnd(); } finally { oprot.DecrementRecursionDepth(); } }
//Runs .Behaviour method for all actors and active blocks. These are stored in WrapperList public void DoTurn() { TurnCount += 1; MonoBehaviour.print("TurnCount: " + TurnCount.ToString()); int ActionCount = 0; //Used to prevent endless loop IsRunning = true; //Might read this in other scripts Action NewAction; for (RunCount = 0; RunCount < WrapperList.Count; RunCount++) //Goes through WrapperList { ObjectWrapper Wrapper = WrapperList[RunCount]; //Convenience //Remove Wrapper from list if it is empty or actor/block tiles are inconsistent. if ( (Wrapper.Actor == null && Wrapper.Block == null) || (Wrapper.Actor != null && (Wrapper.Actor.TileOfActor == null || Wrapper.Actor.TileOfActor.ActorOfTile != Wrapper.Actor)) || (Wrapper.Block != null && (Wrapper.Block.TileOfBlock == null || Wrapper.Block.TileOfBlock.BlockOfTile != Wrapper.Block)) ) { WrapperList.RemoveAt(RunCount); RunCount -= 1; continue; } //Checks if actor is set if (Wrapper.Actor != null) { ActionCount = 0; Wrapper.Actor.TurnNumber = RunCount; // Sets turn order so actor can use this information Wrapper.Actor.Energy = Wrapper.Actor.MaxEnergy; //Resets energy to max //Keep running .Behaviour untill energy runs out while (Wrapper.Actor.Energy > 0) { //Prevents endless loop, some actions might not cost energy if (ActionCount >= ActionLimit) { print("Action Count exceeded limit for " + Wrapper.Actor.Name); break; } //Runs .Behaviour to get the action the actor wants to perform NewAction = Wrapper.Actor.Behaviour(); //Checks if Actor has enought energy and nothing is preventing the action. Actors should check this themselves, this just prevents bugs if (NewAction.EnergyCost <= Wrapper.Actor.Energy && NewAction.CanActivate(Wrapper.Actor)) { //Performs the action NewAction.Activate(Wrapper.Actor); Wrapper.Actor.Energy -= NewAction.EnergyCost; } else { //Sends a message so the bug can be found print(Wrapper.Actor.Name + " instance returned action that could not be activated!"); break; } ActionCount += 1; } } //Blocks have no Action equivalent. .Behaviour does stuff itself if (Wrapper.Block != null) { Wrapper.Block.TurnNumber = RunCount; Wrapper.Block.Behaviour(); } } IsRunning = false; //Draws the room foreach (GameObject Sprite in SpriteList) { Destroy(Sprite); } SpriteList = ActiveRoom.RenderRoom(); }
public void OnNewAction(ActionEventArgs e) { NewAction?.Invoke(this, e); }
static void NewAction(NewAction action, DateTime time) { action.Action.Invoke(); times.Add(time); actions.Add(action); }
// Icon,Show Name, Full Path, TypFile public WorkspaceTree() { treeView = new TreeView(); treeView.ButtonReleaseEvent += new ButtonReleaseEventHandler(OnButtonRelease); treeView.KeyReleaseEvent += delegate(object o, KeyReleaseEventArgs args) { if (args.Event.Key == Gdk.Key.Delete) { MainClass.MainWindow.DeleteFile(); } }; //treeView.Model = modelStore = store; filter = new Gtk.TreeModelFilter(store, null); filter.VisibleFunc = new Gtk.TreeModelFilterVisibleFunc(FilterTree); treeView.Model = filter; treeView.HeadersVisible = true; //this.ExpandAll(); treeView.Selection.Mode = Gtk.SelectionMode.Single; treeView.RowActivated += OnRowActivate; treeView.Selection.Changed += OnRowSelection; treeView.ShowExpanders = true; // TreeViewColumn display_column.PackStart (text_render, true); CellRendererPixbuf crp = new CellRendererPixbuf(); crp.Ypad = 0; crp.Yalign = 0; Gtk.CellRendererText fileNameRenderer = new Gtk.CellRendererText(); fileNameRenderer.Ypad = 0; TreeViewColumn icon_column = new TreeViewColumn(); //("Icon", crp, "pixbuf", ICO_ROW); icon_column.PackStart(crp, false); icon_column.AddAttribute(crp, "pixbuf", ICO_ROW); icon_column.PackStart(fileNameRenderer, true); icon_column.AddAttribute(fileNameRenderer, "markup", NAME_ROW); treeView.AppendColumn(icon_column); //treeView.AppendColumn("Icon", crp, "pixbuf", ICO_ROW); treeView.AppendColumn("Name", fileNameRenderer, "text", NAME_ROW); treeView.Columns[NAME_ROW].Visible = false; CellRendererText textRenderer = new CellRendererText(); textRenderer.Ypad = 0; treeView.AppendColumn("FullPath", textRenderer, "text", PATH_ROW); treeView.Columns[PATH_ROW].Visible = false; treeView.HeadersVisible = false; treeView.EnableTreeLines = true; treeView.HoverExpand = false; treeView.HoverSelection = false; treeView.Columns[NAME_ROW].SetCellDataFunc(fileNameRenderer, new Gtk.TreeCellDataFunc(RenderFileNme)); sw.ShadowType = ShadowType.Out; sw.Add(treeView); this.PackEnd(sw, true, true, 0); Toolbar toolbar = new Toolbar(); refreshButton = new ToolButton("refresh.png"); //Stock.Home); refreshButton.IsImportant = true; refreshButton.Label = MainClass.Languages.Translate("menu_refresh"); refreshButton.BorderWidth = 1; refreshButton.Clicked += delegate { MainClass.MainWindow.RefreshProject(); }; toolbar.Insert(refreshButton, -1); Gtk.Menu menuAdd = new Gtk.Menu(); MenuItem mi = new MenuItem(MainClass.Languages.Translate("menu_create_file")); mi.Activated += delegate(object sender, EventArgs e) { NewAction nw = new NewAction(); nw.Activate(); }; menuAdd.Insert(mi, -1); mi = new MenuItem(MainClass.Languages.Translate("menu_create_dir")); mi.Activated += delegate(object sender, EventArgs e) { NewDirectoryAction nw = new NewDirectoryAction(); nw.Activate(); }; menuAdd.Insert(mi, -1); menuAdd.ShowAll(); mtbCreate = new MenusToolButton(menuAdd, "file-new.png"); mtbCreate.IsImportant = true; mtbCreate.Label = "Create"; toolbar.Insert(mtbCreate, -1); if (MainClass.Settings.LogicalSort == null) { MainClass.Settings.LogicalSort = LogicalSystem.GetDefaultLogicalSystem(); } Gtk.Menu menuFilter = new Gtk.Menu(); MenuItem menuItemFilter = new MenuItem(MainClass.Languages.Translate("all_files")); menuItemFilter.Activated += delegate(object sender, EventArgs e) { activetFilter = null; filter.Refilter(); treeView.QueueDraw(); }; menuFilter.Insert(menuItemFilter, -1); foreach (LogicalSystem ls in MainClass.Settings.LogicalSort) { LogicalSystem lsTemp = ls; menuItemFilter = new MenuItem(lsTemp.Display); menuItemFilter.Activated += delegate(object sender, EventArgs e) { if (lsTemp != null) { activetFilter = lsTemp; } else { activetFilter = null; } filter.Refilter(); treeView.QueueDraw(); }; menuFilter.Insert(menuItemFilter, -1); //filterModel.AppendValues(ls.Display, "", ls); } menuFilter.ShowAll(); MenusToolButton mtbFilter = new MenusToolButton(menuFilter, "filter.png"); mtbFilter.IsImportant = true; mtbFilter.Label = "Filter"; toolbar.Insert(mtbFilter, -1); this.PackStart(toolbar, false, false, 0); //this.PackStart(ComboFilter, false, false, 0); //ComboFilter.Active = 0; }