/// <summary> /// Konstruktor /// </summary> /// <param name="menuFactory">Referense till en factory där man kan hämta text till olika menyer</param> /// <param name="ui">Referense till objekt för att skriva och hämta indata</param> /// <param name="lsGarageHandlers">lista med olika garagehandlers. Varje garagehandler hanterar ett garage</param> /// <param name="guidSelectedGarageHandlerGuid">Guid för vald GarageHandler</param> /// <param name="registrationNumberRegister">Referense till register där använda registreringsnummer finns</param> /// <exception cref="System.NullReferenceException">Kan kastas om referensen till menuFactory, vehicleFactory, ui, lsGarageHandlers eller registrationNumberRegister är null</exception> public GarageMenu(IMenuFactory menuFactory, IUI ui, IList <IGarageHandler> lsGarageHandlers, Guid guidSelectedGarageHandlerGuid, IRegistrationNumberRegister registrationNumberRegister) { if (menuFactory == null) { throw new NullReferenceException("NullReferenceException. GarageMenu.GarageMenu(). menuFactory referensen är null"); } if (ui == null) { throw new NullReferenceException("NullReferenceException. GarageMenu.GarageMenu(). ui referensen är null"); } if (lsGarageHandlers == null) { throw new NullReferenceException("NullReferenceException. GarageMenu.GarageMenu(). lsGarageHandlers referensen är null"); } if (registrationNumberRegister == null) { throw new NullReferenceException("NullReferenceException. GarageMenu.GarageMenu(). registrationNumberRegister referensen är null"); } MenuFactory = menuFactory; Ui = ui; GarageHandlers = lsGarageHandlers; SelectedGarageHandlerGuid = guidSelectedGarageHandlerGuid; RegistrationNumberRegister = registrationNumberRegister; }
public void bindui(Action <IUI, Variant> cb, Variant data) { if (m_bindFlag) { return; } if (g_mgr.showLoading(this)) { onLoading(); } BaseLGUI thisptr = this; m_bindFlag = true; g_mgr.getUI( this.uiName, (IUI u, Variant info) => { onLoadingEnd(); if (u == null) { DebugTrace.add(Define.DebugTrace.DTT_ERR, " bindui [" + uiName + "] Err! "); return; } m_uiF = u; m_uiF.setCtrl(thisptr); init(); cb(u, info); }, data ); }
public Game(IMapManipulator mapManipulator, IMap map, IDice dice, IUI ui, IMessageWriter msgWriter) { if (mapManipulator == null) { throw new ArgumentNullException("MapManipulator is null"); } if (map == null) { throw new ArgumentNullException("Map is null"); } if (dice == null) { throw new ArgumentNullException("Dice is null"); } if (ui == null) { throw new ArgumentNullException("UI is null"); } if (msgWriter == null) { throw new ArgumentNullException("MessageWriter is null"); } random = new Random(); this.mapManipulator = mapManipulator; this.map = map; this.dice = dice; this.ui = ui; this.msgWriter = msgWriter; }
private void handleMouseDown(object sender, MouseEventArgs e) { if (p_LogicDisabled) { return; } p_MouseDown = true; Point mousePosition = PointToClient(Cursor.Position); if (p_EventHijacker != null) { p_EventHijacker.OnMouseDown(this, mousePosition, e); } /*fire for all ui elements BUT the click drag and test if * the mouse collids with any, if so, we don't call click+drag*/ int uiL = p_UIElements.Length; for (int c = 0; c < uiL; c++) { IUI ui = p_UIElements[c]; ui.OnMouseDown(this, mousePosition, e); } }
/// <summary> /// All possible menu game command /// </summary> /// <param name="commandAsString">Command from user</param> /// <param name="ui">Takes UI(where will print data)</param> /// <param name="commandTypes">All in menu game commands</param> /// <returns>Instance of command</returns> public ICommand GetMenuCommand(string commandAsString, IUI ui, IDictionary <string, System.Type> commandTypes) { var typeCommand = commandTypes[commandAsString]; var command = (ICommand)System.Activator.CreateInstance(typeCommand, ui); return(command); }
public void CaseCallbackHandler(IUI ui, string cmd, params object[] ps) { try { if (this.Case.pData.pIsAsynchronism) { if (ui != null) sc.Post(o => { this.Case.pipo.pProgressBar.Visible = false; ui.CaseCallbackHandl(cmd); }, null); else { sc.Post(o => { this.RealCaseCallbackHandl(cmd, ps); }, null); } } else { this.RealCaseCallbackHandl(cmd, ps); } } catch (Exception e) { this.OnpNotify("-" + e.Message); } }
public void bindui(Action <IUI, Variant> cb, Variant data) { bool bindFlag = this.m_bindFlag; if (!bindFlag) { bool flag = this.g_mgr.showLoading(this); if (flag) { this.onLoading(); } BaseLGUI thisptr = this; this.m_bindFlag = true; this.g_mgr.getUI(this.uiName, delegate(IUI u, Variant info) { this.onLoadingEnd(); bool flag2 = u == null; if (flag2) { DebugTrace.add(Define.DebugTrace.DTT_ERR, " bindui [" + this.uiName + "] Err! "); } else { this.m_uiF = u; this.m_uiF.setCtrl(thisptr); this.init(); cb(u, info); } }, data); } }
public GarageHandler() { garage = new Garage <Vehicle>(15); log = new EventLog(12); menuStack = new Stack <Menu>(); ui = new ConsoleUI(); }
public void AddGUI(IUI ui) { if (!uis.Contains(ui)) { uis.Add(ui); } }
/// <summary> /// Initializes a new instance of the <see cref="KinokoRunner"/> class. /// </summary> /// <param name='progressBarFactory'>The factory class that creates new instances of <see cref="ProgressBar"/> class.</param> /// <param name='kinokoContext'>Kinoko instance that performs the measurements.</param> /// <param name='ui'>Instance used to interact with the user interface.</param> /// <exception cref="ArgumentNullException">Thrown if one of the parameters is null.</exception> public KinokoRunner(ProgressBarFactory progressBarFactory, IKinokoContext kinokoContext, IUI ui) { if (progressBarFactory == null) { throw new ArgumentNullException("progressBarFactory"); } if (kinokoContext == null) { throw new ArgumentNullException("kinokoContext"); } if (ui == null) { throw new ArgumentNullException("ui"); } this.progressBarFactory = progressBarFactory; this.kinokoContext = kinokoContext; this.ui = ui; kinokoContext.Measured += HandleKinokoMeasured; kinokoContext.TaskRunning += HandleKinokoTaskRunning; kinokoContext.TaskRun += HandleKinokoTaskRun; }
public IUIBaseControl getHirachyCreatedCtrlByID(string ids) { List <string> list = StringUtil.splitStr(ids, "."); IUI uIF = this.getUIF(list[0]); bool flag = uIF == null; IUIBaseControl result; if (flag) { result = null; } else { IUIBaseControl baseCtrl = uIF.getBaseCtrl(); bool flag2 = list.Count > 1; if (flag2) { bool flag3 = !(baseCtrl is IUIContainer); if (flag3) { result = null; } else { result = this.getHirachyUIByID(baseCtrl, list[1]); } } else { result = baseCtrl; } } return(result); }
/// <summary> /// Получить IAction для кнопки запуска настроек /// </summary> /// <param name="ui">The UI.</param> /// <param name="actionEventSources">The action event sources.</param> private static IAction GetActionForPersonalAccountCommand(IUI ui, ICollection <ActionEventSource> actionEventSources) { var action = ui.CreateAction(); var extractedImageResource = ExtractResource(Assembly.GetExecutingAssembly(), "PersonalAccount_16x16.png"); if (extractedImageResource != null) { var icon = ui.CreateImage(); icon.LoadFromData(extractedImageResource, ImageFormat.ImageFormat_PNG); action.Icon = icon; } action.DisplayName = Language.GetItem(LangItem, "h7"); var actionEventSource = new ActionEventSource(action); actionEventSource.Triggered += (s, e) => { ModPlusAPI.UserInfo.UserInfoService.ShowUserInfo(); }; actionEventSources.Add(actionEventSource); return(action); }
/// <summary> /// Konstruktor /// </summary> /// <param name="menuFactory">Referens till factory för att skapa menyer</param> /// <param name="ui">Referens till ui</param> /// <param name="lsGarageHandlers">Referense till lista med handlers för olika garage</param> /// <param name="registrationNumberRegister">Referense till register där använda registreringsnummer finns</param> /// <exception cref="System.NullReferenceException">Kan kastas om referensen till menuFactory, vehicleFactory, ui, lsGarageHandlers eller registrationNumberRegister är null</exception> public MainMenu(IMenuFactory menuFactory, IUI ui, IList <IGarageHandler> lsGarageHandlers, IRegistrationNumberRegister registrationNumberRegister) { //if (menuFactory == null) // throw new NullReferenceException("NullReferenceException. MainMenu.MainMenu(). menuFactory referensen är null"); if (ui == null) { throw new NullReferenceException("NullReferenceException. MainMenu.MainMenu(). ui referensen är null"); } if (lsGarageHandlers == null) { throw new NullReferenceException("NullReferenceException. MainMenu.MainMenu(). lsGarageHandlers referensen är null"); } if (registrationNumberRegister == null) { throw new NullReferenceException("NullReferenceException. MainMenu.MainMenu(). registrationNumberRegister referensen är null"); } MenuFactory = menuFactory; Ui = ui; GarageHandlers = lsGarageHandlers; RegistrationNumberRegister = registrationNumberRegister; }
/// <summary> /// Получить IAction для кнопки запуска настроек /// </summary> /// <param name="ui">The UI.</param> /// <param name="actionEventSources">The action event sources.</param> private static IAction GetActionForSettingsCommand(IUI ui, ICollection <ActionEventSource> actionEventSources) { var action = ui.CreateAction(); var extractedImageResource = ExtractResource(Assembly.GetExecutingAssembly(), "Settings_16x16.png"); if (extractedImageResource != null) { var icon = ui.CreateImage(); icon.LoadFromData(extractedImageResource, ImageFormat.ImageFormat_PNG); action.Icon = icon; } action.DisplayName = Language.GetItem(LangItem, "h9"); var actionEventSource = new ActionEventSource(action); actionEventSource.Triggered += (s, e) => { var settings = new SettingsWindow(); var viewModel = new SettingsViewModel(settings); settings.DataContext = viewModel; settings.Closed += (sender, args) => viewModel.ApplySettings(); settings.ShowDialog(); }; actionEventSources.Add(actionEventSource); return(action); }
public Linq(IUI ui) { SetUI(ui); tickets = new Models.Cassier.DataSet().Data; cassiers = new Models.Personel.DataSet().Data; }
public void CaseCallbackHandler(IUI ui, string cmd, params object[] ps) { try { if (this.Case.pData.pIsAsynchronism) { if (ui != null) { sc.Post(o => { this.Case.pipo.pProgressBar.Visible = false; ui.CaseCallbackHandl(cmd); }, null); } else { sc.Post(o => { this.RealCaseCallbackHandl(cmd, ps); }, null); } } else { this.RealCaseCallbackHandl(cmd, ps); } } catch (Exception e) { this.OnpNotify("-" + e.Message); } }
public void RemoveGUI(IUI ui) { if (uis.Contains(ui)) { uis.Remove(ui); ui.Removed(); } }
public bool SetLoaded(IUIM _mgr, GameObject _go) { State = EWorkerState.Resting; Script = _go.GetComponent <IUI>(); Script.Worker = this; Script?.Loaded(_mgr, _go); return(Script != null); }
/// <summary> /// Default constructor. /// /// Note: Uses console output as standard. /// </summary> public Simulator() { Currentposition = new VecPoint(0,0,0,0,0); iuiOutput = new ConsoleUI(); // Don´t move location. iuiOutput.writeLine("Simulation is started!"); initialization(); bGripperIsOpen = false; }
public GarageManager(IUI ui, IGarageHandler handler, IVehicle vehicle) { this.ui = ui; this.handler = handler; this.vehicle = vehicle; Vehicle.Check = RegNoExists; Vehicle.Callback = Run; }
private void Initialize() { ui = new ConsoleUI(); handler = new GarageHandler(); // Creates a default garage garage = new Garage <IVehicle>(10); garage = handler.CreateGarage(10); }
private static void Integriere_mit_CS_Bibliothek(IUI gui) { var integration = new Taschenrechner(); gui.Ziffer_gedrückt += integration.Ziffer_verarbeiten; integration.Ergebnis += gui.Ergebnis_anzeigen; gui.Op_gedrückt += integration.Operator_verarbeiten; }
/// <summary> /// Initializes a new instance of the <see cref="HangmanGame"/> class. /// </summary> /// <param name="ui">Used to draw on console</param> /// <param name="state">Holds different states while game is running</param> /// <param name="wordselector">Select words from .txt file</param> /// <param name="player">Holds information for user</param> /// <param name="commandCreator">Returns command from user</param> public HangmanGame(IUI ui, State state, WordSelectorFromFile wordselector, IPlayer player, CommandFactory commandCreator) { this.WordSelect = wordselector; this.Scores = ScoreBoard.Instance; this.State = state; this.Player = player; this.UI = ui; this.CommandFactory = commandCreator; }
//>场景中的UI被删除 void IUIM.OnDestroyUI(IUI _scriptInstance) { UUIContainer container; if (TryGetContainerByWorker(_scriptInstance.Worker, out container)) { container.OnWorkerDestroy(_scriptInstance.Worker); } }
//> UI自身调用了Close void IUIM.OnCloseUI(IUI _scriptInstance, bool _isDestroy) { UUIContainer container; if (TryGetContainerByWorker(_scriptInstance.Worker, out container)) { container.OnWorkerClose(_scriptInstance.Worker, _isDestroy); } }
/// <summary> /// Metoden skriver ut hur många registreringsnummer som finns i registret /// </summary> /// <param name="ui">Refernse till ui</param> /// <exception cref="System.NullReferenceException">Kan kastas om referensen till ui, lsGarageHandlers eller registrationNumberRegister är null</exception> public void PrintRegister(IUI ui) { if (ui == null) { throw new NullReferenceException("NullReferenceException. RegistrationNumberRegister.PrintRegister(). ui referensen är null"); } ui.WriteLine($"Det finns {RegistrationNumbers.Count} registreringsnummer i registret"); }
public static void MoveUIToCuursorPos(IUI ui) { Vector2 np = UIKits.GetLocalPosFromScreenPos(UIManager.Instance.GameSceneUICanvas, InputManager.Instance.GetCursorScreenPos()); Vector2 size = UIKits.GetUISize(ui.Transform); np.x += size.x / 2; np.y += size.y / 2; UIKits.ApplyLocalPosWorldPos(ui.Transform, UIManager.Instance.GameSceneUICanvas, np); }
virtual public void dispose() { if (m_uiF != null) { m_uiF.dispose(); } g_mgr = null; m_uiF = null; }
public void DetatchFromEventsHijack(IUI ui) { Console.WriteLine("HIJACK"); if (ui != p_EventHijacker) { throw new Exception("UI element did not hijack events"); } p_EventHijacker = null; }
private void _initOpen(IUI ui, Variant info) { onLoadingEnd(); if (!m_openFlag) { return; } _open_(info); }
private void button8_Click(object sender, EventArgs e) { IUI f2 = new IUI(); this.Visible = false; f2.ShowDialog(); this.Visible = true; }
public static void PopUI() { IUI uI = mUIStack.Pop(); if (mUIStack.Count > 0) { mUIStack.Peek().OnFrozen(false); } uI.OnClose(); }
public void HijackEvents(IUI ui) { if (p_EventHijacker != null) { throw new Exception("A UI element already has control over events."); } Console.WriteLine("HIJACK"); p_EventHijacker = ui; }
public Start_Board(IUI UI, IMap<Tuple<string,int>,string> map1, IHeader_und_Datenzeilen_lesen Header_und_Datenzeilen_lesen, IZeilen_bilden Zeilen_bilden, IMap<Tuple<string,int>,int> map2, IZeilen Zeilen, ISeite_formatieren Seite_formatieren, ISeitennummer_bilden Seitennummer_bilden) { UI.Start += map1.Input; map1.Output += Header_und_Datenzeilen_lesen.Process; Header_und_Datenzeilen_lesen.Result += Zeilen_bilden.Process; Zeilen_bilden.Result += Zeilen.Setzen; UI.Start += map2.Input; map2.Output += Zeilen.Erste_Seite; Zeilen.Seitenanzahl += Seitennummer_bilden.Seitenanzahl; Zeilen.Result += Seite_formatieren.Process; Seite_formatieren.Result += UI.Seite_darstellen; UI.Blättern += Seitennummer_bilden.Process; Seitennummer_bilden.Result += Zeilen.Seite_abrufen; UI.Jump += Seitennummer_bilden.Jump; }
private static void Integriere_mit_Java_Service(IUI gui) { var rewe = new ConsoleRechenwerkProvider(); gui.Op_gedrückt += op => { var ergebnis = rewe.Hier_Operator(op); gui.Ergebnis_anzeigen(ergebnis); }; gui.Ziffer_gedrückt += ziffer => { var ergebnis = rewe.Hier_Ziffer(ziffer); gui.Ergebnis_anzeigen(ergebnis); }; }
internal static void Integrate(string[] args, IUI ui, IGame game) { ui.Started += () => { var boardDefinition = File.ReadAllText(args[0]); var board = Board.Parse(boardDefinition); game.Initialize(board); }; game.Initialized += ui.Board_prepared; ui.Number_of_players_entered += game.Set_players; ui.Rolled_the_dice += game.Move_player; game.Player_moved += ui.Update_player_position; game.Game_over += ui.Game_over; }
private static HttpRechenwerkProvider Integriere_mit_Http_Service(IUI gui) { var rewe = new HttpRechenwerkProvider(); gui.Op_gedrückt += op => { var ergebnis = rewe.Hier_Operator(op); gui.Ergebnis_anzeigen(ergebnis); }; gui.Ziffer_gedrückt += ziffer => { var ergebnis = rewe.Hier_Ziffer(ziffer); gui.Ergebnis_anzeigen(ergebnis); }; return rewe; }
public AutoResetEvent AsynCaseLogic(IUI ui, string cmd, params object[] ps) { AutoResetEvent are = new AutoResetEvent(false); Thread t = default(Thread); lock (_lock) { t = new Thread(() => { this.pipo.ShowPrograssBarState(); this.pData.pIsAsynchronism = true; this.CaseLogic(cmd, ps); this.eCaseCallback.Invoke(ui, cmd, null); are.Set(); this.pData.pIsAsynchronism = false; }); t.Start(); } return are; }
/// <summary> /// Prepares console, print menu, take command from user, check if is right and execute it. /// </summary> /// <param name="ui">IUI that prints massages.</param> /// <param name="commandFactory">Command to execute.</param> public static void Start(IUI ui, CommandFactory commandFactory) { ui.Initialize(); while (true) { ui.ReInitizlize(); string commandToExecute = ui.ReadLine(); if (Globals.MenuCommandTypesValue.ContainsKey(commandToExecute)) { var command = commandFactory.GetMenuCommand(commandToExecute, ui, Globals.MenuCommandTypesValue); command.Execute(); } else { ui.Print(Messages.WrongMessage, "Message"); } } }
void item_Load(IUI ui) { if (ui.pTag != null || ui.pTag != string.Empty) switch (ui.pType) { case UIType.navigate: this.LoadUI(this.tabControl1, ui); break; case UIType.tool: this.LoadUI(this.tabControl1, ui); break; case UIType.monopolize: if (this.LoadUI(this.tabControl2, ui)) this.CheckSurface(); this.splitContainer1.Panel1Collapsed = true; this.FormBorderStyle = FormBorderStyle.FixedToolWindow; this.MaximizeBox = false; return; case UIType.content: this.LoadUI(this.tabControl2, ui); break; case UIType.setting: this.LoadUI(this.tabControl2, ui); this.CheckSurface(); this.Setting(); return; case UIType.unmodeluf: Form f1 = new Form(); f1.Text = ui.pTag; var v1 = (UserControl)ui; f1.ClientSize = v1.Size; f1.ControlBox = false; f1.MaximizeBox = false; f1.FormBorderStyle = FormBorderStyle.FixedDialog; f1.Controls.Add(v1); f1.Show(); break; case UIType.modeluf: Form f2 = new Form(); f2.Text = ui.pTag; var v2 = (UserControl)ui; f2.ClientSize = v2.Size; f2.ControlBox = false; f2.MaximizeBox = false; f2.FormBorderStyle = FormBorderStyle.FixedDialog; f2.Controls.Add(v2); f2.ShowDialog(); break; case UIType.signal: Form f3 = new Form(); var v3 = (UserControl)ui; f3.StartPosition = FormStartPosition.CenterParent; f3.ClientSize = v3.Size; f3.ControlBox = false; f3.MaximizeBox = false; f3.FormBorderStyle = FormBorderStyle.FixedSingle; f3.Controls.Add(v3); f3.ShowDialog(); break; default: break; } else this.item_pNotify("_UC.Tag值不能为空或string.Empty"); this.CheckSurface(); }
void item_eClose(IUI ui) { switch (ui.pType) { case UIType.navigate: this.tabControl1.TabPages.RemoveByKey(ui.pTag); break; case UIType.tool: this.tabControl1.TabPages.RemoveByKey(ui.pTag); break; case UIType.monopolize: this.tabControl2.TabPages.RemoveByKey(ui.pTag); break; case UIType.content: this.tabControl2.TabPages.RemoveByKey(ui.pTag); break; case UIType.setting: this.tabControl2.TabPages.RemoveByKey(ui.pTag); break; case UIType.unmodeluf: var v1 = (UserControl)ui; var v2 = (Form)v1.Parent; v2.Close(); break; case UIType.modeluf: var v3 = (UserControl)ui; var v4 = (Form)v3.Parent; v4.Close(); break; case UIType.signal: var v5 = (UserControl)ui; var v6 = (Form)v5.Parent; v6.Close(); break; default: break; } this.CheckSurface(); if (ui.pIsClone) ((UserControl)ui).Dispose(); }
/// <summary> /// Initializes a new instance of the <see cref="TopCommand"/> class. /// </summary> /// <param name="ui">IUI that prints massages.</param> public TopCommand(IUI ui) : base(ui) { }
private bool LoadUI(TabControl tc, IUI p) { foreach (TabPage item in tc.TabPages) { if (item.Text == p.pTag) return false; } TabPage tp = new TabPage(p.pTag); tp.Name = p.pTag; var v = p as Control; v.Dock = DockStyle.Fill; tp.Controls.Add(v); tc.TabPages.Add(tp); tc.SelectedTab = tp; return true; }
public Class1(IUI[] uis, ICase c) : base(uis, c) { }
/// <summary> /// Initializes a new instance of the <see cref="PlayCommand"/> class. /// </summary> /// <param name="ui">IUI that prints massages.</param> public PlayCommand(IUI ui) : base(ui) { }
IUI[] AutoSerachUIs(params string[] ps) { List<IUI> ls = new List<IUI>(); foreach (var item in ps) { var v = Assembly.Load(item); foreach (var item2 in v.GetTypes()) { if (item2.GetInterface("IUI") != null) { ls.Add(item2.GetConstructor(Type.EmptyTypes).Invoke(null) as IUI); } } } IUI[] uis = new IUI[ls.Count]; ls.CopyTo(uis); return uis; }
/// <summary> /// All possible menu game command /// </summary> /// <param name="commandAsString">Command from user</param> /// <param name="ui">Takes UI(where will print data)</param> /// <param name="commandTypes">All in menu game commands</param> /// <returns>Instance of command</returns> public ICommand GetMenuCommand(string commandAsString, IUI ui, IDictionary<string, System.Type> commandTypes) { var typeCommand = commandTypes[commandAsString]; var command = (ICommand)System.Activator.CreateInstance(typeCommand, ui); return command; }
/// <summary> /// Initializes a new instance of the <see cref="MenuCommand"/> class. /// </summary> /// <param name="ui">IUI</param> public MenuCommand(IUI ui) { this.UI = ui; }
/// <summary> /// Initializes a new instance of the <see cref="ExitCommand"/> class. /// </summary> /// <param name="ui">IUI that prints massages.</param> public ExitCommand(IUI ui) : base(ui) { }
//constructure public BCommandHandler(IUI[] uis, ICase c) { this.uis = uis; this.Case = c; }
public BCaseCallbackHandler(IUI[] uis, ICase c) { this.uis = uis; this.sc = SynchronizationContext.Current; this.Case = c; }