/// <summary> /// Creates a signal with a mode and a default value. /// </summary> /// <param name="identifier">the identifier of the signal</param> /// <param name="mode">the mode of the signal</param> /// <param name="type">the type of the signal</param> /// <param name="defaultValue">the default value of the signal</param> public Signal(string identifier, ModeEnum mode, SubtypeIndication type, Expression defaultValue) : base(identifier, type) { this.defaultValue = defaultValue; Mode = mode; kind = KindEnum.DEFAULT; }
/// <summary> /// Initializes a new instance of the <see cref="Body2" /> class. /// </summary> /// <param name="mode">mode (required).</param> /// <param name="password">password (required).</param> /// <param name="remember">remember.</param> /// <param name="username">username (required).</param> public Body2(ModeEnum mode = default(ModeEnum), string password = default(string), bool?remember = default(bool?), string username = default(string)) { // to ensure "mode" is required (not null) if (mode == null) { throw new InvalidDataException("mode is a required property for Body2 and cannot be null"); } else { this.Mode = mode; } // to ensure "password" is required (not null) if (password == null) { throw new InvalidDataException("password is a required property for Body2 and cannot be null"); } else { this.Password = password; } // to ensure "username" is required (not null) if (username == null) { throw new InvalidDataException("username is a required property for Body2 and cannot be null"); } else { this.Username = username; } this.Remember = remember; }
/** * <summary>Creates a new destination within the given document context.</summary> * <param name="context">Document context.</param> * <param name="pageObject">Page reference. It may be either an actual page reference (PdfReference) * or a page index (PdfInteger).</param> * <param name="mode">Destination mode.</param> * <param name="viewParams">View parameters. Their actual composition depends on the <code>mode</code> value * (see ModeEnum for more info).</param> */ protected Destination( Document context, PdfDirectObject pageObject, ModeEnum mode, float?[] viewParams ) : base( context.File, new PdfArray() ) { PdfArray destinationObject = BaseDataObject; destinationObject.Add(pageObject); switch (mode) { case ModeEnum.Fit: destinationObject.Add(PdfName.Fit); break; case ModeEnum.FitBoundingBox: destinationObject.Add(PdfName.FitB); break; case ModeEnum.FitBoundingBoxHorizontal: destinationObject.Add(PdfName.FitBH); destinationObject.Add(PdfReal.Get(viewParams[0])); break; case ModeEnum.FitBoundingBoxVertical: destinationObject.Add(PdfName.FitBV); destinationObject.Add(PdfReal.Get(viewParams[0])); break; case ModeEnum.FitHorizontal: destinationObject.Add(PdfName.FitH); destinationObject.Add(PdfReal.Get(viewParams[0])); break; case ModeEnum.FitRectangle: destinationObject.Add(PdfName.FitR); destinationObject.Add(PdfReal.Get(viewParams[0])); destinationObject.Add(PdfReal.Get(viewParams[1])); destinationObject.Add(PdfReal.Get(viewParams[2])); destinationObject.Add(PdfReal.Get(viewParams[3])); break; case ModeEnum.FitVertical: destinationObject.Add(PdfName.FitV); destinationObject.Add(PdfReal.Get(viewParams[0])); break; case ModeEnum.XYZ: destinationObject.Add(PdfName.XYZ); destinationObject.Add(PdfReal.Get(viewParams[0])); destinationObject.Add(PdfReal.Get(viewParams[1])); destinationObject.Add(PdfReal.Get(viewParams[2])); break; } }
public async Task <Result> SetMode(ModeEnum mode, Action <int> notifyAction) { var message = string.Empty; var setting = await settingsService.GetSettings(); var powerStatus = await yamahaService.PowerStatus(); if (powerStatus == PowerStatusEnum.On) { var defaultMode = setting.ModeSettings.FirstOrDefault(x => x.Mode == mode); message = $"Default volume for mode {mode} is {defaultMode.Value}"; await yamahaService.SetVolume(defaultMode.Value); notifyAction?.Invoke(defaultMode.Value); } else { message = "Yamaha is turned off."; } return(new Result { ErrorCode = 0, Message = message, Ok = true }); }
//private Map m_Map; public FightScene(PassItem passData) { m_TimerMgr = new TimerMgr(); m_Ended = false; m_PassData = passData; m_SceneType = (SceneType)passData.sceneType; m_InNormalPassType = (m_SceneType == SceneType.NormalScene); GeneralConfigItem initPassIdConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.INIT_PASS_ID); int type = passData.id / System.Convert.ToInt32(initPassIdConfig.content); if (type == 1) { if (Global.gApp.gSystemMgr.GetPassMgr().GetCurPassId() != m_PassData.id || Global.gApp.gSystemMgr.GetPassMgr().GetHasPassedMaxPass()) { m_ModeEnum = ModeEnum.RE_NORMAL; } else { m_ModeEnum = ModeEnum.NORMAL; } } else { m_ModeEnum = ModeEnum.SPECIAL; } Global.gApp.gLightCompt.enabled = true; //m_Map = new Map(90, 90, m_MainPlayer); }
public override string ToString(ModeEnum mode) { string moduleStartHTML = getModuleStartHTML(mode); //string moduleStartHTML = "<div>"; string moduleContentHTML = Content; string moduleEndHTML = " </div>"; foreach (Tag tag in this.Tags) { string replaceValue = tag.ReplaceValue; if (replaceValue.Contains("{moduleid}")) { replaceValue = replaceValue.Replace("{moduleid}", "{0}"); } if (replaceValue.Contains("{0}")) { //vervang door module id moduleContentHTML = moduleContentHTML.Replace(tag.Name, String.Format(tag.ReplaceValue, this.ID)); } else { moduleContentHTML = moduleContentHTML.Replace(tag.Name, tag.ReplaceValue); } if (tag.HasCloseTag) { moduleContentHTML = moduleContentHTML.Replace(tag.CloseTag, tag.ReplaceValueCloseTag); } } //2do onderstaande replaces uit externe file halen op basis van type //moduleContentHTML = moduleContentHTML.Replace("{textName}", "<input type='text' id='textName'/>"); //moduleContentHTML = moduleContentHTML.Replace("{submitButton}", "<button onclick='javascript:HELLOWORLDMODULES.submit();'>OK</button>"); return(moduleStartHTML + moduleContentHTML + moduleEndHTML); }
public override string ToString(ModeEnum mode) { string content = string.Format("Popup: <br/><div style='margin:10px;' class='bitContainer' id='bitContainerModule{0}'>[CONTENT]</div>", this.ID); //content += "</div>"; return(content); }
private void HandleTimer() { if (_mode == ModeEnum.Slowdown && _timer.Interval > MaxSlowdownInterval.TotalMilliseconds) // Winning tile! { _soundEffects.PlayWinnerSound(); _timer.Stop(); _mode = ModeEnum.WinnerSelected; OnWinnerSelected?.Invoke(this, new WinnerSelectedEventArgs { WinningTile = SelectedTile, WinnerName = SelectedTile.Name, AttendeeId = SelectedTile.AttendeeId }); return; } var rand = new Random(); var randomTileIndex = rand.Next(0, Tiles.Count); SelectedTile = Tiles[randomTileIndex]; _timer.Interval = GetCurrentTimerInterval(); _soundEffects.PlayTileChangeSound(); }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.Mode = ((ModeEnum)(binaryReader.ReadInt16())); this.FrontFace = ((FrontFaceEnum)(binaryReader.ReadInt16())); return(pointerQueue); }
public static string Identifier(this AppEnum app, ModeEnum mode) { switch (app) { case AppEnum.AppleMaps: switch (mode) { case ModeEnum.Walking: return MKDirectionsMode.Walking.ToString(); case ModeEnum.Driving: case ModeEnum.Taxi:// it is supported, but there's no key for this... return MKDirectionsMode.Driving.ToString(); case ModeEnum.Transit: return MKDirectionsMode.Transit.ToString(); default: return null; } case AppEnum.GoogleMaps: switch (mode) { case ModeEnum.Walking: return "walking"; case ModeEnum.Bicycling: return "bicycling"; case ModeEnum.Driving: case ModeEnum.Taxi: // it is supported, but there's no key for this... return "driving"; case ModeEnum.Transit: return "transit"; default: return null; } default: return null; } }
/// <summary> /// 会話のモードなどから様々な処理や返信をする。 /// </summary> /// <param name="activity"></param> /// <param name="connector"></param> /// <returns></returns> private async Task ProcessActivities(Activity activity, ConnectorClient connector) { StateClient stateClient = activity.GetStateClient(); BotData userData = await stateClient.BotState.GetUserDataAsync(activity.ChannelId, activity.From.Id); ModeEnum currentMode = userData.GetProperty <ModeEnum>("mode"); ModeEnum nextMode = ModeEnum.Other; switch (currentMode) { // 報告メモを残すモードの処理 case ModeEnum.ReportActivity: nextMode = await ProcessReportActivityMode(activity, connector); break; // 上司にメールを送信するモードの処理 case ModeEnum.SendThisActivityToManager: nextMode = await ProcessSendThisActivityToManagerMode(activity, connector); break; // その他のモードでは、LUIS で意図を汲み取る処理 default: nextMode = await ProcessOtherModeWithLUIS(activity, connector); break; } userData.SetProperty <ModeEnum>("mode", nextMode); await stateClient.BotState.SetUserDataAsync(activity.ChannelId, activity.From.Id, userData); }
public ArtykulyForm(KindEnum Kind, ModeEnum Mode) { InitializeComponent(); setControlsText(); this.ActiveReason = FormActivate.faMainForm; CurrentKind = Kind; CurrentMode = Mode; loadConfig(); AuthorsToDelete = new List <string>(); KeysToDelete = new List <string>(); ShowList = false; if (CurrentKind == KindEnum.Magazine) { KindUC = new MagazineUC(); //KindUC.Location = new Point(12, 438); //this.Controls.Add(KindUC); KindUC.Location = new Point(0, 0); panel1.Controls.Add(KindUC); } else if (CurrentKind == KindEnum.Book) { KindUC = new BookUC(); //KindUC.Location = new Point(12, 438); //this.Controls.Add(KindUC); KindUC.Location = new Point(0, 0); panel1.Controls.Add(KindUC); } if (CurrentMode == ModeEnum.Edit || CurrentMode == ModeEnum.Delete) { SearchButton.Visible = true; PrintButton.Visible = true; } if (CurrentMode == ModeEnum.Delete) { DeleteButton.Visible = true; Settings.ReadOnlyMode = true; LockAll(); } if (CurrentMode == ModeEnum.ReadOnlyCatalog) { Settings.ReadOnlyMode = true; ReadOnlyForCatalog(); } ToolTip SelectToolTip = new ToolTip(); SelectToolTip.SetToolTip(SourcesButton, _translationsDictionary.getStringFromDictionary("add_attachments", "Dodaj załączniki")); keySuggest(""); }
public async Task <ModeEnum> GetAccessAreaMode(AccountTicket ticket, AreaEnum area) { var response = new ModeEnum(); var lst = await _repository.GetAreaAccess(ticket, (int)area); foreach (var item in lst) { if (item.CanCreate) { response |= ModeEnum.Create; } if (item.CanDelete) { response |= ModeEnum.Delete; } if (item.CanModify) { response |= ModeEnum.Modify; } if (item.CanRead) { response |= ModeEnum.Read; } } return(response); }
/// <summary> /// Converts a VariableModeEnumType into a ModeEnum /// </summary> /// <param name="mode"></param> /// <returns></returns> protected static ModeEnum ConvertMode(acceptor.VariableModeEnumType mode) { ModeEnum retVal = ModeEnum.Unknown; switch (mode) { case acceptor.VariableModeEnumType.aIncoming: retVal = ModeEnum.In; break; case acceptor.VariableModeEnumType.aInOut: retVal = ModeEnum.InOut; break; case acceptor.VariableModeEnumType.aInternal: retVal = ModeEnum.Internal; break; case acceptor.VariableModeEnumType.aOutgoing: retVal = ModeEnum.Out; break; } return(retVal); }
public ChooseForm(int id_rodzaj, ModeEnum Mode, string employeeID, bool Seryjne = false) { InitializeComponent(); setControlsText(); this.CurrentModeEnum = Mode; if (Mode == ModeEnum.Delete) { this.Text = _translationsDictionary.getStringFromDictionary("Usuwanie", "Usuwanie danych"); } Settings.SetSettings(id_rodzaj); Settings.Search_ID_rodzaj = id_rodzaj; this.Seryjne = Seryjne; if (Seryjne) { NewWydSerButton.Visible = true; } Settings.employeeID = employeeID; }
private RhsGroup(SymbolPosition position, string name, IEnumerable <IRhsEntity> chunks, RepetitionEnum repetition, ModeEnum mode) { this.Position = position; this.ObjName = name; if (chunks.Count() == 1 && chunks.Single().IsGroup() && chunks.Single().AsGroup().Repetition == RepetitionEnum.Once) { // there is only one chunk, so each symbol is really a chunk -- recreate the list this.elements = chunks.Single().AsGroup().Elements.ToArray(); } else { this.elements = chunks.ToArray(); } this.Repetition = repetition; this.Mode = mode; string err = findError(this.ObjName, this.Elements, this.Repetition, this.Mode); if (err != null) { throw ParseControlException.NewAndRun(err); } }
public override string ToString(ModeEnum mode) { //string drillDownUrl = this.DrillDownUrl; //if (mode == ModeEnum.EditPageMode) //{ // Guid pageid = CmsPage.GetPageIDByUrl(drillDownUrl, this.Site.ID.ToString()); // drillDownUrl = String.Format("EditPage.aspx#{0}", this.Page.ID); //} string moduleStartHTML = String.Format(@"<div id='divSearchResultsModule' class='bitModule' data-control-type='table' > <input type='hidden' id='hiddenModuleType{0}' value='{1}' />", this.ID, this.Type); string moduleEndHTML = " </div>"; string moduleContentHTML = Content; moduleContentHTML = moduleContentHTML.Replace("{}", ""); moduleContentHTML = moduleContentHTML.Replace("{Name}", "<span data-field='Name'></span>"); moduleContentHTML = moduleContentHTML.Replace("{Title}", "<span data-field='Title'></span>"); moduleContentHTML = moduleContentHTML.Replace("{Type}", "<span data-field='Type'></span>"); moduleContentHTML = moduleContentHTML.Replace("{Content}", "<span data-field='ContentFirst80Chars'></span>"); moduleContentHTML = moduleContentHTML.Replace("{DrillDownUrl}", "<a data-field='Url'>"); moduleContentHTML = moduleContentHTML.Replace("{/DrillDownUrl}", "</a>"); return(moduleStartHTML + moduleContentHTML + moduleEndHTML); }
/// <summary> /// Constructeur /// </summary> /// <param name="RefArticle"></param> public ArticleForm(string RefArticle = "") { InitializeComponent(); ConfirmButton.Enabled = false; article = new Article(); if (RefArticle == "") { Text = "Créer un nouvel article"; ConfirmButton.Text = "Ajouter l'article"; RefTextBox.ReadOnly = false; Mode = ModeEnum.Add; } else { Text = "Modifier l'article [" + RefArticle + "]"; ConfirmButton.Text = "Modifier l'article"; Mode = ModeEnum.Edit; DAOArticle daoArticle = new DAOArticle(); article = daoArticle.GetArticle(RefArticle); LoadArticle(RefArticle); } InitializeComboBox(); // Si RefArticle est vide ==> création d'un nouvel article // Sinon, récupérer l'article avec un DAO et remplir les différents champs avec les valeurs de l'article }
public void OnActionExecuting_Area_UnauthorizedResult_None (ModeEnum mode) { // Arrange var filter = new AuthorizeFilter (AreaEnum.Customer, mode); Controller = new CustomerController(null) { AccountService = AccountService, AccountTicket = AccountTicket }; var actionExecutingContext = MockHelper.ActionExecutingContext(Controller); // Act filter.OnActionExecuting(actionExecutingContext); // Assert Assert.IsNotNull(actionExecutingContext.Result); Assert.IsInstanceOf <UnauthorizedResult> (actionExecutingContext.Result); }
private StreamCryptoWrapper(ModeEnum mode, Stream stream, string password, string salt) { _Mode = mode; _Password = password; _Stream = stream; SALT = salt; byte[] saltBytes = Encoding.UTF8.GetBytes(SALT); _DerivedBytes = new Rfc2898DeriveBytes(password, saltBytes); _Aes = new AesManaged(); _Aes.Key = _DerivedBytes.GetBytes(_Aes.Key.Length); _Aes.IV = _DerivedBytes.GetBytes(_Aes.IV.Length); CryptoStreamMode streamMode; if (mode == ModeEnum.Encrypt) { _CryptoTransform = _Aes.CreateEncryptor(); streamMode = CryptoStreamMode.Write; } else if (mode == ModeEnum.Decrypt) { _CryptoTransform = _Aes.CreateDecryptor(); streamMode = CryptoStreamMode.Read; } else { throw new ArgumentOutOfRangeException("mode"); } _CryptoStream = new CryptoStream(_Stream, _CryptoTransform, streamMode); }
public List <string> GameTrackData; // holds the tracks played so far - contains unique track ID public void SetGameMode(string name) { if (ForceChallengeIndex > -1) { return; } DebugLog.Trace("Persistent.SetGameMode:" + name); GameModeID = name; switch (name) { case "winter": Mode = ModeEnum.WINTER; break; case "trucks": Mode = ModeEnum.LIGHTTRUCK; break; case "passenger": Mode = ModeEnum.PASSENGER; break; } }
public ModeSelectionItem(ModeEnum mode, string tag, string label, string icon) { Mode = mode; Tag = tag; Label = label; Icon = icon; }
public CdnGet(string contentPath, string saveToFilename, CdnGetFileComplete onGetFileComplete) { mode = ModeEnum.GetFile; this.contentPath = contentPath; onGetStringComplete = null; this.saveToFilename = saveToFilename; this.onGetFileComplete = onGetFileComplete; }
public bool Equals(ModeEnum obj) { if ((object)obj == null) { return(false); } return(StringComparer.OrdinalIgnoreCase.Equals(this.Value, obj.Value)); }
void stugmanBtn_Click(object sender, RoutedEventArgs e) { canvas1.Children.Clear(); InitialElements(); canvas1.Children.Add(testModeMenu); modeEnum = ModeEnum.Stugman; }
public NetworkService(ModeEnum a_eMode, int a_iBufferSize = BUFFER_SIZE) { Identifier = GetHashCode().ToString("X8"); Mode = a_eMode; Data = new NetworkData(a_iBufferSize); NetworkAction = null; RegisteredServer = null; }
/** * <summary>Creates a new destination within the given document context.</summary> * <param name="context">Document context.</param> * <param name="page">Page reference. It may be either a <see cref="Page"/> or a page index (int). * </param> * <param name="mode">Destination mode.</param> * <param name="location">Destination location.</param> * <param name="zoom">Magnification factor to use when displaying the page.</param> */ protected Destination(Document context, object page, ModeEnum mode, object location, double?zoom) : base(context, new PdfArray(null, null)) { Page = page; Mode = mode; Location = location; Zoom = zoom; }
/////////////////////////////////////////// public Component_Terrain_EditingMode(Component_Scene_DocumentWindow documentWindow, ModeEnum mode, object modeExtensionData = null) : base(documentWindow) { this.mode = mode; this.modeExtensionData = modeExtensionData; scene = documentWindow.Scene; }
public NetworkService(ModeEnum Mode, int a_iBufferSize = BUFFER_SIZE) { this.Identifier = GetHashCode().ToString("X8"); this.Mode = Mode; this.Data = new NetworkData(a_iBufferSize); this.NetworkAction = null; this.RegisteredServer = null; }
public Physics2DContactTestItem(Rectangle bounds, Category collisionCategories = Category.Category1, Category collidesWith = Category.All, int collisionGroup = 0, ModeEnum mode = ModeEnum.All) { CollisionCategories = collisionCategories; CollidesWith = collidesWith; CollisionGroup = collisionGroup; Mode = mode; Bounds = bounds; }
/// <summary> /// Detailed constructor. /// </summary> public ModifyOrderControl(ModeEnum mode, ActiveOrder order) { InitializeComponent(); _provider = order.OrderExecutionProvider; _mode = mode; _order = order; _dataProvider = order.QuoteProvider; _dataProvider.QuoteUpdateEvent += new QuoteProviderUpdateDelegate(_dataProvider_QuoteUpdateEvent); _session = order.SessionInfo.Value; }
public void Button1_MouseDownHandler(object sender, MouseButtonEventArgs e) { _currentMode = ModeEnum.X; _wasUpdating = TreeNode.Updating; _mouseDownValue = (Quaternion)TreeNode.Property; TreeNode.Updating = false; Mouse.Capture(Button1); var p = e.GetPosition(Button1); _mouseDownPosition = new Vector2((float)p.X, (float)p.Y); _isDragging = true; }
public LocalDestination( Page page, ModeEnum mode, double?[] viewParams ) : base(page.Document, page.BaseObject, mode, viewParams) { }
public RemoteDestination( Document context, int pageIndex, ModeEnum mode, double?[] viewParams ) : base(context, new PdfInteger(pageIndex), mode, viewParams) { }
public LocalDestination( Page page, ModeEnum mode, object location, double? zoom ) : base(page.Document, page, mode, location, zoom) { }
public RemoteDestination( Document context, int pageIndex, ModeEnum mode, object location, double? zoom ) : base(context, pageIndex, mode, location, zoom) { }
protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); if (e.Button == MouseButtons.Left) { switch (_mode) { case ModeEnum.Selecting: SelectWidgets(); break; case ModeEnum.Moving: MoveWidgets(); break; } } _mode = ModeEnum.Default; RenderControls(); }
/// <summary> /// Capture mouse position when left mouse button is pressed /// </summary> /// <param name="e"></param> protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); // buffer = GetScreen(GetDesignRect()) _pivot = PointToDesignClient(new Point(_rawMouse.X, _rawMouse.Y)); if (_rawMouse.X < GetMargin()) { if (_pivot.Y < BandCount) { if (e.Button == MouseButtons.Left) _model.Bands.Insert(_pivot.Y); else _model.Bands.Remove(_pivot.Y); CheckVerticalScolling(); Invalidate(); } } else if (_pivot.Y < BandCount && e.Button == MouseButtons.Left) { BaseWidget w = GetWidgetAt(_pivot); if (_selections.Hit(_pivot)) { // we clicked the current selection // so we prepare to move it around _mode = ModeEnum.Moving; _prevSelectionRect = _selections.GetRectangle(); RemoveSelectedFromHost(); } else if (w != null) { // we clicked on a widget so we place // it on the selection list and // start moving it around. if (!isCtrlPressed) _selections.Clear(); _selections.Add(w); w.IsSelected = true; RemoveSelectedFromHost(); OnSelectionChanged(); _mode = ModeEnum.Moving; _prevSelectionRect = _selections.GetRectangle(); } else { _mode = ModeEnum.Selecting; } } UpdateView(); }
public void Start(String targetDB, bool isMove, ModeEnum modeType) { if (isMove) { Title = Catalog.GetString("Move Caches..."); copyLabel.Markup = Catalog.GetString("Moving Geocaches"); } List <Geocache> caches; if (modeType == CopyingProgress.ModeEnum.VISIBLE) { caches = UIMonitor.getInstance().GetVisibleCacheList(); } else if (modeType == CopyingProgress.ModeEnum.SELECTED) { caches = new List<Geocache>(); caches.Add(UIMonitor.getInstance().SelectedCache); } else { caches = Engine.getInstance().Store.GetCaches(0,0); } CacheStore target = new CacheStore(); CacheStore source = Engine.getInstance().Store; targetDBLabel.Text = targetDB; double count = 0; total = caches.Count; target.SetDB(targetDB); if (target.NeedsUpgrade()) { MessageDialog dlg = new MessageDialog(null, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok, Catalog.GetString("The target database needs to be upgraded. " + "Please open the target database before trying to copy/move caches.")); dlg.Run(); dlg.Hide(); this.Hide(); return; } buttonOk.Visible = false; List<String> str = new List<String>(); foreach(Geocache c in caches) { str.Add(c.Name); } IDbTransaction trans = target.StartUpdate(); target.ClearAttributes(str); target.ClearTBs(str); foreach(Geocache cache in caches) { if (cancel) { target.CancelUpdate(trans); this.Hide(); this.Dispose(); return; } count++; UpdateProgress(count, cache.Name); target.AddCache(cache); target.AddWaypoint(cache); List<CacheLog> logs = source.GetCacheLogs(cache.Name); //target.ClearLogs(cache.Name); foreach(CacheLog log in logs) { System.Console.WriteLine("Adding logs"); target.AddLog(cache.Name, log); } List<Waypoint> children = source.GetChildren(cache.Name); foreach (Waypoint child in children) { target.AddWaypoint(child); } List<CacheAttribute> attributes = source.GetAttributes(cache.Name); foreach (CacheAttribute attribute in attributes) { target.AddAttribute(attribute, cache.Name); } if (isMove) source.DeleteGeocacheAtomic(cache); } statusLabel.Markup = Catalog.GetString("<i>Complete</i>"); progressBar.Text = Catalog.GetString("Complete"); buttonOk.Visible = true; buttonCancel.Visible = false; target.EndUpdate(trans); }
/// <summary> /// Create a NPC. /// AGXNASK distribution has npAgent move following a Path. /// </summary> /// <param name="theStage"> the world</param> /// <param name="label"> name of </param> /// <param name="pos"> initial position </param> /// <param name="orientAxis"> initial rotation axis</param> /// <param name="radians"> initial rotation</param> /// <param name="meshFile"> Direct X *.x Model in Contents directory </param> public NPAgent(Stage theStage, string label, Vector3 pos, Vector3 orientAxis, float radians, string meshFile) : base(theStage, label, pos, orientAxis, radians, meshFile) { IsCollidable = true; first.Name = "npFirst"; follow.Name = "npFollow"; above.Name = "npAbove"; // initialize all treasures InitializeMarkTreasures(); // initialize treasure path queue treasurePathQueue = new Queue<Path>(); // initialize exploring path queue explorePathQueue = new Queue<Path>(); // add all predefined path to explore path queue // AddPathToExploreQueue(); Path initialPath = new Path(stage, MakeExploringPaths(), Path.PathType.SINGLE, true); // set it to current path currentPath = initialPath; // set the mode mode = ModeEnum.EXPLORING; npAgentGameMode = Stage.GameMode.NP_AGENT_EXPLORING; stage.Components.Add(currentPath); nextGoal = currentPath.NextNode; agentObject.TurnToFace(nextGoal.Translation); }
public void Button2_MouseDownHandler(object sender, MouseButtonEventArgs e) { currentMode = ModeEnum.L; WasUpdating = TreeNode.Updating; mouseDownModeValue = GetCurrentModeValue(); // Get the current vector direction so we can scale it mouseDownDirection = (Vector2)TreeNode.Property; if (mouseDownDirection != Vector2.Zero) mouseDownDirection.Normalize(); else mouseDownDirection = Vector2.Normalize(Vector2.One); TreeNode.Updating = false; Mouse.Capture(Button2); System.Windows.Point p = e.GetPosition(Button2); downPosition = new Vector2((float)p.X, (float)p.Y); isDragging = true; }
public void Button1_MouseDownHandler(object sender, MouseButtonEventArgs e) { currentMode = ModeEnum.XY; WasUpdating = TreeNode.Updating; mouseDownModeValue = GetCurrentModeValue(); TreeNode.Updating = false; Mouse.Capture(Button1); System.Windows.Point p = e.GetPosition(Button1); downPosition = new Vector2((float)p.X, (float)p.Y); isDragging = true; }
////////////////////////////////////////////////////////////////////////////////////////////// // SelectEvent lets the user pick up vertex or workpoint // ////////////////////////////////////////////////////////////////////////////////////////////// void SelectEvents_OnSelect(ObjectsEnumerator JustSelectedEntities, SelectionDeviceEnum SelectionDevice, Point ModelPosition, Point2d ViewPosition, View View) { switch (_mode) { case ModeEnum.kPoint1: { _point1 = ModelPosition; _mode = ModeEnum.kPoint2; _interactionManager.InteractionEvents.StatusBarText = "Select dimension second point: "; break; } case ModeEnum.kPoint2: { _point2 = ModelPosition; Vector normal = View.Camera.Eye.VectorTo(View.Camera.Target); _dimData = DrawDimension(_point1, _point2, ModelPosition, normal); _clientGraphicsMng.UpdateView(); _interactionManager.InteractionEvents.StatusBarText = "Select dimension text position: "; _interactionManager.MouseEvents.MouseMoveEnabled = true; _interactionManager.SelectEvents.OnSelect -= new SelectEventsSink_OnSelectEventHandler(SelectEvents_OnSelect); _interactionManager.MouseEvents.OnMouseDown += new MouseEventsSink_OnMouseDownEventHandler(MouseEvents_OnMouseDown); _interactionManager.MouseEvents.OnMouseMove += new MouseEventsSink_OnMouseMoveEventHandler(MouseEvents_OnMouseMove); _mode = ModeEnum.kDimText; break; } default: break; } }
public void Button3_MouseDownHandler(object sender, MouseButtonEventArgs e) { _currentMode = ModeEnum.Yz; _wasUpdating = TreeNode.Updating; _mouseDownModeValue = GetCurrentModeValue(); TreeNode.Updating = false; Mouse.Capture(Button3); var p = e.GetPosition(Button3); _downPosition = new Vector2((float)p.X, (float)p.Y); _isDragging = true; }
private void HandleTreasureMode() { if (treasurePathQueue.Count == 0) { // switch mode mode = ModeEnum.EXPLORING; npAgentGameMode = Stage.GameMode.NP_AGENT_EXPLORING; // resume to previous exploring path if any if (previousPath != null && !previousPath.Done) { currentPath = previousPath; // nextGoal = currentPath.NextNode; // agentObject.TurnToFace(nextGoal.Translation); } else { HandleExploringMode(); } } else { // get another path from treasure path queue currentPath = treasurePathQueue.Dequeue(); // add path to stage two show trace stage.Components.Add(currentPath); // get first path goal nextGoal = currentPath.NextNode; // orient towards the first path goal agentObject.TurnToFace(nextGoal.Translation); } }
public override void HandleEvents(Event e) { base.HandleEvents(e); if (On && DTHandles.MouseOverSceneView) { Mode = ModeEnum.None; if (e.control && !e.alt) // Prevent that Panning (CTRL+ALT+LMB) creates CP'S { Mode = ModeEnum.Add; if (e.shift) Mode |= ModeEnum.Pick; } if (e.type == EventType.MouseDown) { if (Mode.HasFlag(ModeEnum.Add)) { addCP(e.mousePosition, Mode.HasFlag(ModeEnum.Pick), e.button == 1); DTGUI.UseEvent(GetHashCode(),e); } } if (Mode.HasFlag(ModeEnum.Add)) { if (Mode.HasFlag(ModeEnum.Pick)) _StatusBar.Set("<b>[LMB]</b> Add Control Point <b>[RMB]</b> Add & Smart Connect","DrawMode"); else _StatusBar.Set("<b>[Shift]</b> Raycast <b>[LMB]</b> Add Control Point <b>[RMB]</b> Add & Smart Connect", "DrawMode"); } else _StatusBar.Set("Hold <b>[Ctrl]</b> to add Control Points", "DrawMode"); } else _StatusBar.Clear("DrawMode"); }
/// <summary> /// /// </summary> public LineObject(string name, ModeEnum mode) : base(name) { _mode = mode; }
/// <summary> /// Here we allow switching from regular path to treasure path if only if /// the treasure path is not done, otherwise it will do nothing (disable) /// </summary> private void ChangeToTreasurePath(int idx) { AddNewTreasurePath(idx); // save the previous path if any if (mode == ModeEnum.EXPLORING) { if (!currentPath.Done) { previousPath = currentPath; } } // update the mode mode = ModeEnum.TREASURE_HUNTING; // set new path currentPath = treasurePathQueue.Dequeue(); // add path to stage stage.Components.Add(currentPath); // get the first target nextGoal = currentPath.NextNode; // orient towards the first path goal agentObject.TurnToFace(nextGoal.Translation); }
public void Button4_MouseDownHandler(object sender, MouseButtonEventArgs e) { _currentMode = ModeEnum.L; _wasUpdating = TreeNode.Updating; _mouseDownModeValue = GetCurrentModeValue(); // Get the current vector direction so we can scale it _mouseDownDirection = (Vector3)TreeNode.Property; if (_mouseDownDirection != Vector3.Zero) _mouseDownDirection.Normalize(); else _mouseDownDirection = Vector3.Normalize(Vector3.One); TreeNode.Updating = false; Mouse.Capture(Button4); var p = e.GetPosition(Button4); _downPosition = new Vector2((float)p.X, (float)p.Y); _isDragging = true; }
public void Start(String targetDB, bool isMove, ModeEnum modeType, OCMMainWindow win) { if (isMove) { Title = Catalog.GetString ("Move Caches..."); copyLabel.Markup = Catalog.GetString ("Moving Geocaches"); } List<Geocache> caches; if (modeType == CopyingProgress.ModeEnum.VISIBLE) { caches = win.CacheList.UnfilteredCaches; } else if (modeType == CopyingProgress.ModeEnum.SELECTED) { caches = new List<Geocache> (); caches.Add (win.CacheList.SelectedCache); } else { caches = null; //caches = new List<Geocache> (UIMonitor.getInstance ().CacheStore.GetUnfilteredCaches(0d,0d,new string[0])); } ACacheStore target = new FileStore (targetDB); ACacheStore source = win.App.CacheStore; targetDBLabel.Text = targetDB; double count = 0; total = caches.Count; if (target.NeedsUpgrade) { MessageDialog dlg = new MessageDialog(null, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok, Catalog.GetString("The target database needs to be upgraded. " + "Please open the target database before trying to copy/move caches.")); dlg.Run(); dlg.Hide(); this.Hide(); return; } buttonOk.Visible = false; List<String> str = new List<String>(); foreach(Geocache c in caches) { str.Add(c.Name); } target.StartUpdate(); target.PurgeAllLogs(str.ToArray()); target.PurgeAllAttributes(str.ToArray()); target.PurgeAllTravelBugs(str.ToArray()); foreach(Geocache cache in caches) { if (cancel) { target.CancelUpdate(); this.Hide(); this.Dispose(); return; } count++; UpdateProgress(count, cache.Name); target.AddWaypointOrCache(cache, false, false); List<CacheLog> logs = source.GetCacheLogs(cache.Name); foreach(CacheLog log in logs) { target.AddLog(cache.Name, log); } List<Waypoint> children = source.GetChildWaypoints(new string[]{cache.Name}); foreach (Waypoint child in children) { target.AddWaypointOrCache(child, false, false); } CacheAttribute[] attributes = source.GetAttributes(cache.Name); foreach (CacheAttribute attribute in attributes) { target.AddAttribute(cache.Name,attribute); } if (isMove) source.DeleteWaypoint(cache.Name); } statusLabel.Markup = Catalog.GetString("<i>Complete</i>"); progressBar.Text = Catalog.GetString("Complete"); buttonOk.Visible = true; buttonCancel.Visible = false; target.CompleteUpdate(); }
/// <summary> /// 执行动作 /// </summary> public void DoAction(ModeEnum mode, ActionEnum action) { Reset(); startTicks = DateTime.Now.Ticks; LumbarRobotController.RobotController.ControlCommand.PauseCmd(); Thread.Sleep(10); LumbarRobotController.RobotController.ControlCommand.PauseCmd(); Thread.Sleep(10); if (mode == ModeEnum.Fit) { if (action == ActionEnum.Bend || action == ActionEnum.Protrusive || action == ActionEnum.ProtrusiveOrBend) { if (bendStretchFitAction == null) { bendStretchFitAction = new BendStretchFitAction(); bendStretchFitAction.StartAction += new EventHandler(action_StartAction); } bendStretchFitAction.Mode = mode; bendStretchFitAction.Action = action; currentControl = bendStretchFitAction; } else if(action == ActionEnum.Rotation) { if (rotateFitAction == null) { rotateFitAction = new RotateFitAction(); rotateFitAction.StartAction += new EventHandler(action_StartAction); } rotateFitAction.Mode = mode; rotateFitAction.Action = action; currentControl = rotateFitAction; } } else if (mode == ModeEnum.StrengthEvaluation) { if (action == ActionEnum.Bend || action == ActionEnum.Protrusive || action == ActionEnum.ProtrusiveOrBend) { if (bendStrechStrengthEvaluationAction == null) { bendStrechStrengthEvaluationAction = new BendStrechStrengthEvaluationAction(); bendStrechStrengthEvaluationAction.StartAction += new EventHandler(action_StartAction); bendStrechStrengthEvaluationAction.SetForce += new SetForceHandler(action_SetForce); } bendStrechStrengthEvaluationAction.Mode = mode; bendStrechStrengthEvaluationAction.Action = action; currentControl = bendStrechStrengthEvaluationAction; } else if (action == ActionEnum.Rotation) { if (rotateStrengthEvaluationAction == null) { rotateStrengthEvaluationAction = new RotateStrengthEvaluationAction(); rotateStrengthEvaluationAction.StartAction += new EventHandler(action_StartAction); rotateStrengthEvaluationAction.SetForce += new SetForceHandler(action_SetForce); } rotateStrengthEvaluationAction.Mode = mode; rotateStrengthEvaluationAction.Action = action; currentControl = rotateStrengthEvaluationAction; } } else { if (action == ActionEnum.Bend) { if (mode == ModeEnum.Sokoban || mode == ModeEnum.Free || mode == ModeEnum.FreeConstantResistance || mode == ModeEnum.FreeCounterWeight || mode == ModeEnum.Dengsu || mode == ModeEnum.Lixin) { if (bendStretchFreeAction == null) { bendStretchFreeAction = new BendStretchFreeAction(); bendStretchFreeAction.NextTime += new EventHandler(action_NextTime); bendStretchFreeAction.StopAction += new EventHandler(action_StopAction); bendStretchFreeAction.StartAction += new EventHandler(action_StartAction); } //bendStretchFreeAction.ModeEnum = mode; //bendStretchFreeAction.ActionEnum = action; currentControl = bendStretchFreeAction; } else if (mode == ModeEnum.Guided) { if (bendStretchGuidedAction == null) { bendStretchGuidedAction = new BendStretchGuidedAction(); bendStretchGuidedAction.NextTime += new EventHandler(action_NextTime); bendStretchGuidedAction.StopAction += new EventHandler(action_StopAction); bendStretchGuidedAction.StartAction += new EventHandler(action_StartAction); } currentControl = bendStretchGuidedAction; } else if (mode == ModeEnum.Initiated) { if (bendStretchAssistedAction == null) { bendStretchAssistedAction = new BendStretchAssistedAction(); } currentControl = bendStretchAssistedAction; } else if (mode == ModeEnum.IsotonicA) { if (isotonicAAction == null) { isotonicAAction = new IsotonicAAction(); isotonicAAction.SetForce += new SetForceHandler(action_SetForce); isotonicAAction.NextTime += new EventHandler(action_NextTime); isotonicAAction.StartAction += new EventHandler(action_StartAction); isotonicAAction.StopAction += new EventHandler(action_StopAction); } isotonicAAction.Type = 0; currentControl = isotonicAAction; } else if (mode == ModeEnum.IsotonicB) { if (isotonicBAction == null) { isotonicBAction = new IsotonicBAction(); isotonicBAction.NextTime += new EventHandler(action_NextTime); isotonicBAction.SetForce += new SetForceHandler(action_SetForce); isotonicBAction.StartAction += new EventHandler(action_StartAction); isotonicBAction.StopAction += new EventHandler(action_StopAction); } isotonicBAction.Type = 0; currentControl = isotonicBAction; } } else if (action == ActionEnum.Protrusive) { if (mode == ModeEnum.Sokoban || mode == ModeEnum.Free || mode == ModeEnum.FreeConstantResistance || mode == ModeEnum.FreeCounterWeight || mode == ModeEnum.Dengsu || mode == ModeEnum.Lixin) { if (bendStretchFreeAction == null) { bendStretchFreeAction = new BendStretchFreeAction(); bendStretchFreeAction.NextTime += new EventHandler(action_NextTime); bendStretchFreeAction.StopAction += new EventHandler(action_StopAction); bendStretchFreeAction.StartAction += new EventHandler(action_StartAction); } //bendStretchFreeAction.ModeEnum = mode; //bendStretchFreeAction.ActionEnum = action; currentControl = bendStretchFreeAction; } else if (mode == ModeEnum.Guided) { if (bendStretchGuidedAction == null) { bendStretchGuidedAction = new BendStretchGuidedAction(); bendStretchGuidedAction.NextTime += new EventHandler(action_NextTime); bendStretchGuidedAction.StopAction += new EventHandler(action_StopAction); bendStretchGuidedAction.StartAction += new EventHandler(action_StartAction); } currentControl = bendStretchGuidedAction; } else if (mode == ModeEnum.Initiated) { if (bendStretchAssistedAction == null) { bendStretchAssistedAction = new BendStretchAssistedAction(); } currentControl = bendStretchAssistedAction; } else if (mode == ModeEnum.IsotonicA) { if (isotonicAAction == null) { isotonicAAction = new IsotonicAAction(); isotonicAAction.SetForce += new SetForceHandler(action_SetForce); isotonicAAction.NextTime += new EventHandler(action_NextTime); isotonicAAction.StartAction += new EventHandler(action_StartAction); isotonicAAction.StopAction += new EventHandler(action_StopAction); } isotonicAAction.Type = 0; currentControl = isotonicAAction; } else if (mode == ModeEnum.IsotonicB) { if (isotonicBAction == null) { isotonicBAction = new IsotonicBAction(); isotonicBAction.NextTime += new EventHandler(action_NextTime); isotonicBAction.SetForce += new SetForceHandler(action_SetForce); isotonicBAction.StartAction += new EventHandler(action_StartAction); isotonicBAction.StopAction += new EventHandler(action_StopAction); } isotonicBAction.Type = 0; currentControl = isotonicBAction; } } else if (action == ActionEnum.ProtrusiveOrBend) { if (mode == ModeEnum.Sokoban || mode == ModeEnum.Free || mode == ModeEnum.FreeConstantResistance || mode == ModeEnum.FreeCounterWeight || mode == ModeEnum.Dengsu || mode == ModeEnum.Lixin) { if (bendStretchFreeAction == null) { bendStretchFreeAction = new BendStretchFreeAction(); bendStretchFreeAction.NextTime += new EventHandler(action_NextTime); bendStretchFreeAction.StopAction += new EventHandler(action_StopAction); bendStretchFreeAction.StartAction += new EventHandler(action_StartAction); } //bendStretchFreeAction.ModeEnum = mode; //bendStretchFreeAction.ActionEnum = action; currentControl = bendStretchFreeAction; } else if (mode == ModeEnum.Guided) { if (bendStretchGuidedAction == null) { bendStretchGuidedAction = new BendStretchGuidedAction(); bendStretchGuidedAction.NextTime += new EventHandler(action_NextTime); bendStretchGuidedAction.StopAction += new EventHandler(action_StopAction); bendStretchGuidedAction.StartAction += new EventHandler(action_StartAction); } currentControl = bendStretchGuidedAction; } else if (mode == ModeEnum.Initiated) { if (bendStretchAssistedAction == null) { bendStretchAssistedAction = new BendStretchAssistedAction(); } currentControl = bendStretchAssistedAction; } else if (mode == ModeEnum.IsotonicA) { if (isotonicAAction == null) { isotonicAAction = new IsotonicAAction(); isotonicAAction.SetForce += new SetForceHandler(action_SetForce); isotonicAAction.NextTime += new EventHandler(action_NextTime); isotonicAAction.StartAction += new EventHandler(action_StartAction); isotonicAAction.StopAction += new EventHandler(action_StopAction); } isotonicAAction.Type = 0; currentControl = isotonicAAction; } else if (mode == ModeEnum.IsotonicB) { if (isotonicBAction == null) { isotonicBAction = new IsotonicBAction(); isotonicBAction.SetForce += new SetForceHandler(action_SetForce); isotonicBAction.NextTime += new EventHandler(action_NextTime); isotonicBAction.StartAction += new EventHandler(action_StartAction); isotonicBAction.StopAction += new EventHandler(action_StopAction); } isotonicBAction.Type = 0; currentControl = isotonicBAction; } } else if (action == ActionEnum.Rotation) { if (mode == ModeEnum.Sokoban || mode == ModeEnum.Free || mode == ModeEnum.FreeConstantResistance || mode == ModeEnum.FreeCounterWeight || mode == ModeEnum.Dengsu || mode == ModeEnum.Lixin) { if (rotateFreeAction == null) { rotateFreeAction = new RotateFreeAction(); rotateFreeAction.NextTime += new EventHandler(action_NextTime); rotateFreeAction.StopAction += new EventHandler(action_StopAction); rotateFreeAction.StartAction += new EventHandler(action_StartAction); } //rotateFreeAction.ModeEnum = mode; currentControl = rotateFreeAction; } else if (mode == ModeEnum.Guided) { if (rotateGuidedAction == null) { rotateGuidedAction = new RotateGuidedAction(); rotateGuidedAction.NextTime += new EventHandler(action_NextTime); rotateGuidedAction.StopAction += new EventHandler(action_StopAction); rotateGuidedAction.StartAction += new EventHandler(action_StartAction); } currentControl = rotateGuidedAction; } else if (mode == ModeEnum.Initiated) { if (rotateAssistedAction == null) { rotateAssistedAction = new RotateAssistedAction(); } currentControl = rotateAssistedAction; } else if (mode == ModeEnum.IsotonicA) { if (isotonicAAction == null) { isotonicAAction = new IsotonicAAction(); isotonicAAction.SetForce += new SetForceHandler(action_SetForce); isotonicAAction.NextTime += new EventHandler(action_NextTime); isotonicAAction.StartAction += new EventHandler(action_StartAction); isotonicAAction.StopAction += new EventHandler(action_StopAction); } isotonicAAction.Type = 1; currentControl = isotonicAAction; } else if (mode == ModeEnum.IsotonicB) { if (isotonicBAction == null) { isotonicBAction = new IsotonicBAction(); isotonicBAction.SetForce += new SetForceHandler(action_SetForce); isotonicBAction.NextTime += new EventHandler(action_NextTime); isotonicBAction.StartAction += new EventHandler(action_StartAction); isotonicBAction.StopAction += new EventHandler(action_StopAction); } isotonicBAction.Type = 1; currentControl = isotonicBAction; } } } if (currentControl != null) { currentControl.Mode = mode; currentControl.Action = action; currentControl.Controller = this; currentControl.Start(); } }