public void LoadData() { // get all MidiChannels foreach (Midi.Channel val in Enum.GetValues(typeof(Midi.Channel))) { midiChannels.Add(new MidiChannel(val)); } // get all MidiControls foreach (Midi.Control val in Enum.GetValues(typeof(Midi.Control))) { midiControls.Add(new MidiControl(val)); } // get MidiDevices ReadOnlyCollection <OutputDevice> outputDevices = OutputDevice.InstalledDevices; foreach (OutputDevice mDevice in outputDevices) { midiDevices.Add(new MidiDevice(mDevice)); } // get PowerMates List <HidDevice> hidDevices = HidDevices.Enumerate(VendorId, ProductId).ToList(); // build Mates List int dc = 0; foreach (HidDevice d in hidDevices) { Mates.Add(new Mate(d, midiDevices[0], midiControls[5], midiChannels[dc])); dc++; } }
static void Main(string[] args) { //Hay que importar la biblioteca y además, incluir el namespace. //Si la biblioteca cambia, hay que recompilarla y se genera de nuevo el dll. //Si se usa desde la misma solución, generalmente no hay problemas. Pero si se usan desde otra solución o proyecto, se recomienda //además, reimportar la biblioteca. Mates mismates = new Mates(5, 4); double resultado = mismates.suma(); Console.WriteLine("El resultado de la suma es {0}", resultado); Console.ReadKey(); }
public bool AddMate(Mates currentMate) { foreach (var mate in prevMates) { if (mate.MateId == currentMate.MateId) { return(false); } } prevMates.Add(currentMate); return(true); }
private async void btnSearch_Click(object sender, RoutedEventArgs e) { string Lname = txtLastName.Text.ToString(); string Fname = txtFirstName.Text.ToString(); string Zip = txtZip.Text.ToString(); string City = txtCity.Text.ToString(); string State = txtState.Text.ToString(); ResultMate = Search(Lname, Fname, City, State); if (ResultMate.id is null) { await new MessageDialog("No results returned, please check your spelling and try again").ShowAsync(); } else { this.Frame.Navigate(typeof(Results)); } }
public Mates Search(string Lname, string Fname, string City, string State) { Mates newMate = new Mates(); SqlConnection conn = new SqlConnection(MainPage.connString); conn.Open(); string selectSql = "select * from Mate where Fname = '" + Fname + "' and Lname = '" + Lname + "' and City = '" + City + "' and State = '" + State + "'"; SqlCommand com = new SqlCommand(selectSql, conn); if (conn.State == System.Data.ConnectionState.Open) { try { SqlDataReader read = com.ExecuteReader(); while (read.Read()) { newMate.id = (read["ID"].ToString()); newMate.FName = (read["Fname"].ToString()); newMate.Lname = (read["Lname"].ToString()); newMate.City = (read["City"].ToString()); newMate.State = (read["State"].ToString()); newMate.Zip = (read["Zip"].ToString()); newMate.Pic = read["MatePic"] as byte[] ?? null; newMate.PicPath = (read["MatePicPath"].ToString()); } } catch (Exception e) { new MessageDialog(e.Message); } finally { conn.Close(); } } return(newMate); }