public void SetView(ProjectModule module, LayoutSimulation sim) { if (module.Implementation is LayoutModel) { LayoutModel layoutModel = (LayoutModel)module.Implementation; LayoutSimulation layoutSim; if (sim != null) { layoutSim = sim; moduleSimulations[module] = sim; } else if (!moduleSimulations.TryGetValue(module, out layoutSim)) { SimulationModel simModel = new SimulationModel(); layoutSim = new LayoutSimulation(simModel, layoutModel); moduleSimulations[module] = layoutSim; } SimulationThread newThread = new SimulationThread(layoutSim.SimulationModel); newThread.Start(); SimulationThread oldThread = simThread; simThread = newThread; if (oldThread != null) { oldThread.RequestStop(); } this.CurrentModule = module; ToolboxModel.UpdateCurrent(module); LayoutCanvas.SetView(layoutModel, layoutSim); } else { throw new InvalidOperationException("cannot view this module type"); } }
//初始化TagDB,该函数必须在空间初始化时就指定 public void Initial(ITagDB db, IUriDB uridb, LayoutCanvas canvasType) { TagDB = db; UriDB = uridb; MyCanvasType = canvasType; if (!NeedShowRootPath()) { //connectCanvas.Visibility = Visibility.Collapsed; connect.Height = new GridLength(0); } //更新上下文菜单的Check选项(选中哪个模式,就在该模式上打一个勾) UpdateMenuItemCheckStatus(); }
public void SetupLayout(LayoutCanvas layoutCanvas, Screen screen, bool isDesktopMode) { // Cache the references to the canvas and screen m_layoutCanvas = layoutCanvas; m_screen = screen; // Set initial canvas attributes canvas.Width = screen.Width; canvas.Height = screen.Height; // Set the canvas background canvas.Background = new SolidColorBrush( WpfToGdi.GdiColorToWpfColour(layoutCanvas.BackgroundColour)); canvas.ClearChildren(); foreach (LayoutObject lo in layoutCanvas) { LayoutImage lImage = new LayoutImage(lo); // Add to canvas (but don't add through the helper, because we want to manually manipulate // this object) canvas.Children.Add(lImage); // Set the preview image SetPreviewImage(lImage, lo.Source); // Set attributes onto the child RefreshCanvasChild(lImage); } // Set the manual edit flag so that we don't trigger events when we change // these objects m_isManuallyEditing = true; chkShuffle.Visibility = isDesktopMode ? Visibility.Visible : Visibility.Hidden; chkShuffle.IsChecked = layoutCanvas.IsShuffleEnabled; cmdChangeInterval.SelectedIndex = GetIntervalIndex(m_layoutCanvas.ShuffleMode); cmbFillMode.SelectedIndex = (int)m_layoutCanvas.SingleObjectStyle; m_isManuallyEditing = false; RefreshFillModeState(); RefreshAdvancedButtonState(); RefreshEditorState(); }
private MainWindow CreateWindow(Screen screen, LayoutCanvas canvas, bool primary) { MainWindow win = new MainWindow(primary); win.Closed += new EventHandler(winChild_Closed); win.SetImageLibraryController(m_libraryManager); win.SetupLayout(canvas, screen, m_mode == ManagerMode.Desktop); CentreWindow(win, screen); win.Show(); return win; }
public static void UpdateClipsToBounds(this LayoutCanvas layoutCanvas, ILayout layout) { //TODO: Need to impl }