/// <summary> /// Updating gui relative to the data stored into Schema's object. /// </summary> public void UpdateGUI() { // Clearing current canvas. canvas.Children.Clear(); // Unsubscribe from events of prevous blocks. foreach (SeatsBlock block in Blocks) { block.BlockSelected -= SeatsBlock_BlockAcivated; } Blocks.Clear(); // Drop references. // Sapwn UI for every data block. foreach (Types.AuditoryPlanner.SeatsBlock block in Schema.blocks) { // Append UI to canvas. var blockUI = new SeatsBlock(); canvas.Children.Add(blockUI); // Add to curent collection. Blocks.Add(blockUI); // Subscribe on block's events. blockUI.BlockSelected += SeatsBlock_BlockAcivated; // Apply data to UI. blockUI.Block = block; blockUI.EditorMode = true; } }
/// <summary> /// Will be called when some block will activated. /// Show up properties of that block. /// </summary> /// <param name="block">Selected block.</param> /// <param name="x">X coordinate selected in block.</param> /// <param name="y">Y coordinate selected in block.</param> private void SeatsBlock_BlockAcivated(SeatsBlock grid) { // Activate properties UI. blockProperties.Visibility = Visibility.Visible; }