예제 #1
0
        /// <summary>
        /// Update guidelines
        /// </summary>
        /// <returns></returns>
        private async Task UpdateLines()
        {
            double cellWidth = DesignerCanvas.GridCellWidth;
            double w         = ModelDesignerCanvas.Width;
            double h         = ModelDesignerCanvas.Height;

            //For progress dialog glitch-free opening
            await Task.Delay(500);

            var geometry = await Task.Run(() => DesignerCanvas.CreateGridWithStreamGeometry(h, w, cellWidth));

            ModelDesignerCanvas.RefreshGuideLines(geometry);
        }
예제 #2
0
        /// <summary>
        /// Dimensions changed
        /// </summary>
        /// <returns></returns>
        public async Task CanvasDimensionsChanged()
        {
            var settings = new MetroDialogSettings()
            {
                AnimateHide = true,
                AnimateShow = false
            };

            var parent = VisualTreeHelperEx.FindAncestorByType <MetroWindow>(this);

            var progressController = await parent.ShowProgressAsync("Please wait...", "Guidelines are updating", false, settings);

            await UpdateLines();

            await progressController.CloseAsync();

            StreamGeometry geometry = DesignerCanvas.CreateGridWithStreamGeometry(ViewModel.CanvasHeight, ViewModel.CanvasWidth,
                                                                                  DesignerCanvas.GridCellWidth);

            ModelDesignerCanvas.RefreshGuideLines(geometry);

            ViewModel.OnComputedPropertyChanged();
        }