/// <summary> /// Charge et affiche la liste des murs intérieurs disponibles /// </summary> private void loadListMur() { scrollView.Content = null; stackList.Children.Clear(); foreach (MetaModule meta in listMeta) { if (meta.taille == 1 && meta.label.Contains("Mur")) { ToggleButton toggle = new ToggleButton(); toggle.Background = Brushes.White; toggle.Width = 150; toggle.Height = 170; toggle.Margin = new Thickness(30, 10, 30, 10); Image img = new Image(); img.Source = meta.image; img.Width = 150; img.Height = 130; img.VerticalAlignment = VerticalAlignment.Top; TextBlock tb = new TextBlock(); tb.Text = meta.label; tb.VerticalAlignment = VerticalAlignment.Bottom; tb.HorizontalAlignment = HorizontalAlignment.Center; tb.Height = 40; StackPanel sp = new StackPanel(); sp.Children.Add(img); sp.Children.Add(tb); toggle.Content = sp; toggle.Click += delegate(object sender, RoutedEventArgs e) { ToggleButton active = sender as ToggleButton; foreach (ToggleButton tgbt in FindVisualChildren <ToggleButton>(stackList)) { tgbt.IsChecked = false; } metaChoose = meta; active.IsChecked = true; }; if (meta == metaChoose) { toggle.IsChecked = true; } stackList.Children.Add(toggle); } } scrollView.Content = stackList; }
/// <summary> /// Constructeur de la classe /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <param name="colspan"></param> /// <param name="rowspan"></param> /// <param name="meta"></param> /// <param name="parent"></param> public Module(int x, int y, int colspan, int rowspan, MetaModule meta, MetaModule parent = null) { this.x = x; this.y = y; this.colspan = colspan; this.rowspan = rowspan; this.meta = meta; this.parent = parent; checkType(); }
/// <summary> /// Constructeur de la classe /// </summary> /// <param name="unparent"></param> /// <param name="type"></param> /// <param name="x"></param> /// <param name="y"></param> /// <param name="colspan"></param> /// <param name="rowspan"></param> /// <param name="texture"></param> public Module(MetaModule unparent, type type, int x, int y, int colspan, int rowspan, Brush texture) { this.parent = unparent; this.letype = type; this.x = x; this.y = y; this.colspan = colspan; this.rowspan = rowspan; this.texture = texture; }
public static MetaModule Create(Module module) { var newModule = new MetaModule() { Name = module.Name }; if (module.Parameters != null) { foreach (var param in module.Parameters) { newModule.Parameters.Add(MetaParameterFactory.Create(param)); } } return(newModule); }
/// <summary> /// Méthode qui permet de récupérer les metamodules /// </summary> public List <MetaModule> listAllMetaModules() { conn.LiteCo.Open(); ListMetaModule = new List <MetaModule>(); SQLQuery = "SELECT * FROM metamodule WHERE statut = 0"; using (SQLiteCommand command = new SQLiteCommand(SQLQuery, conn.LiteCo)) { using (SQLiteDataReader reader = command.ExecuteReader()) { try { while (reader.Read()) { Byte[] data = (Byte[])reader.GetValue(3); MetaModule metaModule = new MetaModule ( reader.GetString(0), reader.GetString(1), reader.GetInt32(2), ToImage(data), reader.GetBoolean(4), reader.GetString(5), getGammebyNom(reader.GetString(6)), reader.GetInt32(7), reader.GetInt32(8) ); ListMetaModule.Add(metaModule); } } catch (SQLiteException ex) { Trace.WriteLine(ex.ToString()); } conn.LiteCo.Close(); return(ListMetaModule); } } }
/// <summary> /// Méthode qui permet de récupérer les métamodules par id/ref /// </summary> /// <param name="reference"></param> /// <returns></returns> private MetaModule getMetaModuleByRef(string reference) { MetaModule metaModule = new MetaModule(); SQLQuery = "SELECT * FROM metamodule WHERE refMetaModule = @reference;"; using (SQLiteCommand command = new SQLiteCommand(SQLQuery, conn.LiteCo)) { command.Parameters.AddWithValue("@reference", reference); using (SQLiteDataReader reader = command.ExecuteReader()) { try { while (reader.Read()) { Byte[] data = (Byte[])reader.GetValue(3); metaModule = new MetaModule ( reader.GetString(0), reader.GetString(1), reader.GetInt32(2), ToImage(data), reader.GetBoolean(4), reader.GetString(5), getGammebyNom(reader.GetString(6)), reader.GetInt32(7), reader.GetInt32(8) ); } } catch (SQLiteException ex) { Trace.WriteLine(ex.ToString()); } return(metaModule); } } }
public override MetaType Resolve(MetaModule module) { var types = module.Types; var resolvedType = types.Single(t => t.Name == _name); return resolvedType; }
public abstract MetaType Resolve(MetaModule module);
public override MetaType Resolve(MetaModule module) { return _type; }