コード例 #1
0
ファイル: ActionsController.cs プロジェクト: nozerowu/ABP
        public ActionResult Create(ActionEntry model)
        {
            var info = _action.GetByCode(model.ActionCode);

            if (info != null && info.ActionCode == model.ActionCode)
            {
                ModelState.AddModelError("ActionCode", string.Format("{0} has been used, please change one.", "Action Code"));
            }

            if (ModelState.IsValid)
            {
                model.CreatedBy = Utility.CurrentUserName;
                model.CreatedTime = DateTime.UtcNow;
                Utility.Operate(this, Operations.Add, () =>
                {
                    _cache.Remove(Constants.CACHE_KEY_ACTIONS);
                    return _action.Add(model);
                }, model.DisplayName);
            }
            else
            {
                Utility.SetErrorModelState(this);
            }

            return Redirect("~/Admin/Actions/Index");
        }
コード例 #2
0
        internal ActionEntryExternalHelper(ActionEntry entry, MethodInfo methodInfo)
        {
            System.Diagnostics.Debug.Assert( entry != null, "Missing parameter 'entry'" );
            System.Diagnostics.Debug.Assert( methodInfo != null, "Missing parameter 'methodInfo'" );
            System.Diagnostics.Debug.Assert( entry != null, "Missing parameter 'entry'" );

            Entry = entry;
            CallerProcess = Process.GetCurrentProcess();

            var procInfo = new System.Diagnostics.ProcessStartInfo();
            procInfo.UseShellExecute = false;
            //procInfo.RedirectStandardError = true;
            procInfo.RedirectStandardOutput = true;
            procInfo.RedirectStandardInput = true;
            procInfo.WorkingDirectory = Environment.CurrentDirectory;
            procInfo.FileName = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName.Replace( ".vshost"/*c.f. VisualStudio debugger*/, "" );
            procInfo.Arguments = ARGUMENT;
            procInfo.Verb = "runas";

            Process = new System.Diagnostics.Process();
            Process.StartInfo = procInfo;
            Process.OutputDataReceived += (sender,args)=>entry.ThreadDispatch( ()=>Process_OutputDataReceived(args.Data) );
            var rc = Process.Start();
            System.Diagnostics.Debug.Assert( rc == true, "Process.Start() returned false" );
            StreamOut = Process.StandardInput;
            //StreamIn = Process.StandardOutput;  <= Using async reads with BeginOutputReadLine() instead
            Process.BeginOutputReadLine();

            // Send the method to execute
            var msg = new Dictionary<string,object>();
            msg[ MSG_METHODTYPE ] = methodInfo.DeclaringType.AssemblyQualifiedName;
            msg[ MSG_METHODNAME ] = methodInfo.Name;
            SendMessage( msg );
        }
コード例 #3
0
		private void okButton_Click(object sender, EventArgs e)
		{
			ActionEntry = new ActionEntry();
			ActionEntry.actionParam = this.parameterTextBox.Text;
			if (this.actionDict.ContainsKey((string)this.actionComboBox.SelectedItem))
			{
				ActionEntry.pluginName = (string)this.actionComboBox.SelectedItem;
			}
		}
コード例 #4
0
            public void SetFixedFieldData(int mapCategoryId, int actionId, AxisRange axisRange, ControllerType controllerType, int controllerId)
            {
                ActionEntry entry = GetActionEntry(mapCategoryId, actionId, axisRange);

                if (entry == null)
                {
                    return;
                }
                entry.SetFixedFieldData(controllerType, controllerId);
            }
コード例 #5
0
            public void PopulateField(int mapCategoryId, int actionId, AxisRange axisRange, ControllerType controllerType, int controllerId, int index, int actionElementMapId, string label, bool invert)
            {
                ActionEntry entry = GetActionEntry(mapCategoryId, actionId, axisRange);

                if (entry == null)
                {
                    return;
                }
                entry.PopulateField(controllerType, controllerId, index, actionElementMapId, label, invert);
            }
コード例 #6
0
            public void SetLabel(int mapCategoryId, int actionId, AxisRange axisRange, ControllerType controllerType, int index, string label)
            {
                ActionEntry entry = GetActionEntry(mapCategoryId, actionId, axisRange);

                if (entry == null)
                {
                    return;
                }
                entry.SetFieldLabel(controllerType, index, label);
            }
コード例 #7
0
            public GUIInputField GetGUIInputField(int mapCategoryId, int actionId, AxisRange axisRange, ControllerType controllerType, int fieldIndex)
            {
                ActionEntry actionEntry = GetActionEntry(mapCategoryId, actionId, axisRange);

                if (actionEntry == null)
                {
                    return(null);
                }
                return(actionEntry.GetGUIInputField(controllerType, fieldIndex));
            }
コード例 #8
0
            public bool Contains(int mapCategoryId, int actionId, AxisRange axisRange, ControllerType controllerType, int fieldIndex)
            {
                ActionEntry actionEntry = GetActionEntry(mapCategoryId, actionId, axisRange);

                if (actionEntry == null)
                {
                    return(false);
                }
                return(actionEntry.Contains(controllerType, fieldIndex));
            }
コード例 #9
0
            public void AddInputField(int mapCategoryId, InputAction action, AxisRange axisRange, ControllerType controllerType, int fieldIndex, GUIInputField inputField)
            {
                ActionEntry actionEntry = GetActionEntry(mapCategoryId, action, axisRange);

                if (actionEntry == null)
                {
                    return;
                }
                actionEntry.AddInputField(controllerType, fieldIndex, inputField);
            }
コード例 #10
0
ファイル: HilightDialog.cs プロジェクト: x2f/logexpert
        private void pluginButton_Click(object sender, EventArgs e)
        {
            KeywordActionDlg dlg = new KeywordActionDlg(this.currentActionEntry, this.KeywordActionList);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                this.currentActionEntry = dlg.ActionEntry;
                Dirty();
            }
        }
コード例 #11
0
            public void AddInputFieldSet(int mapCategoryId, InputAction action, AxisRange axisRange, ControllerType controllerType, GameObject fieldSetContainer)
            {
                ActionEntry actionEntry = GetActionEntry(mapCategoryId, action, axisRange);

                if (actionEntry == null)
                {
                    return;
                }
                actionEntry.AddInputFieldSet(controllerType, fieldSetContainer);
            }
コード例 #12
0
ファイル: ActionEntryTest.cs プロジェクト: kameske/WodiLib
        public static void SerializeTest()
        {
            var target = new ActionEntry
            {
                IsWaitForComplete = true,
                IsRepeatAction    = true,
            };
            var clone = DeepCloner.DeepClone(target);

            Assert.IsTrue(clone.Equals(target));
        }
コード例 #13
0
 private Node ConnectEntry(Node source, Entry entry)
 {
     return(entry switch
     {
         MatchEntry matchEntry => ConnectMatch(source, matchEntry),
         StateEntry stateEntry => ConnectState(source, stateEntry, stateEntry.State.Inline || Automata.ForceInlineAll),
         QuantifierEntry quantifierEntry => ConnectQuantifier(source, quantifierEntry),
         PredicateEntryBase predicateEntry => ConnectPredicate(source, predicateEntry),
         ActionEntry actionEntry => ConnectAction(source, actionEntry),
         EpsilonEntry _ => source,
         _ => throw new ArgumentOutOfRangeException(nameof(entry))
     });
コード例 #14
0
        public string Print()
        {
            string TableOut = ms_Seperator;

            for (int i = 0; i < m_Signs.Count; i++)
            {
                RuleElement re = (RuleElement)m_Signs[i];
                TableOut += re.GetToken() + ms_Seperator;
            }

            TableOut += "\n";

            for (int i = 0; i < m_rows; i++)
            {
                TableOut += i + ms_Seperator;
                for (int j = 0; j < m_Signs.Count; j++)
                {
                    RuleElement re = (RuleElement)m_Signs[j];

                    ActionEntry ae = Get(re, i);
                    if (ae == null)
                    {
                        TableOut += ms_Seperator;
                    }
                    else
                    {
                        if (ae.GetAction == Actions.SHIFT)
                        {
                            TableOut += "s " + ae.NextState + ms_Seperator;
                        }
                        else if (ae.GetAction == Actions.REDUCE)
                        {
                            TableOut += "r " + ae.NextState + ms_Seperator;
                        }
                        else if (ae.GetAction == Actions.JUMP)
                        {
                            TableOut += ae.NextState + ms_Seperator;
                        }
                        else if (ae.GetAction == Actions.ACCEPT)
                        {
                            TableOut += "acc" + ms_Seperator;
                        }
                        else
                        {
                        }
                    }
                }
                TableOut += "\n";
            }

            return(TableOut);
        }
コード例 #15
0
        void AddActions()
        {
            ActionEntry[] actions = new ActionEntry[]
            {
                new ActionEntry("FileMenu", null, "_File", null, null, null),
                new ActionEntry("PreferencesMenu", null, "_Preferences", null, null, null),
                new ActionEntry("ColorMenu", null, "_Color", null, null, null),
                new ActionEntry("ShapeMenu", null, "_Shape", null, null, null),
                new ActionEntry("HelpMenu", null, "_Help", null, null, null),
                new ActionEntry("New", Stock.New, "_New", "<control>N", "Create a new file", new EventHandler(ActionActivated)),
                new ActionEntry("Open", Stock.Open, "_Open", "<control>O", "Open a file", new EventHandler(ActionActivated)),
                new ActionEntry("Save", Stock.Save, "_Save", "<control>S", "Save current file", new EventHandler(ActionActivated)),
                new ActionEntry("SaveAs", Stock.SaveAs, "Save _As", null, "Save to a file", new EventHandler(ActionActivated)),
                new ActionEntry("Quit", Stock.Quit, "_Quit", "<control>Q", "Quit", new EventHandler(ActionActivated)),
                new ActionEntry("About", null, "_About", "<control>A", "About", new EventHandler(ActionActivated)),
                new ActionEntry("Logo", "demo-gtk-logo", null, null, "Gtk#", new EventHandler(ActionActivated))
            };

            ToggleActionEntry[] toggleActions = new ToggleActionEntry[]
            {
                new ToggleActionEntry("Bold", Stock.Bold, "_Bold", "<control>B", "Bold", new EventHandler(ActionActivated), true)
            };

            RadioActionEntry[] colorActions = new RadioActionEntry[]
            {
                new RadioActionEntry("Red", null, "_Red", "<control>R", "Blood", (int)Color.Red),
                new RadioActionEntry("Green", null, "_Green", "<control>G", "Grass", (int)Color.Green),
                new RadioActionEntry("Blue", null, "_Blue", "<control>B", "Sky", (int)Color.Blue)
            };

            RadioActionEntry[] shapeActions = new RadioActionEntry[]
            {
                new RadioActionEntry("Square", null, "_Square", "<control>S", "Square", (int)Shape.Square),
                new RadioActionEntry("Rectangle", null, "_Rectangle", "<control>R", "Rectangle", (int)Shape.Rectangle),
                new RadioActionEntry("Oval", null, "_Oval", "<control>O", "Egg", (int)Shape.Oval)
            };

            ActionGroup group = new ActionGroup("AppWindowActions");

            group.Add(actions);
            group.Add(toggleActions);
            group.Add(colorActions, (int)Color.Red, new ChangedHandler(RadioActionActivated));
            group.Add(shapeActions, (int)Shape.Square, new ChangedHandler(RadioActionActivated));

            UIManager uim = new UIManager();

            uim.InsertActionGroup(group, 0);
            uim.AddWidget += new AddWidgetHandler(AddWidget);
            uim.AddUiFromString(uiInfo);

            AddAccelGroup(uim.AccelGroup);
        }
コード例 #16
0
ファイル: EditOperationsPlugin.cs プロジェクト: switsys/bless
        private void AddActions(UIManager uim)
        {
            ActionEntry[] actionEntries = new ActionEntry[] {
                new ActionEntry("CutAction", Stock.Cut, null, "<control>X", null,
                                new EventHandler(OnCutActivated)),
                new ActionEntry("CopyAction", Stock.Copy, null, "<control>C", "Copy",
                                new EventHandler(OnCopyActivated)),
                new ActionEntry("PasteAction", Stock.Paste, null, "<control>V", "Paste",
                                new EventHandler(OnPasteActivated)),
                new ActionEntry("DeleteAction", Stock.Delete, null, "Delete", "Delete",
                                new EventHandler(OnDeleteActivated))
            };
            ActionEntry[] miscActionEntries = new ActionEntry[] {
                new ActionEntry("UndoAction", Stock.Undo, null, "<control>Z", "Undo",
                                new EventHandler(OnUndoActivated)),
                new ActionEntry("RedoAction", Stock.Redo, null, "<shift><control>Z", "Redo",
                                new EventHandler(OnRedoActivated)),
                new ActionEntry("PreferencesAction", Stock.Preferences, null, null, "Preferences",
                                new EventHandler(OnPreferencesActivated))
            };

            editActionGroup = new ActionGroup("EditActions");
            editActionGroup.Add(actionEntries);
            ActionGroup miscActionGroup = new ActionGroup("MiscEditActions");

            miscActionGroup.Add(miscActionEntries);

            uim.InsertActionGroup(editActionGroup, 0);
            uim.InsertActionGroup(miscActionGroup, 0);

            uim.AddUiFromString(uiXml);
            UndoAction   = (Gtk.Action)uim.GetAction("/menubar/Edit/Undo");
            RedoAction   = (Gtk.Action)uim.GetAction("/menubar/Edit/Redo");
            CutAction    = (Gtk.Action)uim.GetAction("/menubar/Edit/Cut");
            CopyAction   = (Gtk.Action)uim.GetAction("/menubar/Edit/Copy");
            PasteAction  = (Gtk.Action)uim.GetAction("/menubar/Edit/Paste");
            DeleteAction = (Gtk.Action)uim.GetAction("/menubar/Edit/Delete");


            foreach (Gtk.Action a in editActionGroup.ListActions())
            {
                // for some reason the accelerators are connected twice
                // ... so disconnect them twice
                for (int i = 0; i < 2; i++)
                {
                    a.DisconnectAccelerator();
                }
            }
            editAccelCount = 0;
            uim.EnsureUpdate();
        }
コード例 #17
0
        public void AddActionEntry(TimeStep timeStep, StrGuid personGuid, string personName,
                                   bool isSick, string affordanceName, StrGuid affordanceGuid,
                                   HouseholdKey householdKey, string affordanceCategory, BodilyActivityLevel bodilyActivityLevel)
        {
            if (!timeStep.DisplayThisStep)
            {
                return;
            }
            ActionEntry ae = ActionEntry.MakeActionEntry(timeStep,
                                                         personGuid, personName, isSick, affordanceName, affordanceGuid,
                                                         householdKey, affordanceCategory, _dsc.MakeDateFromTimeStep(timeStep), bodilyActivityLevel);

            _actionEntries.Add(ae);
        }
コード例 #18
0
ファイル: ActionEntryTest.cs プロジェクト: kameske/WodiLib
        private static ActionEntry GetInstance(
            IEnumerable <ICharaMoveCommand> commands,
            bool isWaitForComplete,
            bool isRepeatAction,
            bool isSkipIfCannotMove)
        {
            var instance = new ActionEntry(commands)
            {
                IsWaitForComplete  = isWaitForComplete,
                IsRepeatAction     = isRepeatAction,
                IsSkipIfCannotMove = isSkipIfCannotMove
            };

            return(instance);
        }
コード例 #19
0
 private void DrawAppendButtonsFor(ActionEntry entry)
 {
     EditorGUILayout.BeginHorizontal(GUILayout.MinWidth(140f), GUILayout.MaxWidth(160f));
     {
         if (GUILayout.Button("Append Entry", EditorStyles.miniButtonLeft))
         {
             AppendTo(entry, ActionEntryType.Executable);
         }
         if (GUILayout.Button("Append Block", EditorStyles.miniButtonRight))
         {
             AppendTo(entry, ActionEntryType.ParallelBlock);
         }
     }
     EditorGUILayout.EndHorizontal();
 }
コード例 #20
0
        /// <summary>
        /// 将一个委托添加到队列中。
        /// </summary>
        /// <param name="action">要执行的委托。</param>
        /// <param name="tryTimes">重试次数。</param>
        /// <returns>执行的标识。</returns>
        public static string Push(Action action, int tryTimes = 0)
        {
            Guard.ArgumentNull(action, nameof(action));

            var entry = new ActionEntry(action, tryTimes);

            queue.Enqueue(entry);

            if (thread.ThreadState != ThreadState.Background)
            {
                thread.Start();
            }

            return(entry.Id);
        }
コード例 #21
0
ファイル: SelectLayoutPlugin.cs プロジェクト: switsys/bless
        private void AddMenuItems(UIManager uim)
        {
            ActionEntry[] actionEntries = new ActionEntry[] {
                new ActionEntry("LayoutsAction", null, Catalog.GetString("_Layouts..."), "<shift><ctrl>L", null,
                                new EventHandler(OnLayoutsActivated)),
            };

            ActionGroup group = new ActionGroup("SelectLayoutActions");

            group.Add(actionEntries);

            uim.InsertActionGroup(group, 0);
            uim.AddUiFromString(uiXml);

            uim.EnsureUpdate();
        }
コード例 #22
0
 private void DrawInsertButtonsFor(ActionEntry entry)
 {
     EditorGUILayout.BeginHorizontal(GUILayout.MaxWidth(160f));
     {
         if (GUILayout.Button("+ Entry", EditorStyles.miniButtonLeft))
         {
             InsertTo(entry, ActionEntryType.Executable);
         }
         if (GUILayout.Button("+ Block", EditorStyles.miniButtonRight))
         {
             InsertTo(entry, ActionEntryType.ParallelBlock);
         }
         entry.EntryWrapMode = (ActionEntry.ActionEntryWrapMode)EditorGUILayout.EnumPopup(entry.EntryWrapMode);
     }
     EditorGUILayout.EndHorizontal();
 }
コード例 #23
0
        private void AddActions(UIManager uim)
        {
            ActionEntry[] actionEntries = new ActionEntry[] {
                new ActionEntry("CopyOffsetAction", Stock.Copy, Catalog.GetString("Copy Offset(s)"),
                                "<Shift><Ctrl>C", null, new EventHandler(OnCopyOffsetActivated))
            };

            ActionGroup group = new ActionGroup("CopyOffsetActions");

            group.Add(actionEntries);

            uim.InsertActionGroup(group, 0);
            uim.AddUiFromString(uiXml);

            uim.EnsureUpdate();
        }
コード例 #24
0
        private void AddMenuItems(UIManager uim)
        {
            ActionEntry[] actionEntries = new ActionEntry[] {
                new ActionEntry("GotoOffsetAction", Stock.JumpTo, Catalog.GetString("_Goto Offset"), "<control>G", null,
                                new EventHandler(OnGotoOffsetActivated)),
            };

            ActionGroup group = new ActionGroup("GotoActions");

            group.Add(actionEntries);

            uim.InsertActionGroup(group, 0);
            uim.AddUiFromString(uiXml);

            uim.EnsureUpdate();
        }
コード例 #25
0
        public static void CharaMoveCommandOwnerTest()
        {
            var assignValue  = new AssignValue();
            var assignValue2 = new AssignValue();
            var addValue     = new AddValue();
            var addValue2    = new AddValue();

            // この時点で EventCommand の Owner が null であることを確認
            Assert.IsNull(assignValue.Owner);
            Assert.IsNull(assignValue2.Owner);
            Assert.IsNull(addValue.Owner);
            Assert.IsNull(addValue2.Owner);

            var actionEntry = new ActionEntry();

            actionEntry.CommandList.Add(assignValue);
            actionEntry.CommandList.Add(addValue);

            // この時点で ActionEntry, EventCommand の Owner が null であることを確認
            Assert.IsNull(actionEntry.Owner);
            Assert.IsNull(assignValue.Owner);
            Assert.IsNull(assignValue2.Owner);
            Assert.IsNull(addValue.Owner);
            Assert.IsNull(addValue2.Owner);

            var instance = new MapEventPageMoveRouteInfo
            {
                CustomMoveRoute = actionEntry
            };

            // この時点で ActionEntry, セット済みのEventCommand の Owner がセットされていることを確認
            Assert.AreEqual(actionEntry.Owner, TargetAddressOwner.MapEvent);
            Assert.AreEqual(assignValue.Owner, TargetAddressOwner.MapEvent);
            Assert.AreEqual(addValue.Owner, TargetAddressOwner.MapEvent);
            Assert.IsNull(assignValue2.Owner);
            Assert.IsNull(addValue2.Owner);

            actionEntry.CommandList.Add(assignValue2);
            actionEntry.CommandList.Add(addValue2);

            // EventCommand の Owner に適切な値が設定されること
            Assert.AreEqual(assignValue2.Owner, TargetAddressOwner.MapEvent);
            Assert.AreEqual(addValue2.Owner, TargetAddressOwner.MapEvent);

            // instance をここまで開放したくないので無駄な処理を入れる
            instance.MoveSpeed = MoveSpeed.Fast;
        }
コード例 #26
0
        // ============================================
        // PRIVATE (Methods) Menu Event Handlers
        // ============================================
        private void AddMenu(GUI.Base.UIManager menuManager)
        {
            string ui = "<ui>" +
                        "  <menubar name='MenuBar'>" +
                        "    <menu action='FileMenu'>" +
                        "      <menuitem action='RegisterAccount' position='top' />" +
                        "    </menu>" +
                        "  </menubar>" +
                        "</ui>";

            ActionEntry[] entries = new ActionEntry[] {
                new ActionEntry("RegisterAccount", "Registration", "Register Account", null,
                                "Register New Account...", new EventHandler(OnRegisterAccount)),
            };

            menuManager.AddMenus(ui, entries);
        }
コード例 #27
0
        // ============================================
        // PRIVATE Methods
        // ============================================
        private void InitializeSearchMenu()
        {
            ActionEntry[] entries = new ActionEntry[] {
                new ActionEntry("Search", "Search", "Search", null,
                                "Find File...", new EventHandler(OnFindFile)),
            };

            string ui = "<ui>" +
                        "  <menubar name='MenuBar'>" +
                        "    <menu action='ToolMenu'>" +
                        "      <menuitem action='Search' />" +
                        "    </menu>" +
                        "  </menubar>" +
                        "</ui>";

            nyFolder.Window.Menu.AddMenus(ui, entries);
        }
コード例 #28
0
        // ============================================
        // PRIVATE Methods
        // ============================================
        private void InitializeMenu()
        {
            ActionEntry[] entries = new ActionEntry[] {
                new ActionEntry("DownloadManager", "Download", "Download Manager", null,
                                "Open Download Manager", new EventHandler(OnDlManager))
            };

            string ui = "<ui>" +
                        "  <menubar name='MenuBar'>" +
                        "    <menu action='ToolMenu'>" +
                        "      <menuitem action='DownloadManager' />" +
                        "    </menu>" +
                        "  </menubar>" +
                        "</ui>";

            nyFolder.MainWindow.Menu.AddMenus(ui, entries);
        }
コード例 #29
0
        private ActionEntry[] GetActionEntries()
        {
            ActionEntry[] entries = new ActionEntry[] {
                new ActionEntry("FileMenu", null, "_File", null, null, null),
                new ActionEntry("ViewMenu", null, "_View", null, null, null),
                new ActionEntry("GoMenu", null, "_Go", null, null, null),
                new ActionEntry("ToolMenu", null, "_Tool", null, null, null),
                new ActionEntry("NetworkMenu", null, "_Network", null, null, null),
                new ActionEntry("HelpMenu", null, "_Help", null, null, null),

                // File Menu
                new ActionEntry("ProxySettings", "Proxy", "Proxy Settings", null,
                                "Setup Proxy", new EventHandler(ActionActivated)),
                new ActionEntry("Logout", "Logout", "Logout", null,
                                "Logout", new EventHandler(ActionActivated)),
                new ActionEntry("Quit", Gtk.Stock.Quit, "Quit", "<control>Q",
                                "Quit NyFolder", new EventHandler(ActionActivated)),
                // View Menu
                new ActionEntry("Refresh", Gtk.Stock.Refresh, "Refresh", null,
                                null, new EventHandler(ActionActivated)),

                // Go Menu
                new ActionEntry("GoUp", Gtk.Stock.GoUp, "UP", null,
                                "Open The Parent Folder", new EventHandler(ActionActivated)),
                new ActionEntry("GoHome", Gtk.Stock.Home, "Home", null,
                                "Open The Root Directory", new EventHandler(ActionActivated)),
                new ActionEntry("GoMyFolder", "StockMyFolder", "MyFolder", null,
                                "My Shared Folder", new EventHandler(ActionActivated)),
                new ActionEntry("GoNetwork", "StockNetwork", "Network", null,
                                "View Network", new EventHandler(ActionActivated)),
                // Network
                new ActionEntry("SetPort", Gtk.Stock.Preferences, "Set P2P Port", null,
                                "Set P2P Port", new EventHandler(ActionActivated)),
                new ActionEntry("AddPeer", Gtk.Stock.Network, "Add Peer", null,
                                "Add New Peer", new EventHandler(ActionActivated)),
                new ActionEntry("RmPeer", Gtk.Stock.Delete, "Remove Peer", null,
                                "Remove Peer", new EventHandler(ActionActivated)),
                new ActionEntry("DownloadManager", "Download", "Download Manager", null,
                                "Download Manager", new EventHandler(ActionActivated)),
                // Help Menu
                new ActionEntry("About", Gtk.Stock.About, "About", null,
                                "About NyFolder", new EventHandler(ActionActivated)),
            };
            return(entries);
        }
コード例 #30
0
        private void AddMenuItems(UIManager uim)
        {
            ActionEntry[] actionEntries = new ActionEntry[] {
                new ActionEntry("SelectAllAction", null, Catalog.GetString("Select _All"), "<control>A", null,
                                new EventHandler(OnSelectAllActivated)),
                new ActionEntry("SelectRangeAction", Stock.JumpTo, Catalog.GetString("_Select Range"), "<shift><control>R", null,
                                new EventHandler(OnSelectRangeActivated)),
            };

            ActionGroup group = new ActionGroup("SelectRangeActions");

            group.Add(actionEntries);

            uim.InsertActionGroup(group, 0);
            uim.AddUiFromString(uiXml);

            uim.EnsureUpdate();
        }
コード例 #31
0
            public void AddActionLabel(int mapCategoryId, int actionId, AxisRange axisRange, GUILabel label)
            {
                MapCategoryEntry entry;

                if (!entries.TryGet(mapCategoryId, out entry))
                {
                    return;
                }

                ActionEntry actionEntry = entry.GetActionEntry(actionId, axisRange);

                if (actionEntry == null)
                {
                    return;
                }

                actionEntry.SetLabel(label);
            }
コード例 #32
0
        private void AddMenuItems(UIManager uim)
        {
            ActionEntry[] actionEntries = new ActionEntry[] {
                new ActionEntry("ContentsAction", Stock.Help, Catalog.GetString("_Contents"), "F1", null,
                                new EventHandler(OnContentsActivated)),
                new ActionEntry("AboutAction", null, Catalog.GetString("_About"), null, null,
                                new EventHandler(OnAboutActivated)),
            };

            ActionGroup group = new ActionGroup("HelpActions");

            group.Add(actionEntries);

            uim.InsertActionGroup(group, 0);
            uim.AddUiFromString(uiXml);

            uim.EnsureUpdate();
        }
コード例 #33
0
            private ActionEntry GetActionEntry(int mapCategoryId, int actionId, AxisRange axisRange)
            {
                if (actionId < 0)
                {
                    return(null);
                }

                MapCategoryEntry entry;

                if (!entries.TryGet(mapCategoryId, out entry))
                {
                    return(null);
                }

                ActionEntry actionEntry = entry.GetActionEntry(actionId, axisRange);

                return(actionEntry);
            }
コード例 #34
0
ファイル: ActionsController.cs プロジェクト: nozerowu/ABP
        public ActionResult Edit(ActionEntry model)
        {
            var info = _action.GetById(model.ActionId);
            if (ModelState.IsValid)
            {
                model.CreatedTime = info.CreatedTime;
                model.ChangedBy = info.CreatedBy;
                model.ChangedBy = Utility.CurrentUserName;
                model.ChangedTime = DateTime.UtcNow;
                Utility.Operate(this, Operations.Update, () =>
                {
                    _cache.Remove(Constants.CACHE_KEY_ACTIONS);
                    return _action.Update(model);
                }, model.DisplayName);
            }
            else
            {
                Utility.SetErrorModelState(this);
            }

            return Redirect("~/Admin/Actions/Index");
        }
コード例 #35
0
		public KeywordActionDlg(ActionEntry entry, IList<IKeywordAction> actionList)
		{
			this.keywordActionList = actionList;
			this.ActionEntry = entry;
			InitializeComponent();
			this.actionComboBox.Items.Clear();
			foreach (IKeywordAction action in actionList)
			{
				this.actionComboBox.Items.Add(action.GetName());
				this.actionDict[action.GetName()] = action;
			}
			if (this.actionComboBox.Items.Count > 0)
			{
				if (this.ActionEntry.pluginName != null && this.actionDict.ContainsKey(this.ActionEntry.pluginName))
				{
					this.actionComboBox.SelectedItem = this.ActionEntry.pluginName;
				}
				else
				{
					this.actionComboBox.SelectedIndex = 0;
				}
			}
			this.parameterTextBox.Text = this.ActionEntry.actionParam;
		}
コード例 #36
0
        private void ParseScripts(bint* hdr)
        {
            Script s = null;
            int size, count;
            bint* actionOffset;
            _subActions = new BindingList<SubActionEntry>();
            _actions = new BindingList<ActionEntry>();

            if (hdr[3] > 0)
            {
                ActionEntry ag;
                sActionFlags* aflags = (sActionFlags*)Address(hdr[3]);
                if (hdr[5] > 0)
                {
                    actionOffset = (bint*)Address(hdr[5]);
                    size = _root.GetSize(hdr[5]);
                    for (int z = 0; z < size / 4; z++)
                    {
                        sActionFlags flag = aflags[z];
                        _actions.Add(ag = new ActionEntry(flag, z, z));
                        if (actionOffset[z] > 0)
                            ag._entry = Parse<Script>(actionOffset[z], this);
                        else
                            ag._entry = new Script(this);
                    }
                }
            }
            if (hdr[4] > 0)
            {
                SubActionEntry sg;
                sSubActionFlags* sflags = (sSubActionFlags*)Address(hdr[4]);
                size = _root.GetSize(hdr[6]);
                count = size / 4;
                for (int z = 0; z < count; z++)
                {
                    sSubActionFlags flag = sflags[z];
                    _subActions.Add(sg = new SubActionEntry(flag, flag._stringOffset > 0 ? new String((sbyte*)Address(flag._stringOffset)) : "<null>", z));
                }
                for (int i = 0; i < 3; i++)
                {
                    int x = hdr[6 + i];
                    if (x <= 0)
                        continue;

                    actionOffset = (bint*)Address(x);
                    for (int z = 0; z < count; z++)
                    {
                        if (actionOffset[z] > 0)
                            s = Parse<Script>(actionOffset[z], this);
                        else
                            s = new Script(this);
                        _subActions[z].SetWithType(i, s);
                    }
                }
            }
        }
コード例 #37
0
        private void SetActionEntry(ActionEntry entry)
        {
            if( actionEntry != null )
            {
                // Unlink event handlers
                actionEntry.StatusHelper.ValueChanged -= Update;
                actionEntry.ProgressHelper.ValueChanged -= Update;
            }

            actionEntry = entry;
            imgActionStatus.ActionEntry = entry;

            if( actionEntry != null )
            {
                // Link event handlers
                actionEntry.StatusHelper.ValueChanged += Update;
                actionEntry.ProgressHelper.ValueChanged += Update;
            }

            Update();
        }
コード例 #38
0
 private void BrowseDirectoriesRecursive(ActionEntry entry, DirectoryEntry dirEntry, List<DirectoryEntry> dirList)
 {
     foreach( var child in dirEntry.Children.Cast<DirectoryEntry>() )
     {
         switch( child.SchemaClassName )
         {
             case "IIsWebVirtualDir":
                 entry.LogLine( "Found virtual directory at '" + child.Path + "'" );
                 dirList.Add( child );
                 goto case "IIsWebDirectory";
             case "IIsWebDirectory":
                 entry.LaunchSubAction( (e)=>{ BrowseDirectoriesRecursive( e, child, dirList ); } );
                 break;
             default:
                 System.Diagnostics.Debug.Fail( "Unknown child type '" + child.SchemaClassName + "'" );
                 break;
         }
     }
 }
コード例 #39
0
ファイル: HilightDialog.cs プロジェクト: gspatace/logexpert
		private void StartEditEntry()
		{
			HilightEntry entry = (HilightEntry)this.hilightListBox.SelectedItem;
			if (entry != null)
			{
				this.searchStringTextBox.Text = entry.SearchText;
				this.foregroundColorBox.CustomColor = entry.ForegroundColor;
				this.backgroundColorBox.CustomColor = entry.BackgroundColor;
				this.foregroundColorBox.SelectedItem = entry.ForegroundColor;
				this.backgroundColorBox.SelectedItem = entry.BackgroundColor;
				this.regexCheckBox.Checked = entry.IsRegEx;
				this.caseSensitiveCheckBox.Checked = entry.IsCaseSensitive;
				this.ledCheckBox.Checked = entry.IsLedSwitch;
				this.bookmarkCheckBox.Checked = entry.IsSetBookmark;
				this.stopTailCheckBox.Checked = entry.IsStopTail;
				this.pluginCheckBox.Checked = entry.IsActionEntry;
				pluginButton.Enabled = pluginCheckBox.Checked;
				this.bookmarkCommentButton.Enabled = this.bookmarkCheckBox.Checked;
				this.currentActionEntry = entry.ActionEntry != null ? entry.ActionEntry.Copy() : new ActionEntry();
				this.bookmarkComment = entry.BookmarkComment;
				this.wordMatchCheckBox.Checked = entry.IsWordMatch;
				this.boldCheckBox.Checked = entry.IsBold;
				this.noBackgroundCheckBox.Checked = entry.NoBackground;
			}
			this.applyButton.Enabled = false;
			this.applyButton.Image = null;

			ReEvaluateHilightButtonStates();
		}
コード例 #40
0
        /// <summary>
        /// 2. After a certain time without inactivities in the checkbox, the action delayer wakes up.
        /// </summary>
        private void ConnectionString_ValueChangedDelayed()
        {
            // Create a new ActionEntry to try connection
            CurrentConnectionAction = ActionsManager.PushAction( Creator, "Connection attempt to '" + Server + "'", TryConnectAction, true );
            imgAction.ActionEntry = CurrentConnectionAction;

            // Monitor this action's status
            CurrentConnectionAction.StatusHelper.ValueChanged += CurrentConnectionActionStatus_ValueChanged;
            CurrentConnectionActionStatus_ValueChanged();
        }
コード例 #41
0
ファイル: HilightDialog.cs プロジェクト: gspatace/logexpert
		private void pluginButton_Click(object sender, EventArgs e)
		{
			KeywordActionDlg dlg = new KeywordActionDlg(this.currentActionEntry, this.KeywordActionList);
			if (dlg.ShowDialog() == DialogResult.OK)
			{
				this.currentActionEntry = dlg.ActionEntry;
				Dirty();
			}
		}
コード例 #42
0
        private void RemoveVirtualDirectory(ActionEntry entry)
        {
            string fullPath, parentDir, dirName;
            GetSelectedDirectoryPath( out fullPath, out parentDir, out dirName );

            entry.LogLine( "Removing directory entry '" + fullPath + "'" );
            using( var directoryEntry = new DirectoryEntry(fullPath) )
            {
                directoryEntry.DeleteTree();
            }
        }
コード例 #43
0
        private void LoadWebsites(ActionEntry entry)
        {
            ddWebSites.Items.Clear();

            entry.LogLine( "Accessing active directory entry 'IIS://localhost/W3svc'" );
            var iis = new DirectoryEntry( "IIS://localhost/W3svc" );

            entry.LogLine( "Looking for entries of type 'IIsWebServer'" );
            var websites = iis.Children
                                    .Cast<DirectoryEntry>()
                                    .Where( v=>v.SchemaClassName == "IIsWebServer" );

            var items = new List<ComboBoxItem>();
            foreach( var website in websites )
            {
                entry.LogLine( "Found '" + website.Path + "'" );
                var description = (string)website.Properties[ "ServerComment" ].Value;
                string rootPath = website.Path + "/ROOT";
                entry.LogLine( "Getting '" + rootPath + "'" );
                (new DirectoryEntry(rootPath)).Children.Cast<object>().ToArray();  // Check the directory is valid
                items.Add( new ComboBoxItem {
                                        Content = string.Format( "{0}: {1}", website.Name, description ),
                                        Tag = rootPath } );
            }
            foreach( var item in items )
                ddWebSites.Items.Add( item );
            if( ddWebSites.Items.Count > 0 )
                ddWebSites.SelectedIndex = 0;
        }
コード例 #44
0
        private void CreateVirtualDirectory(ActionEntry entry)
        {
            // TODO: Alain: Test on XP ; seems it needs a boolean here :
            // Acces en lecture
            // Choix du framework (v2 / v4)
            // ASP doit être installé/activé: aspnet_regiis.exe -i -enable
            //				a executer dans le répertoire "WINDOWS/Microsoft.NET/Framework/v4.0.30319" ou/et "v2.0.50727"
            //				(désinstall: aspnet_regiis.exe -ua)
            // sinon, manque les directoryEntry.Properties["ScriptMap"] ==> *.aspx : machin_aspnet.dll
            // c.f. http://serverfault.com/questions/1649/why-does-iis-refuse-to-serve-asp-net-content
            // => Détection de l'installation/activation

            string fullPath, parentDir, dirName;
            GetSelectedDirectoryPath( out fullPath, out parentDir, out dirName );
            string physicalPath = PhysicalPath;
            System.Diagnostics.Debug.Assert( physicalPath != null, "'PhysicalPath' should be available here" );

            entry.LogLine( "Getting directory entry '" + parentDir + "'" );
            using( var parentDirectoryEntry = new DirectoryEntry(parentDir) )
            {
                parentDirectoryEntry.Children.Cast<object>().ToArray();  // Check that the entry is valid

                entry.LogLine( "Creating entry '" + dirName + "'" );
                // c.f. http://michaelsync.net/2005/12/01/iis-6-virtual-directories-management-with-c
                using( var directoryEntry = parentDirectoryEntry.Children.Add( dirName,"IIsWebVirtualDir") )
                {
                    directoryEntry.Properties["Path"][0] = physicalPath;
                    directoryEntry.Properties["EnableDirBrowsing"][0] = IISEnableDirBrowsing;
                    directoryEntry.Properties["AccessRead"][0] = IISAccessRead;
                    directoryEntry.Properties["AccessExecute"][0] = IISAccessExecute;
                    directoryEntry.Properties["AccessWrite"][0] = IISAccessWrite;
                    directoryEntry.Properties["AccessScript"][0] = IISAccessScript;
                    //directoryEntry.Properties["AuthNTLM"][0] = true;
                    //directoryEntry.Properties["EnableDefaultDoc"][0] = true;
                    directoryEntry.Properties["DefaultDoc"][0] = IISDefaultDoc;
                    //directoryEntry.Properties["AspEnableParentPaths"][0] = true;
                    directoryEntry.Properties["AppFriendlyName"][0] = WebAppFriendlyName;
                    directoryEntry.CommitChanges();

                    //'the following are acceptable params
                    //'INPROC = 0
                    //'OUTPROC = 1
                    //'POOLED = 2
            // TODO: Alain: What's this?
                    directoryEntry.Invoke("AppCreate", 1);
                    directoryEntry.CommitChanges();
                }
            }
        }
コード例 #45
0
        /// <summary>
        /// Check the content of 'txtPhysicalPath' and update 'PhysicalPath'.
        /// </summary>
        private void CheckPhysicalPath(ActionEntry entry)
        {
            string realPath = null;
            try
            {
                var proposition = PhysicalPathProposition;
                if( string.IsNullOrEmpty(proposition) )
                {
                    entry.AddError( "No physical path specified" );
                    goto ExitProc;
                }
                entry.LogLine( "Checking directory '" + proposition );
                var dirInfo = new DirectoryInfo( proposition );
                if(! dirInfo.Exists )
                {
                    entry.AddError( "Directory '" + proposition + "' does not exists" );
                    goto ExitProc;
                }
                var fileInfo = new FileInfo( System.IO.Path.Combine(proposition, "Web.config") );
                if(! fileInfo.Exists )
                {
                    entry.AddError( "Directory '" + proposition + "' does not contain a file 'Web.config'" );
                    goto ExitProc;
                }

                // Directory OK => We can use it
                realPath = proposition;;
            }
            catch( System.Exception ex )
            {
                entry.AddException( ex );
            }

            ExitProc:
            PhysicalPath = realPath;
            CheckStatus();
        }
コード例 #46
0
 private void btnReplace_Click(ActionEntry entry)
 {
     entry.LogLine( "Removing old virtual directory" );
     entry.LaunchSubAction( RemoveVirtualDirectory );
     if( (!entry.HasErrors) && (!entry.HasExceptions) )
     {
         entry.LogLine( "Recreate virtual directory" );
         entry.LaunchSubAction( CreateVirtualDirectory );
     }
     entry.LogLine( "Reload IIS virtual directories list" );
     ddVirtualDirs.SelectedIndex = -1;
     entry.LaunchSubAction( LoadVirtualDirectories );
     if( (!entry.HasErrors) && (!entry.HasExceptions) )
     {
         MessageBox.Show( "Virtual directory replaced" );
     }
     else
     {
     System.Diagnostics.Debug.Fail( "HERE: DialogBox de l'ActionEntry qui a foiré" );
     }
     CheckStatus();
 }
コード例 #47
0
ファイル: ActionsManager.cs プロジェクト: alaincao/CommonLibs
        private ActionEntry AppendAction(ActionEntry entry)
        {
            ActionEntries.Add( entry );

            entry.StatusHelper.ValueChanged += ()=>
                {
                    if( ActionStatusChanged != null )
                        ActionStatusChanged( entry );
                };
            entry.ProgressHelper.ValueChanged += ()=>
                {
                    if( ActionStatusChanged != null )
                        ActionStatusChanged( entry );
                };
            if( ActionStatusChanged != null )
                ActionStatusChanged( entry );

            CheckPendingActions();
            return entry;
        }
コード例 #48
0
 public static void ShowActionEntry(string windowTitle, ActionEntry entry, CommonLibs.ExceptionManager.CreateManagerDelegate exceptionManagerFactory)
 {
     var window = new Window() { Title=windowTitle };
     window.Width = 640;
     window.Height = 480;
     var control = new ActionEntryControl();
     if( exceptionManagerFactory != null )
         control.ExceptionManagerFactory = exceptionManagerFactory;
     control.ActionEntry = entry;
     window.Content = control;
     var rc = window.ShowDialog();
 }
コード例 #49
0
        /// <summary>
        /// 1. Something in the textboxes has changed.
        /// </summary>
        private void ConnectionString_ValueChanged()
        {
            if( CurrentConnectionAction != null )
            {
                // There is a previous connection attempt => Stop monitoring its status
                CurrentConnectionAction.StatusHelper.ValueChanged -= CurrentConnectionActionStatus_ValueChanged;
                CurrentConnectionAction.Abort();
                CurrentConnectionAction = null;
            }

            txtConnectionString.Text = ConnectionStringHelper.GetConnectionStringWithoutPassword( PasswordHideString );
            imgAction.ActionEntry = null;
            IsConnectionOk = false;

            // Trigger the action delayer
            ConnectionString_ValueChangedActionDelayer.Trigger();
        }
コード例 #50
0
 public static void ShowActionEntry(string windowTitle, ActionEntry entry)
 {
     ShowActionEntry( windowTitle, entry, null );
 }
コード例 #51
0
        private void TryConnectAction(ActionEntry entry)
        {
            entry.LogLine( "Trying to connect using connection string: " + ConnectionStringHelper.GetConnectionStringWithoutPassword(PasswordHideString), 50 );
            using( var connection = new SqlConnection(ConnectionString) )
            {
                connection.Open();

                entry.LogLine( "Executing command 'SELECT 1'", ((AdditionalTest == null) ? 90 : 70) );
                using( var command = connection.CreateCommand() )
                {
                    command.CommandText = "SELECT 1";
                    command.ExecuteNonQuery();
                }

                if( AdditionalTest != null )
                    AdditionalTest( entry, connection );
            }
        }
コード例 #52
0
 /// <summary>
 /// Used only by ParseArguments()
 /// </summary>
 private ActionEntryExternalHelper()
 {
     Entry = new ActionEntry( null, null, null );
     Entry.Init( this );
     StreamOut = Console.Out;
 }
コード例 #53
0
        private void LoadVirtualDirectories(ActionEntry entry)
        {
            ddVirtualDirs.Items.Clear();
            var webSiteItem = ddWebSites.SelectedItem as ComboBoxItem;
            if( webSiteItem == null )
            {
                entry.LogLine( "No website selected" );
                return;
            }
            var webSiteDirectoryEntryPath = (string)webSiteItem.Tag;
            entry.LogLine( "Using website at '" + webSiteDirectoryEntryPath + "'" );
            var webSiteDirectoryEntry = new DirectoryEntry( webSiteDirectoryEntryPath );

            entry.LogLine( "Searching recursively for virtual dirs" );
            var dirList = new List<DirectoryEntry>();
            dirList.Add( webSiteDirectoryEntry );
            BrowseDirectoriesRecursive( entry, webSiteDirectoryEntry, dirList );

            ComboBoxItem selectedItem = null;
            var physicalPath = PhysicalPath;
            foreach( var dirEntry in dirList )
            {
                string rootRelativePath = dirEntry.Path.Substring( webSiteDirectoryEntry.Path.Length );
                if( rootRelativePath.Length == 0 )
                    rootRelativePath = "/";
                var item = new ComboBoxItem {	Content = rootRelativePath,
                                                Tag = dirEntry.Path };
                ddVirtualDirs.Items.Add( item );

                if( (physicalPath != null) && (physicalPath.ToLower() == ((string)dirEntry.Properties["Path"].Value ?? "").ToLower()) )
                {
                    entry.LogLine( "Using virtual dir at '" + dirEntry.Path + "'" );
                    selectedItem = item;
                }
            }
            if( selectedItem != null )
                ddVirtualDirs.SelectedItem = selectedItem;

            CheckStatus();
        }
コード例 #54
0
        public void Init(ActionsManager actionsManager, string creator, string webAppFriendlyName)
        {
            System.Diagnostics.Debug.Assert( Creator == null, "Init() should be called only once!" );

            Creator = creator;
            ActionsManager = actionsManager;
            WebAppFriendlyName = webAppFriendlyName;

            Action checkPhysicalPath = ()=>CheckPhysicalPathEntry = ActionsManager.AppendAction( Creator, "Checking physical path", CheckPhysicalPath );
            Action loadWebsites = ()=>ActionsManager.AppendAction( Creator, "Load website list", LoadWebsites );
            Action loadVirtualDirectories = ()=>ActionsManager.AppendAction( Creator, "Load IIS virtual directories list", LoadVirtualDirectories );

            // Launch initialization actions
            loadWebsites();  // Will append action LoadVirtualDirectories
            checkPhysicalPath();

            // Bind controls

            btnBrowsePath.Click += ES.Routed( btnBrowsePath_Click );

            txtPhysicalPath.TextChanged += ES.TextChanged( ()=>
                {
                    imgStatus.Source = CommonLibs.Resources.WPF_SetupGui_UserControls_IISWebApplication.ImageRunning;
                    txtPhysicalPath_Delayer.Trigger();
                } );
            txtPhysicalPath_Delayer.Action = checkPhysicalPath;
            txtPhysicalPath_Delayer.DelaySeconds = 1;

            PhysicalPathHelper.ValueChanged += ES.Action( loadVirtualDirectories );
            ddWebSites.SelectionChanged += ES.SelectionChanged( loadVirtualDirectories );
            //ddVirtualDirs.TextChanged += ddVirtualDirs_TextChanged;  <= NB: Done in XAML

            btnReplace.Click += ES.Routed( ()=>ActionsManager.AppendAction(Creator, "Replacing the existing virtual directory", btnReplace_Click) );
            btnCreate.Click += ES.Routed( ()=>ActionsManager.AppendAction(Creator, "Creating a new virtual directory", btnCreate_Click) );
            btnRemove.Click += ES.Routed( ()=>ActionsManager.AppendAction(Creator, "Remove existing virtual directory", btnRemove_Click) );
        }