/// <summary> /// This method Handle Options /// </summary> internal void HandleOptions() { // Set the Game Options this.GameManager = LoadGameManager(); // if the GameManager exists if (this.HasGameManager) { // iterate the players foreach (Player player in this.GameManager.Players) { // Find the blackJackPlayerControl at this seat number BlackJackPlayerControl blackJackPlayerControl = FindBlackJackPlayerControl(player.SeatNumber); // If the blackJackPlayerControl object exists if (NullHelper.Exists(blackJackPlayerControl)) { // Setup the blackJackPlayerControl blackJackPlayerControl.DisplayPlayer(); } } // Show or hide controls based upon the number of players UIVisibility(); } }
/// <summary> /// This method converts an ICardCountingSystem to a CardCoutnignView object. /// </summary> /// <param name="countingSystem"></param> /// <returns></returns> public static CountingSystemView Convert(ICardCountingSystem countingSystem) { // initial value CountingSystemView countingSystemView = null; // If the countingSystem object exists if (NullHelper.Exists(countingSystem)) { // Create a new instance of a 'CountingSystemView' object. countingSystemView = new CountingSystemView(); // Set the value for each property countingSystemView.Balanced = countingSystem.BalancedSystem; countingSystemView.Name = countingSystem.Name; countingSystemView.Level = ConvertLevel(countingSystem.Level); countingSystemView.Notes = countingSystem.Notes; // Now set the Card Values; we have to set each value with a red and black card in case this // counting system returns different values. countingSystemView.Ace = ConvertCard(CardEnum.Ace, countingSystem); countingSystemView.Two = ConvertCard(CardEnum.Two, countingSystem); countingSystemView.Three = ConvertCard(CardEnum.Three, countingSystem); countingSystemView.Four = ConvertCard(CardEnum.Four, countingSystem); countingSystemView.Five = ConvertCard(CardEnum.Five, countingSystem); countingSystemView.Six = ConvertCard(CardEnum.Six, countingSystem); countingSystemView.Seven = ConvertCard(CardEnum.Seven, countingSystem); countingSystemView.Eight = ConvertCard(CardEnum.Eight, countingSystem); countingSystemView.Nine = ConvertCard(CardEnum.Nine, countingSystem); countingSystemView.Ten = ConvertCard(CardEnum.Ten, countingSystem); } // return value return(countingSystemView); }
/// <summary> /// event is fired when Button _ Enable Changed /// </summary> private void Button_EnableChanged(object sender, EventArgs e) { // cast the sender as a button Button button = sender as Button; // If the button object exists if (NullHelper.Exists(button)) { // if the button is enabled if (button.Enabled) { // Use the enabled image button.BackgroundImage = Properties.Resources.WoodButtonWidth2560; // use black button.ForeColor = Color.Black; } else { // Use the disabled image button.BackgroundImage = Properties.Resources.WoodButtonWidth2560Disabled; // use DarkGray button.ForeColor = Color.DarkGray; } } }
/// <summary> /// This method returns the Chips /// </summary> private static List <ImageEx> AddChips(List <ImageEx> chips, ChipEnum chip, ref double amount) { // local int chipValue = 0; // If the chips object exists if ((NullHelper.Exists(chips)) && (chip != ChipEnum.Unknown) && (amount > 0)) { // get the chipValue chipValue = (int)chip; // if the amount is greater than this chip if (amount >= chipValue) { do { // Create the image based upo the chip type Image chipPic = new Bitmap(GetChipImage(chip), new Size(24, 24)); // Cast the chipImage as an ImageEx ImageEx chipImage = new ImageEx(chipPic); // Ad this image chips.Add(chipImage); // subtract the value of htis chip from amount amount -= chipValue; } while (amount >= chipValue); } } // return value return(chips); }
/// <summary> /// event is fired when Ignore Folders List Box _ Key Down /// </summary> private void IgnoreFoldersListBox_KeyDown(object sender, KeyEventArgs e) { // if the delete key was pressed if ((e.KeyCode == Keys.Delete) && (this.HasIgnoreExceptions) && (this.IgnoreFoldersListBox.SelectedItem != null)) { // cast the SelectedItem as an IgnoreFolderException IgnoreFolderException exception = this.IgnoreFoldersListBox.SelectedItem as IgnoreFolderException; // If the exception object exists if (NullHelper.Exists(exception)) { // attempt to find the index of the selected exception int index = this.IgnoreExceptions.IndexOf(exception); // if the index was found if (index >= 0) { // remove this exception this.IgnoreExceptions.RemoveAt(index); // Display the exceptions this.DisplayExceptions(null); } } } }
/// <summary> /// This method returns a list of Field Set Fields View /// </summary> public static List <DTNField> LoadFieldSetFields(int fieldSetId) { // initial value List <DTNField> fields = null; // locals List <FieldSetFieldView> fieldSetFields = null; // If the value for fieldSetId is greater than zero if (fieldSetId > 0) { // Create a new instance of a 'Gateway' object. Gateway gateway = new Gateway(); // find the fieldSet FieldSet fieldSet = gateway.FindFieldSet(fieldSetId); // If the fieldSet object exists if (NullHelper.Exists(fieldSet)) { // load the field set field view for this fieldSetId fieldSetFields = gateway.LoadFieldSetFieldViewsByFieldSetId(fieldSetId); // If the fieldSetFields collection exists and has one or more items if (ListHelper.HasOneOrMoreItems(fieldSetFields)) { // convert the fields to a view fields = DataConverter.ConvertDataFields(fieldSetFields, fieldSet.DatabaseId, fieldSet.ProjectId, fieldSet.TableId); } } } // return value return(fields); }
/// <summary> /// event is fired when Button _ Enable Changed /// </summary> private void Button_EnableChanged(object sender, EventArgs e) { // cast the sender as a button Button button = sender as Button; // if the cast was successful if (NullHelper.Exists(button)) { // If the value for the property button.Enabled is true if (button.Enabled) { // Use the enabled image button.BackgroundImage = Properties.Resources.WoodButtonWidth640; button.ForeColor = Color.Black; } else { button.BackgroundImage = Properties.Resources.WoodButtonWidth640Disabled; button.ForeColor = Color.DimGray; } } // update the UI Refresh(); }
/// <summary> /// method returns the /// </summary> public void Register(IBlazorComponent component) { // If the component object exists if (NullHelper.Exists(component)) { // if this is the VideoPlayer in case other components end up on this page if (component is BlazorVideoPlayer) { // Store the VideoPlayer this.VideoPlayer = component as BlazorVideoPlayer; } // Add this component this.Children.Add(component); // Create a new instance of a 'NamedParameter' object. NamedParameter namedParameter = new NamedParameter(); // Set the Name namedParameter.Name = "JSRuntime"; namedParameter.Value = JSRuntime; // Create a message DataJuggler.Blazor.Components.Message message = new DataJuggler.Blazor.Components.Message(); // add the parameter message.Parameters.Add(namedParameter); // Send the message component.ReceiveData(message); } }
/// <summary> /// This method Create Members With EF /// </summary> public List <EF.Member> CreateMembersWithEF() { // initial value List <EF.Member> members = new List <EF.Member>(); // local EF.Member member = null; // iterate the MembersToCreate for (int x = 0; x < info.MembersToCreate; x++) { // Create the member with EF member = CreateMemberWithEF(); // If the member object exists if (NullHelper.Exists(member)) { // add this member members.Add(member); } } // return value return(members); }
/// <summary> /// This method Unsubscribe /// </summary> public void Unsubscribe(Guid id) { // if the value for HasSubscribers is true if ((HasSubscribers) && (Subscribers.Count > 0)) { // attempt to find this callback SubscriberCallback callback = Subscribers.FirstOrDefault(x => x.Id == id); // If the callback object exists if (NullHelper.Exists(callback)) { // Remove this item Subscribers.Remove(callback); // create a new message SubscriberMessage message = new SubscriberMessage(); // set the message return properties message.FromId = ServerId; message.FromName = "Subscriber Service"; message.Text = callback.Name + " has left the conversation."; message.ToId = Guid.Empty; message.ToName = "Room"; message.IsSystemMessage = true; // Broadcast the message to everyone BroadcastMessage(message); } } }
/// <summary> /// This method Broadcasts a Message to everyone that ins't blocked. /// What it actually does is notify the Listener that they need to get new messages. /// Note To Self: Add Blocked Feature. /// </summary> public void BroadcastMessage(SubscriberMessage message) { // if the value for HasSubscribers is true if ((HasSubscribers) && (NullHelper.Exists(message))) { // if this is a System Message if (!message.IsSystemMessage) { // if there are already messages if (ListHelper.HasOneOrMoreItems(messages)) { // Insert at the top Messages.Insert(0, message); } else { // Add this message Messages.Add(message); } } // Iterate the collection of SubscriberCallback objects foreach (SubscriberCallback subscriber in Subscribers) { // Send to everyone but this user if ((subscriber.HasCallback) && (subscriber.Id != message.FromId)) { // to do: Add if not blocked // send the message subscriber.Callback(message); } } } }
/// <summary> /// method returns a message with their id /// </summary> public SubscriberMessage Subscribe(SubscriberCallback subscriber) { // initial value SubscriberMessage message = null; // If the subscriber object exists if ((NullHelper.Exists(subscriber)) && (HasSubscribers)) { // Add this item Subscribers.Add(subscriber); // return a test message for now message = new SubscriberMessage(); // set the message return properties message.FromName = "Subscriber Service"; message.FromId = ServerId; message.ToName = subscriber.Name; message.ToId = subscriber.Id; message.Data = Subscribers.Count.ToString(); message.Text = "Subscribed"; } // return value return(message); }
/// <summary> /// The Selected has changed. /// </summary> /// <param name="control"></param> /// <param name="selectedIndex"></param> /// <param name="selectedItem"></param> public void OnSelectedIndexChanged(LabelComboBoxControl control, int selectedIndex, object selectedItem) { // If the control object exists if ((NullHelper.Exists(control, Options)) && (control.HasSelectedObject)) { // if this is the ConversionTypeControl if (control.Name == ConversionTypeControl.Name) { // Set the conversionType string conversionType = control.SelectedObject.ToString(); // Set the ConversionType on the Options object Options.ConversionType = ParseConversionType(conversionType); } else if (control.Name == OutputOptionControl.Name) { // Set the outputOption string outputOption = control.SelectedObject.ToString(); // Set the OutputOption on the Options object Options.OutputOption = ParseOutputOption(outputOption); } } // Enable or disable controls UIControl(); }
/// <summary> /// The Selected has changed. /// </summary> /// <param name="control"></param> /// <param name="selectedIndex"></param> public void OnTextChanged(Control control, string text) { // first attempt casting the control as LabelTextBoxControl LabelTextBoxControl sender = control as LabelTextBoxControl; // if the sender and Options objects both exist if (NullHelper.Exists(sender, Options)) { // if this is the ResolutionControl if (sender.Name == ResolutionControl.Name) { // Set the Resolution Options.Resolution = NumericHelper.ParseInteger(text, 0, -1); } } // now try LabelTextBoxBrowserControl LabelTextBoxBrowserControl sender2 = control as LabelTextBoxBrowserControl; // if the sender2 and Options objects both exist if (NullHelper.Exists(sender2, Options)) { // verify we have the correct control if (sender2.Name == DirectoryControl.Name) { // Set the Directory Options.Directory = text; } } // Enable or disable the StartButton UIControl(); }
/// <summary> /// This method Find Layer Index /// </summary> public int FindLayerIndex(Layer layer) { // initial value int index = -1; // local int tempIndex = -1; // If the value for the property .HasPixelDatabase is true if ((NullHelper.Exists(layer)) && (HasPixelDatabase) && (PixelDatabase.HasLayers)) { // iterate the layers foreach (Layer tempLayer in PixelDatabase.Layers) { // Increment the value for tempIndex tempIndex++; // if this name is the correct one if (layer.Name == tempLayer.Name) { // set the return value index = tempIndex; // break out of the loop break; } } } // return value return(index); }
/// <summary> /// This method Create Members With DTN /// </summary> public List <DTN.Member> CreateMembersWithDTN() { // initial value List <DTN.Member> members = null; // local DTN.Member member = null; // if the data has been loaded if ((ShufflersCreated) && (DataLoaded) && (info.MembersToCreate > 0)) { // create the members members = new List <DTN.Member>(); // iterate the MembersToCreate for (int x = 0; x < info.MembersToCreate; x++) { // Create the member with DTN member = CreateMemberWithDTN(); // If the member object exists if (NullHelper.Exists(member)) { // add this member members.Add(member); } } } // return value return(members); }
/// <summary> /// This method returns the Component Registered /// </summary> public bool IsComponentRegistered(IBlazorComponent component) { // initial value bool isComponentRegistered = false; // if the value for HasChildren is true if ((HasChildren) && (NullHelper.Exists(component))) { // Iterate the collection of IBlazorComponent objects foreach (IBlazorComponent child in Children) { // if the names match if (TextHelper.IsEqual(component.Name, child.Name)) { // set the return value isComponentRegistered = true; // break out of the loop break; } } } // return value return(isComponentRegistered); }
/// <summary> /// This event is fired when Grid _ Cell Content Click /// </summary> private void Grid_CellContentClick(object sender, DataGridViewCellEventArgs e) { // Get the columnIndex int columnIndex = e.ColumnIndex; // if this is the LinkButton if (e.ColumnIndex == 0) { // we must get the name of the selected System string systemName = FindSystemName(e.RowIndex); // If the systemName string exists if (TextHelper.Exists(systemName)) { // Find this system ICardCountingSystem selectedSystem = CardCountingSystemFactory.FindCardCountingSystem(systemName); // If the selectedSystem object exists if (NullHelper.Exists(selectedSystem)) { // get the helpLink string helpLink = selectedSystem.HelpLink; // if the helpLink exists if (TextHelper.Exists(helpLink)) { // Open a browser wined System.Diagnostics.Process.Start(helpLink); } } } } }
/// <summary> /// This method returns the Item Index /// </summary> public int FindItemIndex(object item) { // initial value int itemIndex = -1; // local int tempIndex = -1; // if the item exists if (NullHelper.Exists(item)) { // iterate the items in the list foreach (object listItem in ListBox.Items) { // Increment the value for tempIndex tempIndex++; // if the two items are equal if (TextHelper.IsEqual(listItem.ToString(), item.ToString())) { // set the return value itemIndex = tempIndex; // exit this foreach loop break; } } } // return value return(itemIndex); }
/// <summary> /// event is fired when Code Items List Box _ Item Check /// </summary> private void CodeItemsListBox_ItemCheck(object sender, ItemCheckEventArgs e) { // if not loading if (!this.Loading) { // get the listBox CheckedListBox listBox = sender as CheckedListBox; // if the ListBox exists if (NullHelper.Exists(listBox)) { // if Checked if (e.NewValue == CheckState.Checked) { // Do not Exclude since this file is checked this.ProjectFileManager.Files[e.Index].Exclude = false; } else if (e.NewValue == CheckState.Unchecked) { // Exclude since this file is unchecked this.ProjectFileManager.Files[e.Index].Exclude = true; } } } }
/// <summary> /// This event is fired when the 'SaveButton' is clicked. /// </summary> private void SaveButton_Click(object sender, EventArgs e) { // Capture the Game Manager from this form this.GameManager = CaptureGameManager(); // If the GameManager object exists (should always be true) if (this.HasGameManager) { // if the values needs to be saved on this computer if (gameManager.HouseRules.SaveSettingsOnThisComputer) { // The gameManager needs to be converted to a SecureUserData (ApplicationSettings) object. SecureUserData security = SecureUserDataFactory.Convert(gameManager); // If the security object exists if (NullHelper.Exists(security)) { // set the LastSavedDate security.LastSavedDate = DateTime.Now; // save the values in the settings security.Save(); } } // The user did not cancel this.UserCancelled = false; // Close this form this.Close(); } }
/// <summary> /// event is fired when On Text Changed /// </summary> public void OnTextChanged(Control control, string text) { // if the value for HasConnectionInfo is true if (HasConnectionInfo) { // cast the control as a LabelTextBox LabelTextBoxControl textBox = control as LabelTextBoxControl; // If the textBox object exists if (NullHelper.Exists(textBox)) { // determine the action by the name switch (textBox.Name) { case "DatabaseServerControl": // Set the value for DatabaseServer ConnectionInfo.DatabaseServer = text; // required break; case "DatabaseNameControl": // Set the value for DatabaseName ConnectionInfo.DatabaseName = text; // required break; case "DatabaseUserControl": // Set the value for DatabaseUserName ConnectionInfo.DatabaseUserName = text; // required break; case "DatabasePasswordControl": // Set the value for DatabasePassword ConnectionInfo.DatabasePassword = text; // required break; case "x": // set the connection string ConnectionInfo.ConnectionString = text; // required break; } } } // Enable or disable ncontrols UIControl(); }
// <Summary> // This method is used to export a ForeignKeyConstraint object to xml. // </Summary> public string ExportForeignKeyConstraint(ForeignKeyConstraint foreignKeyConstraint, int indent = 0) { // initial value string foreignKeyConstraintXml = ""; // locals string indentString = TextHelper.Indent(indent); string indentString2 = TextHelper.Indent(indent + 2); // If the foreignKeyConstraint object exists if (NullHelper.Exists(foreignKeyConstraint)) { // Create a StringBuilder StringBuilder sb = new StringBuilder(); // Append the indentString sb.Append(indentString); // Write the open foreignKeyConstraint node sb.Append("<ForeignKeyConstraint>" + Environment.NewLine); // Write out each property // Write out the value for ForeignKey sb.Append(indentString2); sb.Append("<ForeignKey>" + foreignKeyConstraint.ForeignKey + "</ForeignKey>" + Environment.NewLine); // Write out the value for Name sb.Append(indentString2); sb.Append("<Name>" + foreignKeyConstraint.Name + "</Name>" + Environment.NewLine); // Write out the value for ReferencedColumn sb.Append(indentString2); sb.Append("<ReferencedColumn>" + foreignKeyConstraint.ReferencedColumn + "</ReferencedColumn>" + Environment.NewLine); // Write out the value for ReferencedTable sb.Append(indentString2); sb.Append("<ReferencedTable>" + foreignKeyConstraint.ReferencedTable + "</ReferencedTable>" + Environment.NewLine); // Write out the value for Table sb.Append(indentString2); sb.Append("<Table>" + foreignKeyConstraint.Table + "</Table>" + Environment.NewLine); // Append the indentString sb.Append(indentString); // Write out the close foreignKeyConstraint node sb.Append("</ForeignKeyConstraint>" + Environment.NewLine); // set the return value foreignKeyConstraintXml = sb.ToString(); } // return value return(foreignKeyConstraintXml); }
/// <summary> /// The delete button was clicked. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DeleteButton_Click(object sender, EventArgs e) { // if the SelectedReference exists if (NullHelper.Exists(SelectedReference, SelectedReferencesSet)) { // get a local value ProjectReference reference = this.SelectedReference; // get the index int index = this.SelectedReferencesSet.GetReferenceIndex(reference.ReferencesId); // delete the reference Gateway gateway = new Gateway(); // delete the ProjectReference bool deleted = gateway.DeleteProjectReference(this.SelectedReference.ReferencesId); // if deleted if (deleted) { // remove this item this.SelectedReferencesSet.References.RemoveAt(index); // redisplay the references this.DisplayReferences(); } } }
/// <summary> /// This method converts a DTNField to a DataField. /// </summary> public static DataField ConvertDataField(DTNField sourceField) { // initial value DataField field = null; // If the sourceField object exists if (NullHelper.Exists(sourceField)) { // Create a new instance of a 'DTNField' object. field = new DataField(); // Set each property field.AccessMode = (DataManager.AccessMode)sourceField.AccessMode; field.Caption = sourceField.Caption; // Both enums derive from int, so the double cast converts the Enum types field.DataType = (DataManager.DataTypeEnum)sourceField.DataType; field.DecimalPlaces = sourceField.DecimalPlaces; field.DefaultValue = sourceField.DefaultValue; field.FieldName = sourceField.FieldName; field.FieldOrdinal = sourceField.FieldOrdinal; field.Size = sourceField.FieldSize; field.PrimaryKey = sourceField.PrimaryKey; field.Required = sourceField.Required; field.Scope = (DataManager.Scope)sourceField.Scope; field.Exclude = sourceField.Exclude; } // return value return(field); }
/// <summary> /// This event is fired AFTER the dataTable is parsed. /// </summary> /// <param name="xmlNode"></param> /// <param name="dataTable"></param> /// <returns>True if cancelled else false if not.</returns> public bool Parsed(XmlNode xmlNode, ref DataTable dataTable) { // initial value bool cancel = false; // If the dataTable object exists if (NullHelper.Exists(xmlNode, dataTable)) { // Create a new instance of an 'IndexesParser' object. IndexesParser indexesParser = new IndexesParser(); // Parse the Indexes dataTable.Indexes = indexesParser.ParseDataIndexs(xmlNode); // Create a new instance of a 'DataFieldsParser' object. DataFieldsParser dataFieldsParser = new DataFieldsParser(); // Parse the Fields dataTable.Fields = dataFieldsParser.ParseDataFields(xmlNode); // Create a new instance of a 'ForeignKeyConstraintsParser' object. ForeignKeyConstraintsParser foreignKeysParser = new ForeignKeyConstraintsParser(); // Parse the ForeignKeys dataTable.ForeignKeys = foreignKeysParser.ParseForeignKeyConstraints(xmlNode); } // return value return(cancel); }
/// <summary> /// This event is fired AFTER the storedProcedure is parsed. /// </summary> /// <param name="xmlNode"></param> /// <param name="storedProcedure"></param> /// <returns>True if cancelled else false if not.</returns> public bool Parsed(XmlNode xmlNode, ref StoredProcedure storedProcedure) { // initial value bool cancel = false; // If the storedProcedure object exists if (NullHelper.Exists(storedProcedure)) { // Decode the text storedProcedure.Text = XmlPatternHelper.Decode(storedProcedure.Text); // Create a new instance of a 'StoredProcedureParametersParser' object. StoredProcedureParametersParser parametersParser = new StoredProcedureParametersParser(); // load the parameters if available storedProcedure.Parameters = parametersParser.ParseStoredProcedureParameters(xmlNode); // Create a new instance of a 'DataFieldsParser' object. ReturnSetSchemaParser returnSetSchemaParser = new ReturnSetSchemaParser(); // load the ReturnSetSchema if available storedProcedure.ReturnSetSchema = returnSetSchemaParser.ParseDataFields(xmlNode); } // return value return(cancel); }
/// <summary> /// This method returns the Primary Key for a table. /// This method is for single field Primary Keys, not /// Composite primary keys consisting of multiple fields. /// You can manually add a second jparameter if needed for now. /// </summary> public DTNField FindPrimaryKey(DTNTable table) { // initial value DTNField primaryKey = null; // if the table has fields if ((NullHelper.Exists(table)) && (table.HasFields)) { // iterate the fields foreach (DTNField field in table.Fields) { // the field is a PrimaryKey if (field.PrimaryKey) { // set the reeturn value primaryKey = field; // no reason to stick around until multiple primary key fields is handled. break; } } } // return value return(primaryKey); }
/// <summary> /// This method is called by the Login control after a login attempt. /// </summary> /// <param name="loginResponse"></param> private async void LoginComplete(LoginResponse loginResponse) { // If the loginResponse object exists if (NullHelper.Exists(loginResponse)) { // if the login was successful if (loginResponse.Success) { // Erase any messages this.Message = ""; // Set the artist this.Artist = loginResponse.Artist; // if we do not have a Gallerymanager if (!HasGalleryManager) { // Create a new instance of a 'GalleryManager' object. this.GalleryManager = new GalleryManager(this); } // Set the Artist this.GalleryManager.Artist = this.Artist; // Load the Artists in case this is a new artist this.GalleryManager.Artists = await ArtistService.GetArtistList(); // Call Refresh Refresh(); } } }
/// <summary> /// method Sign Up /// </summary> public ActionResult SignUp(Notification notification) { // if the notification.EmailAddress exists if ((NullHelper.Exists(notification)) && (TextHelper.Exists(notification.EmailAddress))) { // Create a new instance of a 'Gateway' object. Gateway gateway = new Gateway(); // check if exists Notification existingNotification = gateway.FindNotificationByEmailAddress(notification.EmailAddress); // If the existingNotification object does not exist if (NullHelper.IsNull(existingNotification)) { // perform the save bool saved = gateway.SaveNotification(ref notification); // if saved if (saved) { bool isNew = notification.IsNew; } } } // to do: return signed up user. return(View()); }