public static void PerformAction(ActionElementType actionElementType, string xPath, string value = "", ActionType actionType = ActionType.SET) { switch (actionElementType) { case ActionElementType.INPUT: { if (actionType.Equals(ActionType.GET)) { value = InputGetHelper(xPath); } if (actionType.Equals(ActionType.SET)) { InputSetHelper(xPath, value); } if (actionType.Equals(ActionType.CLEAR)) { InputClearHelper(xPath); } break; } case ActionElementType.INPUT_FILE: { InputFileHelper(xPath, value); break; } case ActionElementType.TABLE_CELL_LINK: { TableCellLinkHelper(xPath); break; } case ActionElementType.CHECKBOX: { CheckboxHelper(xPath); break; } case ActionElementType.DROPDOWNLIST: { DropdownHelper(xPath, value); break; } case ActionElementType.BUTTON: case ActionElementType.LINK: { ButtonHelper(xPath); break; } case ActionElementType.FORM: { FormHelper(xPath); break; } case ActionElementType.HIDDEN_INPUT_FILE: { HiddenInputFileHelper(xPath, value); break; } } }
public void Load(EmployeeDTO employeeParam, ActionType actionTypeParam) { actionType = actionTypeParam; Employee = employeeParam; if (actionType.Equals(ActionType.ModifyEmployee)) { IsModifying = true; } if (actionType.Equals(ActionType.ChangeEmployeePoint)) { IsModifyingFinalPoint = true; } getEmployeeCustomFields(); }
public void OnNotify(ISubject subject, ActionType actionType = ActionType.Unspeficied) { if (actionType.Equals(ActionType.GameStarts)) { SetNextMaterial(); } }
public override bool Equals(object obj) { var otherPermission = (PermissionDto)obj; if (!otherPermission.Area.Equals(this.Area, StringComparison.InvariantCultureIgnoreCase)) { return(false); } if (!otherPermission.Domain.Equals(this.Domain, StringComparison.InvariantCultureIgnoreCase)) { return(false); } if (string.IsNullOrEmpty(ActionType)) { if (string.IsNullOrEmpty(Action)) { return(Controller.Equals(otherPermission.Controller, StringComparison.InvariantCultureIgnoreCase)); } return(Controller.Equals(otherPermission.Controller, StringComparison.InvariantCultureIgnoreCase) && Action.Equals(otherPermission.Action, StringComparison.InvariantCultureIgnoreCase)); } return(Controller.Equals(otherPermission.Controller, StringComparison.InvariantCultureIgnoreCase) && Action.Equals(otherPermission.Action, StringComparison.InvariantCultureIgnoreCase) && ActionType.Equals(otherPermission.ActionType, StringComparison.InvariantCultureIgnoreCase)); }
private void DownloadVideos(ActionType action) { if (checkboxChecked()) { PopulateUrlDownloadList(); foreach (string url in UrlDowloadList) { var title = playlistVideos.Find(url).Title; bool downloaded = download.DownloadMethod1(action, title, url, downloadPath); if (action.Equals(ActionType.Convert) && downloaded) { Converter.ConvertMP4ToMP3(downloadPath, title); File.Delete(Path.Combine(downloadPath, title + ".mp4")); } } DialogResult remove = MessageBox.Show("Downloads competed. Some of your videos may not have been downloaded due to copyrights." + "\n\n" + "Do you want to remove all downloaded videos from your YouTube playlist?", "Update Playlist", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (remove == DialogResult.Yes) { removeDownloads(); repopulateVideoList(); } } else { MessageBox.Show("Please select a video to download.", "Selection Required", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
public ProgressBarWindow(ActionType action, string title, string filepath) { tb_action.Text = action.Equals(ActionType.Download) ? "Downloading..." : "Converting..."; tb_filename.Text += title; tb_destination.Text += filepath; pb_progressbar.Minimum = 0; pb_progressbar.Maximum = 100; }
public bool DownloadMethod1(ActionType action, string title, string url, string path) { try { /* * Get the available video formats. * We'll work with them in the video and audio download examples. */ IEnumerable <VideoInfo> videoInfos = DownloadUrlResolver.GetDownloadUrls(url); // Select the first .mp4 video with the highest resolution VideoInfo video = videoInfos.First(info => { if (action.Equals(ActionType.Download)) { return(info.VideoType == VideoType.Mp4 && (info.Resolution == 720 || info.Resolution == 480 || info.Resolution == 360)); } else { return(info.VideoType == VideoType.Mp4 && info.Resolution == 360); } }); //If the video has a decrypted signature, decipher it if (video.RequiresDecryption) { DownloadUrlResolver.DecryptDownloadUrl(video); } /* * Create the video downloader. * The first argument is the video to download. * The second argument is the path to save the video file. */ var videoDownloader = new VideoDownloader(video, Path.Combine(path, video.Title + video.VideoExtension)); // Register the ProgressChanged event and return current progress to ProgressBar // TODO: only use if WPF or implement progress bar for WF videoDownloader.DownloadProgressChanged += (sender, args) => EventHandler(this, new ProgressBarEventArgs(args.ProgressPercentage)); /* * Execute the video downloader. * For GUI applications note, that this method runs synchronously. */ videoDownloader.Execute(); return(true); } catch (Exception) { return(false); } }
// Updates changes in the database public void UpdateChanges(SalonDbEntities entities, DbContextTransaction transaction, string id, string table, ActionType actionType) { if (!actionType.Equals("INSERT")) { entities.SaveChanges(); } // Update log information Log.Update(id, table, actionType); transaction.Commit(); }
/// <summary> /// Constructor for a new action with multiple lines affected. /// </summary> /// <param name="theAction">The type of action, if it is ActionType.Start the affectedIDs will be ignored.</param> /// <param name="affectedID">The IDs of the lines affected.</param> public SketchAction(ActionType theAction, HashSet <int> affectedIDs) { thisAction = theAction; if (theAction.Equals(ActionType.Start)) { lineIDs = new HashSet <int>(); } else { lineIDs = new HashSet <int>(affectedIDs); } }
private void UpdateUIForAction(ActionType action) { if (action.Equals(ActionType.Details)) { NamePanel.Visibility = Visibility.Collapsed; PicAndNamePanel.Visibility = Visibility.Visible; } else if (action.Equals(ActionType.Add)) { PicAndNamePanel.Visibility = Visibility.Collapsed; NamePanel.Visibility = Visibility.Visible; } else if (action.Equals(ActionType.Update)) { PicAndNamePanel.Visibility = Visibility.Visible; NamePanel.Visibility = Visibility.Visible; } else if (action.Equals(ActionType.Delete)) { PicAndNamePanel.Visibility = Visibility.Visible; NamePanel.Visibility = Visibility.Collapsed; } }
public bool IsActionAllowed(Player player, ActionType actionType) { // Destroy and none are free if (actionType.Equals(ActionType.Destroy) || actionType.Equals(ActionType.None)) { return(true); } // Get the correct building from the buildings list Action action = actions.First(actionListItem => actionListItem.GetActionType().Equals(actionType)); // Check if resource requirements are met if (action.GetStoneCost() <= player.GetStone() && action.GetWoodCost() <= player.GetWood() && action.GetWheatCost() <= player.GetWheat() && action.GetDragonCost() <= player.GetDragonAttacks()) { return(true); } else { return(false); } }
public bool Start(ActionType action, string title, string url, string path) { var downloaded = false; while (!downloaded) { downloaded = download.DownloadMethod1(action, title, url, path); download.EventHandler += (sender, args) => SetProgressValue(args.ProgressPercentage); } if (action.Equals(ActionType.Convert) && downloaded) { Converter.ConvertMP4ToMP3(path, title); File.Delete(Path.Combine(path, title + ".mp4")); } return(downloaded); }
public string ToJson(string formId) { if (ActionType.Equals(HTTP_POST_ACTION_TYPE, StringComparison.OrdinalIgnoreCase)) { return(GenerateHttpPostConfig(formId)); } else if (ActionType.Equals(AJAX_POST_ACTION_TYPE, StringComparison.OrdinalIgnoreCase)) { // TO IMPLEMENT //return generateAjaxPostConfig(formId); return(""); } else { return(""); } }
/// <summary> /// Returns true if MerchantAction instances are equal /// </summary> /// <param name="other">Instance of MerchantAction to be compared</param> /// <returns>Boolean</returns> public bool Equals(MerchantAction other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( ActionType == other.ActionType || ActionType != null && ActionType.Equals(other.ActionType) ) && ( FormFields == other.FormFields || FormFields != null && FormFields.SequenceEqual(other.FormFields) ) && ( RedirectData == other.RedirectData || RedirectData != null && RedirectData.Equals(other.RedirectData) ) && ( RenderingData == other.RenderingData || RenderingData != null && RenderingData.Equals(other.RenderingData) ) && ( ShowData == other.ShowData || ShowData != null && ShowData.SequenceEqual(other.ShowData) )); }
void Interaction(MousePointer pointer, MouseButton btn, ActionType act) { //Ne se passe plus rien sur le click droit if (btn == MouseButton.RIGHT_BUTTON) { return; } if (act.Equals(ActionType.PRESSED)) { pointer.obj.GetComponent <Image>().enabled = true; } Dictionary <Interactable, Vector3> output = new Dictionary <Interactable, Vector3>(); Vector3 position = pointer.obj.transform.position; position += new Vector3(-pointer.obj.GetComponent <RectTransform>().rect.width * 0.166f, pointer.obj.GetComponent <RectTransform>().rect.width * 0.5f, 0); Ray ray = pointer.cam.ScreenPointToRay(new Vector3(position.x, position.y, 0.01f)); bool interactibleHit = true; EmptyFB col = null; var hits = Physics.RaycastAll(ray).OrderBy(x => Vector3.Distance(x.point, pointer.cam.transform.position)); foreach (RaycastHit hit in hits) { Interactable inter = hit.collider.GetComponent <Interactable>(); if (inter) { output[inter] = hit.point; interactibleHit = false; if (inter.Block) { break; } } if (col == null) { col = hit.transform.GetComponent <EmptyFB>(); } } if (interactibleHit && act.Equals(ActionType.PRESSED) && hits.Count <RaycastHit>() != 0) { if (failParticle == null) { Debug.Log("Didn't have particle"); } if (failParticle != null && col != null) { Debug.Log("Here it's " + hits.ElementAt <RaycastHit>(0).transform.name); ParticleSystem pS = Instantiate(failParticle, hits.ElementAt <RaycastHit>(0).point, Quaternion.identity, this.transform).GetComponent <ParticleSystem>(); Manager.GetInstance().PlaySound(pointer, "Play_click_mouse"); pS.startColor = col.fdBackColor; } } PointerEventData point = new PointerEventData(GetComponent <EventSystem>()); point.position = position; //IMPORTANT #if !UNITY_EDITOR if (pointer.cam == camera2) { point.position += new Vector2(camera1.pixelWidth, 0); } #endif //Same but for UI List <RaycastResult> results = new List <RaycastResult>(); pointer.canv.GetComponent <GraphicRaycaster>().Raycast(point, results); foreach (RaycastResult result in results) { if (result.gameObject.GetComponent <Interactable>()) { output[result.gameObject.GetComponent <Interactable>()] = Vector3.zero; } } Interpret(btn, act, output, pointer); }
void Interpret(MouseButton mouseBtn, ActionType act, Dictionary <Interactable, Vector3> allGob, MousePointer mouse) { Manager.GetInstance().RefreshTimer(); if (allGob.Keys.Where(x => x.IsHandCursor()).Count() > 0) { mouse.obj.GetComponent <Image>().sprite = holdSprite; } else { mouse.obj.GetComponent <Image>().sprite = defaultSprite; } if (act.Equals(ActionType.PRESSED)) { allGob.Keys.ToList().ForEach(x => { if (x.CanInteract) { mouse.lastCollisionPoint = allGob[x]; x.MouseDown(mouseBtn, mouse); if (x.Echo) { x.Echo.MouseDown(mouseBtn, mouse, x); } } }); mouse.holding = allGob.Keys.ToList(); } if (act.Equals(ActionType.RELEASED)) { mouse.holding.ForEach(x => { if (x.CanInteract) { if (mouse.holding.Contains(x)) { x.MouseUp(mouseBtn, mouse); if (x.Echo) { x.Echo.MouseUp(mouseBtn, mouse, x); } } } }); mouse.holding.Clear(); } if (act.Equals(ActionType.MOVEMENT)) { //Just entering foreach (Interactable inter in allGob.Keys) { if (!mouse.pointing.Contains(inter)) { if (inter.CanInteract) { inter.MouseEnter(MouseButton.NONE, mouse); if (inter.Echo) { inter.Echo.MouseEnter(MouseButton.NONE, mouse, inter); } } } } //Just exiting foreach (Interactable inter in mouse.pointing) { if (!allGob.Keys.ToList().Contains(inter)) { if (inter.CanInteract) { inter.MouseLeave(MouseButton.NONE, mouse); if (inter.Echo) { inter.Echo.MouseLeave(MouseButton.NONE, mouse, inter); } } } } mouse.holding.ForEach(x => { if (x.CanInteract) { x.MouseMove(mouseBtn, mouse); if (x.Echo) { x.Echo.MouseMove(mouseBtn, mouse, x); } } }); } }
// Function used to indicate (green / red) if an action can be performed on the currently highlighted tile public bool IsCurrentActionAllowedOnTile(Tile tile, Player currentPlayer) { // Test if a road can be build on this tile if (tile.IsFree() && (tile.HasNeighbourTileBuilding(currentPlayer) || tile.HasNeighbourTileRoad(currentPlayer)) && currentAction.Equals(ActionType.Road) && IsActionAllowed(currentPlayer, currentAction)) { return(true); } // Test if a house can be build on this tile if (turnManager.GetGamePhase().Equals(GamePhase.BuildPhase)) { // During buildphase, houses do not need to be placed next to an existing road if (tile.IsFree() && !tile.HasNeighbourTileBuilding(currentPlayer) && currentAction.Equals(ActionType.House) && IsActionAllowed(currentPlayer, currentAction)) { return(true); } } else if (turnManager.GetGamePhase().Equals(GamePhase.PlayPhase)) { // During playphase, houses must be placed next to an existing road if (tile.IsFree() && !tile.HasNeighbourTileBuilding(currentPlayer) && tile.HasNeighbourTileRoad(currentPlayer) && currentAction.Equals(ActionType.House) && IsActionAllowed(currentPlayer, currentAction)) { return(true); } } if (currentAction.Equals(ActionType.Trader) && tile.woodhouse && tile.owner == currentPlayer && IsActionAllowed(currentPlayer, currentAction)) { return(true); } // Test if the constructed object can be destroyed if ((tile.isRoad || tile.woodhouse) && tile.owner == currentPlayer && currentAction.Equals(ActionType.Destroy) && IsActionAllowed(currentPlayer, currentAction)) { return(true); } // The dragon can always be sent to any tile if (currentAction.Equals(ActionType.Dragon) && IsActionAllowed(currentPlayer, currentAction)) { return(true); } return(false); }
private void SaveButtonClick(object sender, EventArgs e) { try { if (App.IsTrial) { //messagebox to prompt to buy var buyAppForSaveFriendMessageBox = new CustomMessageBox { Height = 300, Caption = AppResources.BuyFullVersion, Message = AppResources.BuyAppForAddFriend, LeftButtonContent = AppResources.BuyLabel, RightButtonContent = AppResources.LaterLabel, VerticalAlignment = VerticalAlignment.Center }; buyAppForSaveFriendMessageBox.Dismissed += BuyAppForSaveFriendBoxDismissed; buyAppForSaveFriendMessageBox.Show(); return; } if (String.IsNullOrEmpty(NameTextBox.Text) || !BirthdayPicker.Value.HasValue) { MessageBox.Show(AppResources.WarnNameBdayCompulsory, AppResources.WarnDtlsReq, MessageBoxButton.OK); return; } //display status message StatusText.Text = AppResources.SavingFrndDtls; ContentStackPanel.Opacity = 0.2; StatusPanel.Visibility = Visibility.Visible; int friendGuid; if (Action.Equals(ActionType.Add)) { friendGuid = AddNewFriend(); MessageBox.Show(AppResources.NewFrndCreatedMsg, AppResources.NewFrndAddedTitle, MessageBoxButton.OK); } else { friendGuid = UpdateFriend(); MessageBox.Show(AppResources.FrndDtlsUpdated, AppResources.FrndDtlsUpdatedTitle, MessageBoxButton.OK); } //change the app bar buttons FriendEntity = BirthdayUtility.GetFriendDetailsById(friendGuid); AddAppBarButtons(FriendEntity); //remove focus from textbox RemoveFocus(); } catch (Exception ex) { MessageBox.Show(ex.Message, AppResources.ErrSavingFrndDtls, MessageBoxButton.OK); } finally { //hide status screen StatusPanel.Visibility = Visibility.Collapsed; ContentStackPanel.Opacity = 1; } }
public ActionResult FormSubmit(RequestCreationMatrix model, ActionType actionType) { try { if (Session["CurrentUserID"] == null) { throw new Exception(Resources.RequestCreationMatrix.Alert_SessionIsNull); } model.ModifiedBy = new Guid(Session["CurrentUserID"].ToString()); model.RequestStatus = 5; /*Always "Closed", Confrimed By RCH*/ if (ModelState.IsValid) { KeyValuePair <int, string> results = new KeyValuePair <int, string>(1, ""); if (actionType.Equals(ActionType.Create)) { model.RequestCreationMatrixID = Guid.NewGuid(); results = db.RequestCreationMatrix_Insert(model); } else if (actionType.Equals(ActionType.Edit)) { results = db.RequestCreationMatrix_Update(model); } else if (actionType.Equals(ActionType.ChangeStatus)) { results = db.RequestCreationMatrix_ChangeStatus(model); } else if (actionType.Equals(ActionType.Delete)) { results = db.RequestCreationMatrix_Delete(model); } if (results.Key == 0 || results.Key == 16 || results.Key == 6) { UrlHelper u = new UrlHelper(this.ControllerContext.RequestContext); string controllerName = this.ControllerContext.RouteData.Values["Controller"].ToString(); string url = u.Action("Edit", controllerName, new { id = model.RequestCreationMatrixID, success = Resources.RequestCreationMatrix.Alert_SubmissionSuccess }); string urlNew = u.Action("Create", controllerName); var jsonData = new { flag = true, Message = url, urlNew = urlNew }; return(Json(jsonData)); } else { throw new Exception(results.Value.ToString()); } } else { string errorMessage = string.Empty; foreach (var key in ModelState.Keys) { var error = ModelState[key].Errors.FirstOrDefault(); if (error != null) { errorMessage = error.ErrorMessage; break; } } throw new Exception(errorMessage); } } catch (Exception e) { var jsonData = new { flag = false, Message = e.Message }; return(Json(jsonData)); } }