private LayoutSetting GetLayoutSetting(LayoutSettingClass oldLayoutSettingClass, ref bool isSpecialLayout, ref int SpecialYSpace) { LayoutSetting curLayoutSetting = new LayoutSetting(); curLayoutSetting = oldLayoutSettingClass.Layout; try { LayoutSettingClassList m_LayoutSettingList = new LayoutSettingClassList(); string layoutFilePath = Path.Combine(Application.StartupPath, CoreConst.LayoutFileName); if (File.Exists(layoutFilePath)) { var doc = new XmlDocument(); doc.Load(layoutFilePath); m_LayoutSettingList = (LayoutSettingClassList)PubFunc.SystemConvertFromXml(doc.InnerXml, typeof(LayoutSettingClassList)); foreach (LayoutSettingClass item in m_LayoutSettingList.Items) { if (item.Name == oldLayoutSettingClass.Name) { curLayoutSetting = item.Layout; isSpecialLayout = item.SpecialLayout; SpecialYSpace = item.SpecialYSpace; break; } } } } catch { } return(curLayoutSetting); }
/// <summary> /// 当表内选择元素变化时触发 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DG_List_SelectionChanged(object sender, SelectionChangedEventArgs e) { // 若当前窗口为停靠状态,可能会覆盖到导航的位置, // 所以先将窗口固定,保证主界面的完整显示 if (!parent.MainWindow.LAReplace.IsFloat && !parent.MainWindow.LAReplace.IsDock) { LayoutSetting.AddDefaultDockWidthAnchorable( "替换", parent.MainWindow.LAReplace.AutoHideWidth.ToString()); LayoutSetting.AddDefaultDockHeighAnchorable( "替换", parent.MainWindow.LAReplace.AutoHideHeight.ToString()); parent.MainWindow.LAReplace.ToggleAutoHide(); } // 未选择元素则不导航 if (DG_List.SelectedIndex < 0) { return; } // 导航到选择元素对应的位置 ReplaceElement fele = items[DG_List.SelectedIndex]; BaseViewModel bvmodel = fele.BVModel; int x = bvmodel.X; int y = bvmodel.Y; string diagram = fele.Diagram; int network = int.Parse(fele.Network); NavigateToNetworkEventArgs _e = new NavigateToNetworkEventArgs(network, diagram, x, y); parent.NavigateToNetwork(_e); }
public UWPShell(LayoutSetting layoutSetting, LocaleSetting localeSetting, ILocalizationService localization) : base(localization) { this.layoutSetting = layoutSetting; this.localization = localization; Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = localeSetting.Language.Value; }
public Shell(LayoutSetting layoutSetting, ITextStreamProvider gameProvider, LocaleSetting localeSetting, ILocalizationService localizationService) { this.layoutSetting = layoutSetting; this.gameProvider = gameProvider; this.localizationService = localizationService; Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = localeSetting.Language.Value; }
public void ResizablePanel(LayoutSetting defaultSetting, LayoutPanel panel) { var sep = new ResizablePanelSeparator(currentOrientation.Peek()); sep.UpdateLayoutSetting(defaultSetting); AddPanel(sep, panel); savedDefaultSettings.Add(defaultSetting.Clone(null)); }
public MainView(LayoutSetting layoutSetting, object content) { LayoutSetting = layoutSetting; InitializeComponent(); mainContent.Child = content as FrameworkElement ?? new ContentPresenter { Content = content }; Window.Current.SetTitleBar(DraggableTitle); }
internal void Show(LayoutAnchorControl anchor) { if (!(anchor.Model.Parent.Parent is LayoutAnchorSide)) { //var root = Root; if (anchor.Model is LayoutAnchorable && anchor.Model.Parent is LayoutRoot) { var model = anchor.Model as LayoutAnchorable; var root = anchor.Model.Parent as LayoutRoot; var newAnchorGroup = new LayoutAnchorGroup(); newAnchorGroup.Children.Add(model); AnchorSide anchorSide = LayoutSetting.GetDefaultSideAnchorable(model.Title); switch (anchorSide) { case AnchorSide.Right: root.RightSide.Children.Add(newAnchorGroup); break; case AnchorSide.Left: root.LeftSide.Children.Add(newAnchorGroup); break; case AnchorSide.Top: root.TopSide.Children.Add(newAnchorGroup); break; case AnchorSide.Bottom: root.BottomSide.Children.Add(newAnchorGroup); break; } } else { return; } } if (_model != null) { throw new InvalidOperationException(); } _anchor = anchor; _model = anchor.Model as LayoutAnchorable; _side = (anchor.Model.Parent.Parent as LayoutAnchorSide).Side; _manager = _model.Root.Manager; CreateInternalGrid(); _model.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(_model_PropertyChanged); Visibility = System.Windows.Visibility.Visible; InvalidateMeasure(); UpdateWindowPos(); Trace.WriteLine("LayoutAutoHideWindowControl.Show()"); }
public SubView(LayoutSetting layoutSetting, string title, object content) { LayoutSetting = layoutSetting; InitializeComponent(); TitleBar.Text = title; actualContent.Child = content as FrameworkElement ?? new ContentPresenter { Content = content }; }
private void BitcoinDonateDialog_Load(object sender, EventArgs e) { if (Runtime.DesignMode) { return; } LayoutSetting.Invalidate(this); textBox_address.Text = Address; }
public FileContentResult GetImage(int id) { EntityModel entity = new EntityModel(); LayoutSetting ToEdit = (from p in entity.LayoutSetting where p.LayoutSettingId == id select p).First(); return(File(ToEdit.Logo, ToEdit.ImageType)); }
private void ImageEditForm_Load(object sender, EventArgs e) { LayoutSetting.Invalidate(this); var data = File.ReadAllBytes(_filePath); if (data == null) { return; } var img = ImageUtil.FromByteArray(data); if (img == null) { return; } Rectangle workingArea = Screen.GetWorkingArea(this); if (img.Width >= workingArea.Width - 18 || img.Height >= workingArea.Width - 64) { Width = workingArea.Width; Height = workingArea.Height; Location = new Point(workingArea.Left, workingArea.Top); } else { Width = img.Width + 18; Height = img.Height + 64; int x = workingArea.Width / 2 - Width / 2; int y = workingArea.Height / 2 - Height / 2; Location = new Point(x, y); } _canvas = new Canvas(img); _canvas.OnDrawAction += canvas_OnDrawAction; _canvas.Mode = CaptureSetting.EditDrawMode; _canvas.Color = CaptureSetting.EditLineColor; _canvas.LineSize = CaptureSetting.EditLineSize; panel_canvas.Controls.Add(_canvas); ChangeCanvasCursor(); colorPicker.OnChangedColor += colorPicker_OnChangedColor; comboBox_type.DataSource = Enum.GetValues(typeof(DrawMode)); comboBox_type.SelectedItem = CaptureSetting.EditDrawMode; colorPicker.Color = CaptureSetting.EditLineColor; numericUpDown_size.Value = CaptureSetting.EditLineSize; _isLoaded = true; }
void UpdatePositionAndSizeOfPanes(LayoutAnchorable lanch) { LayoutSetting.AddDefaultFloatTopAnchorable( lanch.Title, lanch.FloatingTop.ToString()); LayoutSetting.AddDefaultFloatLeftAnchorable( lanch.Title, lanch.FloatingLeft.ToString()); LayoutSetting.AddDefaultFloatWidthAnchorable( lanch.Title, lanch.FloatingWidth.ToString()); LayoutSetting.AddDefaultFloatHeighAnchorable( lanch.Title, lanch.FloatingHeight.ToString()); }
public ActionResult GetSetting() { LayoutSetting setting = Context.LayoutSettingRepo.GetFirstOrDeffault(); if (setting != null) { return(Json(setting, JsonRequestBehavior.AllowGet)); } Response.StatusCode = (int)HttpStatusCode.BadRequest; return(Content("Error! No layout settings found!")); }
public virtual LayoutSetting UpdateLayoutSetting(LayoutSetting ls) { if (ls == null) return null; if (!ls.initialized) return this.layoutSetting; this.layoutSetting = ls; return null; }
private void OnModelContentLoaded(object sender, RoutedEventArgs e) { if (!called_Show) { return; } called_Show = false; if (LayoutSetting.GetDefaultIsDockAnchorable(_model.Title)) { _model.ToggleAutoHide(); } }
private void ToastMessageForm_Load(object sender, EventArgs e) { LayoutSetting.Invalidate(this); var data = File.ReadAllBytes(_filePath); if (data == null) { return; } var img = ImageUtil.FromByteArray(data); if (img == null) { return; } int resizeWidth = img.Width; int resizeHeight = img.Height; int width = Width - 2; if (resizeWidth > width) { float per = (float)width / img.Width; resizeWidth = (int)(per * img.Width); resizeHeight = (int)(per * img.Height); } int height = Height - 2 - 20; if (resizeHeight > height) { float per = (float)height / img.Height; resizeWidth = (int)(per * img.Width); resizeHeight = (int)(per * img.Height); } pictureBox.Width = resizeWidth; pictureBox.Height = resizeHeight; pictureBox.Image = img; int x = (width / 2) - (pictureBox.Width / 2) + 1; int y = (height / 2) - (pictureBox.Height / 2) + 1; pictureBox.Location = new Point(x, y); Rectangle workingArea = Screen.GetWorkingArea(this); Location = new Point(workingArea.Right - Size.Width - 5, workingArea.Bottom - Size.Height - 5); }
public static Layout Create2ResizablePanelLayout(BaseGraphEditor graphEditor) { Layout layout = new Layout(graphEditor); var settingsPanel = CreateLayoutPanel <BaseGraphSettingsPanel>(graphEditor); var nodeSelectorPanel = CreateLayoutPanel <BaseGraphNodeSelectorPanel>(graphEditor); var optionPanel = CreateLayoutPanel <BaseGraphOptionPanel>(graphEditor); float minWidth = 60; int p20 = Mathf.FloorToInt(graphEditor.position.width * .2f); int p15 = Mathf.FloorToInt(graphEditor.position.width * .15f); int p50 = Mathf.FloorToInt(graphEditor.position.width * .5f); var resizablePanel1Settings = new LayoutSetting(graphEditor.position) { separatorPosition = p20, separatorWidth = 4, minWidth = minWidth, maxWidth = p50, initialized = true, }; //the layout infos (width, min, max, ...) are inverted because leftBar is true var resizablePanel2Settings = new LayoutSetting(graphEditor.position) { separatorPosition = p15, separatorWidth = 4, minWidth = minWidth, maxWidth = p50, initialized = true, leftBar = true, }; var staticPanelSettings = new LayoutSetting(graphEditor.position) { separatorPosition = EditorGUIUtility.singleLineHeight, initialized = true, }; layout.BeginHorizontal(); { layout.ResizablePanel(resizablePanel1Settings, settingsPanel); layout.AutoSizePanel(staticPanelSettings, optionPanel); layout.ResizablePanel(resizablePanel2Settings, nodeSelectorPanel); } layout.EndHorizontal(); if (graphEditor.graph != null) { layout.UpdateLayoutSettings(graphEditor.graph.layoutSettings); } return(layout); }
public override LayoutSetting UpdateLayoutSetting(LayoutSetting ls) { LayoutSetting ret; ret = base.UpdateLayoutSetting(ls); if (ret == null && ls != null) { ls.vertical = vertical; } return(ret); }
private void AboutDialog_Load(object sender, EventArgs e) { if (Runtime.DesignMode) { return; } LayoutSetting.Invalidate(this); var version = Assembly.GetExecutingAssembly().GetName().Version; label_desc.Text = string.Format(label_desc.Text, version.ToString()); }
public DesktopShell(LayoutSetting layoutSetting, ILocalizationService localization, LocaleSetting locale) : base(localization) { this.layoutSetting = layoutSetting; this.localization = localization; localeName = locale.Language.Value; var userFontName = locale.UserLanguageFont.Value; if (!string.IsNullOrEmpty(userFontName)) { userFont = new FontFamily(userFontName); } }
public DesktopShell(LayoutSetting layoutSetting, ILocalizationService localization, LocaleSetting locale, ITextStreamProvider provider, Compositor compositor) : base(localization, compositor) { this.layoutSetting = layoutSetting; this.localization = localization; this.provider = provider; localeName = locale.Language.Value; var userFontName = locale.UserLanguageFont.Value; if (!string.IsNullOrEmpty(userFontName)) { userFont = new FontFamily(userFontName); } }
public ActionResult Update(int layoutOption, bool value = false, int skin = 0) { bool isResultSuccess = false; LayoutSetting setting = Context.LayoutSettingRepo.GetFirstOrDeffault(); if (setting != null) { switch (layoutOption) { case (int)LayoutOption.Boxed: setting.BoxedLayout = value; break; case (int)LayoutOption.Fixed: setting.FixedLayout = value; break; case (int)LayoutOption.SideBarExpandOnHover: setting.SideBarExpandOnHover = value; break; case (int)LayoutOption.ToggleRightSideBarSkin: setting.ToggleRightSideBarSkin = value; break; case (int)LayoutOption.ToggleRightSideBarSlide: setting.ToggleRightSideBarSlide = value; break; case (int)LayoutOption.ToggleSideBar: setting.ToggleSideBar = value; break; case (int)LayoutOption.Skin: setting.Skin = skin; break; default: break; } Context.LayoutSettingRepo.Update(setting); Context.Save(); isResultSuccess = true; } return(Json(new { Success = isResultSuccess }, JsonRequestBehavior.AllowGet)); }
/* * public void RemoveSide() * { * if (Parent is LayoutAnchorGroup) * { * ILayoutRoot root = Root; * LayoutAnchorGroup lagroup = (LayoutAnchorGroup)(Parent); * if (root.RightSide.Children.Contains(lagroup)) * { * root.RightSide.Children.Remove(lagroup); * } * if (root.LeftSide.Children.Contains(lagroup)) * { * root.LeftSide.Children.Remove(lagroup); * } * if (root.TopSide.Children.Contains(lagroup)) * { * root.TopSide.Children.Remove(lagroup); * } * if (root.BottomSide.Children.Contains(lagroup)) * { * root.BottomSide.Children.Remove(lagroup); * } * lagroup.Parent = (ILayoutContainer)(root); * } * } */ public void ReplaceSide(AnchorSide side) { if (Parent is LayoutAnchorGroup) { ILayoutRoot root = Root; LayoutAnchorGroup lagroup = (LayoutAnchorGroup)(Parent); if (root.RightSide.Children.Contains(lagroup)) { root.RightSide.Children.Remove(lagroup); } if (root.LeftSide.Children.Contains(lagroup)) { root.LeftSide.Children.Remove(lagroup); } if (root.TopSide.Children.Contains(lagroup)) { root.TopSide.Children.Remove(lagroup); } if (root.BottomSide.Children.Contains(lagroup)) { root.BottomSide.Children.Remove(lagroup); } switch (side) { case AnchorSide.Right: root.RightSide.Children.Add(lagroup); LayoutSetting.AddDefaultSideAnchorable(Title, "RIGHT"); break; case AnchorSide.Left: root.LeftSide.Children.Add(lagroup); LayoutSetting.AddDefaultSideAnchorable(Title, "LEFT"); break; case AnchorSide.Top: root.TopSide.Children.Add(lagroup); LayoutSetting.AddDefaultSideAnchorable(Title, "TOP"); break; case AnchorSide.Bottom: root.BottomSide.Children.Add(lagroup); LayoutSetting.AddDefaultSideAnchorable(Title, "BOTTOM"); break; } } }
public Shell(LayoutSetting layoutSetting, ILocalizationService localization, LocaleSetting locale, ITextStreamProvider provider) { _mainWindowVM = new MainWindowVM() { Title = "Intelligent Naval Gun", }; this.layoutSetting = layoutSetting; this.localization = localization; this.provider = provider; localeName = locale.Language.Value; var userFontName = locale.UserLanguageFont.Value; if (!string.IsNullOrEmpty(userFontName)) { userFont = new FontFamily(userFontName); } }
public void Show() { if (_model.IsFloat || _model.IsDock) { return; } //if (!_model.IsActive) // { called_Show = true; _model.Root.Manager.ShowAutoHideWindow(this); _model.IsActive = true; if (LayoutSetting.GetDefaultIsFloatAnchorable(_model.Title)) { _model.Float(); } // } }
public bool SaveCreateDistributorConfigurationContents(DistributorConfigurationModel model) { LogoResizer logoResizer = new LogoResizer(); var ts = SessionStore.GetTravelSession(); LayoutSetting distributorConfigurationModelToSave = new LayoutSetting() { DistributorId = ts.LoginTypeId, Title = model.Title, ContactUs = model.ContactUs, IsContactUsActive = model.IsContactUsActive, DashboardContent = model.DashboardContent, IsDashboardContentActive = model.IsDashboardContentActive, IsLogoActive = model.IsLogoActive, HeaderContact = model.HeaderContact, IsHeaderContactActive = model.IsHeaderContactActive, ScrollNews = model.ScrollNews, IsScrollNewsActive = model.IsScrollNewsActive, BankInfo = model.BankInfo, IsBankInfoActive = model.IsBankInfoActive, CreatedBy = ts.AppUserId, CreatedDate = DateTime.UtcNow }; if (model.Logo.ContentLength > 0) { switch (model.Logo.ContentType) { case "image/jpeg": case "image/pjpeg": case "image/gif": case "image/png": distributorConfigurationModelToSave.ImageType = model.Logo.ContentType; Int32 length = model.Logo.ContentLength; byte[] tempFile = new byte[length]; model.Logo.InputStream.Read(tempFile, 0, model.Logo.ContentLength); tempFile = logoResizer.ValidatePicture(tempFile, model.Logo.ContentType); distributorConfigurationModelToSave.Logo = tempFile; break; } } entity.AddToLayoutSetting(distributorConfigurationModelToSave); entity.SaveChanges(); return(true); }
private void DG_FList_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e) { if (!parent.MainWindow.LAErrorList.IsFloat && !parent.MainWindow.LAErrorList.IsDock) { LayoutSetting.AddDefaultDockWidthAnchorable( Properties.Resources.MainWindow_Error_List, parent.MainWindow.LAErrorList.AutoHideWidth.ToString()); LayoutSetting.AddDefaultDockHeighAnchorable( Properties.Resources.MainWindow_Error_List, parent.MainWindow.LAErrorList.AutoHideHeight.ToString()); parent.MainWindow.LAErrorList.ToggleAutoHide(); } if (DG_FList.SelectedIndex < 0) { return; } ErrorReportElement_FB ele = (ErrorReportElement_FB)DG_FList.SelectedItem; FuncBlockViewModel fbvmodel = ele.FBVModel; int line = ele.Line; int column = ele.Column; parent.NavigateToFuncBlock(fbvmodel, line, column); }
private void DG_List_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (!parent.MainWindow.LAReplace.IsFloat && !parent.MainWindow.LAReplace.IsDock) { LayoutSetting.AddDefaultDockWidthAnchorable( Properties.Resources.MainWindow_Replace, parent.MainWindow.LAReplace.AutoHideWidth.ToString()); LayoutSetting.AddDefaultDockHeighAnchorable( Properties.Resources.MainWindow_Replace, parent.MainWindow.LAReplace.AutoHideHeight.ToString()); parent.MainWindow.LAReplace.ToggleAutoHide(); } if (DG_List.SelectedIndex < 0) { return; } TextReplaceElement element = null; if (e.AddedItems.Count > 0) { element = (TextReplaceElement)(e.AddedItems[0]); } else if (e.RemovedItems.Count > 0) { element = (TextReplaceElement)(e.RemovedItems[0]); } else { return; } FuncBlockViewModel fbvmodel = element.FBVModel; int offset = element.Offset; int count = element.Word.Length; parent.NavigateToFuncBlock(fbvmodel, offset); fbvmodel.SetOffset(offset, count); }
public BrowserElement(BrowserSelector selector, LayoutSetting layoutSetting) { InitializeComponent(); _browserProvider = selector.SelectedBrowser; ActualContent.Content = DataContext = _browser = _browserProvider?.CreateBrowser(); if (_browser is null) { Visibility = Visibility.Collapsed; } else { _browser.LockGame = true; _browser.Navigate(selector.Settings.DefaultUrl.Value); layoutSetting.LayoutScale.ValueChanged += _ => UpdateScale(); layoutSetting.BrowserScale.ValueChanged += _ => UpdateScale(); Loaded += (s, e) => UpdateScale(); this.layoutSetting = layoutSetting; } Application.Current.Exit += OnApplicationExit; }
public BrowserElement(UWPHttpProviderSelector selector, LayoutSetting layoutSetting) { defaultUrl = new Uri(selector.Settings.DefaultUrl.Value); LayoutSetting = layoutSetting; InitializeComponent(); if (selector.Settings.Debug.InitialValue) { Visibility = Visibility.Collapsed; } else { Transformer.Child = WebView = new WebView(WebViewExecutionMode.SeparateThread); WebView.NavigationStarting += (s, e) => AddressBox.Text = e.Uri.ToString(); WebView.NavigationCompleted += (s, e) => { if (LockGame) { _ = s.InvokeScriptAsync("eval", new[] { BrowserSetting.StyleSheetSetJs }); } }; WebView.FrameNavigationStarting += (s, e) => { if (LockGame) { _ = s.InvokeScriptAsync("eval", new[] { BrowserSetting.StyleSheetSetJs }); } }; WebView.WebResourceRequested += ((EdgeHttpProvider)selector.Current).WebResourceRequested; WebView.Navigate(defaultUrl); layoutSetting.LayoutScale.ValueChanged += _ => UpdateBrowserScale(); layoutSetting.BrowserScale.ValueChanged += _ => UpdateBrowserScale(); UpdateBrowserScale(); } }