private void CheckLayout() { var layout = (Layout.Layout)Current.Resources["CurLayout"]; var settings = PhotosCategorier.Properties.Settings.Default; if (settings.IsFirstOpen) { settings.Width = layout.LayoutType.GetWidth(); settings.Height = layout.LayoutType.GetHeight(); settings.IsFirstOpen = false; } else { try { var settingLayout = LayoutSize.GenerateLayout(settings.Width, settings.Height); layout.SetLayout(settingLayout); } catch (GenrateLayoutFailedException) { ; } } }