public void Invalidating_Child_Should_Remeasure_Parent() { var layoutManager = new LayoutManager(); using (AvaloniaLocator.EnterScope()) { AvaloniaLocator.CurrentMutable.Bind<ILayoutManager>().ToConstant(layoutManager); Border border; StackPanel panel; var root = new TestLayoutRoot { Child = panel = new StackPanel { Children = new Controls.Controls { (border = new Border()) } } }; layoutManager.ExecuteInitialLayoutPass(root); Assert.Equal(new Size(0, 0), root.DesiredSize); border.Width = 100; border.Height = 100; layoutManager.ExecuteLayoutPass(); Assert.Equal(new Size(100, 100), panel.DesiredSize); } }
public DiagramDebuggerControl() { InitializeCommands(); InitializeComponent(); _layoutManager = new LayoutManager(DockingManager); }
public MainWindow() { InitializeComponent(); LayoutManager = new LayoutManager(DockingManager); //AddDocumentElement.IsSelectedChanged += AddDocumentElement_IsSelectedChanged; DockingManager.DocumentClosed += DockingManager_DocumentClosed; }
public DiagramEditorControl() { InitializeComponent(); _layoutManager = new LayoutManager(DockingManager); DiagramEditor.IndicatorTypes.AddRange(StockSharp.Configuration.Extensions.GetIndicatorTypes()); PaletteElements = ConfigManager.GetService<StrategiesRegistry>().DiagramElements; }
public MainPanel(LayoutManager layout, DashboardPanel defaultPanel, params DashboardPanel[] panels) { base.\u002Ector(layout); DashboardPanel[] dashboardPanelArray = panels; int length = dashboardPanelArray.Length; for (int index = 0; index < length; ++index) { DashboardPanel dashboardPanel = dashboardPanelArray[index]; MainPanel.__\u003C\u003Epanels.put((object) ((Component) dashboardPanel).getName(), (object) dashboardPanel); } MainPanel.currentPanel = defaultPanel; }
public StrategyControl() { InitializeComponent(); _bufferedChart = new BufferedChart(Chart); _layoutManager = new LayoutManager(DockingManager); _pnlCurve = EquityCurve.CreateCurve(LocalizedStrings.PnL, Colors.DarkGreen, EquityCurveChartStyles.Area); _unrealizedPnLCurve = EquityCurve.CreateCurve(LocalizedStrings.PnLUnreal, Colors.Black); _commissionCurve = EquityCurve.CreateCurve(LocalizedStrings.Str159, Colors.Red, EquityCurveChartStyles.DashedLine); _posItems = PositionCurve.CreateCurve(LocalizedStrings.Str862, Colors.DarkGreen); }
public MainWindow() { try { InitializeComponent(); this.ExchangeDataManager = new ExchangeDataManager(this._Media); this._CommonDialogWin = new CommonDialogWin(this.MainFrame); this._ConfirmDialogWin = new ConfirmDialogWin(this.MainFrame); this._ConfirmOrderDialogWin = new ConfirmOrderDialogWin(this.MainFrame); this._OrderHandle = new OrderHandle(); this._LayoutManager = new LayoutManager(this, this.OnAddContentPane); } catch(Exception exception) { Logger.TraceEvent(TraceEventType.Error, "MainWindow ctor: \r\n{0}", exception); } }
public static void RenderWallpaper(DisplayInformation dpInfo, LayoutManager lm, bool isDesktopMode, string location) { if (isDesktopMode) { string p = location + dpInfo.ToString() + ".bmp"; Renderer r = new Renderer(); r.ImageFormat = ImageFormat.Bmp; r.OutputPath = p; r.Render(dpInfo, lm, isDesktopMode); WallpaperController.SetWallpaper(p); } else { string p = location + "Logon.jpg"; string execPath = System.Reflection.Assembly.GetExecutingAssembly().Location; string execDir = System.IO.Path.GetDirectoryName(execPath); Renderer r = new Renderer(); r.ImageFormat = ImageFormat.Jpeg; r.OutputPath = p; r.FileSizeLimit = 256 * 1024; r.Render(dpInfo, lm, isDesktopMode); try { System.Diagnostics.ProcessStartInfo procInfo = new System.Diagnostics.ProcessStartInfo(); procInfo.UseShellExecute = true; procInfo.FileName = "PaperStitcher.Helper.exe"; procInfo.WorkingDirectory = execDir; procInfo.Arguments = "--logon " + p; procInfo.CreateNoWindow = false; procInfo.Verb = "runas"; System.Diagnostics.Process.Start(procInfo); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message.ToString()); } } }
/// <summary> /// Creates an EngineCleanup object that can be used to clean a machine of all files and regkeys a Burn bundle may have installed. /// </summary> /// <param name="Layout">Layout to be removed from the machine</param> public EngineCleanup(LayoutManager.LayoutManager Layout) { UpdateIds = new List<string>(); m_Layout = Layout; RegistrationId = this.m_Layout.ActualBundleId; try { //// BUGBUG This needs to be replace by the new WiX authoring that supports this. It doesn't exist yet. //foreach (WixTest.Burn.OM.BurnManifestOM.Registration.RegistrationElement.UpdateElement updateElement in m_Layout.BurnManifest.Registration.UpdateElements) //{ // UpdateIds.Add(updateElement.BundleId); //} } catch { // don't die if this isn't a Bundle that Updates other bundles. } }
protected override void BuildBasePropertiesEditor(TitlePanel titlePanel, PageLayoutSection section) { var layoutManager = new LayoutManager("main", mDFInfo, mDFContainer); var config = new AutoLayoutConfig(); config.Add("AccountingUnit_ID"); config.Add("Department_ID"); config.Add("Employee_ID"); config.Add("Date"); config.Add("ProductLine_ID"); config.Add("Store_ID"); BuildBasePropertiesConfig(config); config.Add("Remark"); layoutManager.Config = config; section.ApplyLayout(layoutManager, config, mPageLayoutManager, mDFInfo); titlePanel.Controls.Add(layoutManager.CreateLayout()); }
/// <summary> /// Shows the window. /// </summary> public override void Show() { if (IsVisible) { return; } AddWindow(this); EnsureInitialized(); IsVisible = true; LayoutManager.ExecuteInitialLayoutPass(this); using (BeginAutoSizing()) { PlatformImpl?.Show(); Renderer?.Start(); } SetWindowStartupLocation(Owner?.PlatformImpl); OnOpened(EventArgs.Empty); }
public bool IsChangedPassEnabled(LoginInfo login) { IManagerCredential crd = new ManagerCredential(); ILayoutManager layoutManager = new LayoutManager(); Guid tenantId = layoutManager.GetTenantId(InfoType.Tenant, login.TenantCode); if (tenantId == Guid.Empty) { return(false); } //Validate UserName var userId = crd.GetUserName(tenantId, login.UserName); if (userId == Guid.Empty) { return(false); } var credentialData = crd.GetCredential(tenantId, userId); return(credentialData.IsNew); }
public void Measures_Parent_Of_Newly_Added_Control() { var target = new LayoutManager(); using (Start(target)) { var control = new LayoutTestControl(); var root = new LayoutTestRoot(); target.ExecuteInitialLayoutPass(root); root.Child = control; root.Measured = root.Arranged = false; target.ExecuteLayoutPass(); Assert.True(root.Measured); Assert.True(root.Arranged); Assert.True(control.Measured); Assert.True(control.Arranged); } }
/// <summary> /// Resets the treeview to the specified project /// </summary> /// <param name="zProject">The project to display</param> private void ResetTreeToProject(Project zProject) { if (null != treeView) { treeView.Nodes.Clear(); var tnRoot = new TreeNode("Layouts") { Tag = zProject }; treeView.Nodes.Add(tnRoot); foreach (var zLayout in zProject.Layout) { // no need to update the project AddProjectLayout(zLayout); LayoutManager.InitializeElementCache(zLayout); } tnRoot.ExpandAll(); } m_tnCurrentLayout = null; }
/// <summary> /// Creates a layout with the specified name and optionally makes it current. /// </summary> /// <param name="name">The name of the viewport.</param> /// <param name="select">Whether to select it.</param> /// <returns>The ObjectId of the newly created viewport.</returns> public static ObjectId CreateAndMakeLayoutCurrent( this LayoutManager lm, string name, bool select = true ) { // First try to get the layout var id = lm.GetLayoutId(name); // If it doesn't exist, we create it if (!id.IsValid) { id = lm.CreateLayout(name); } // And finally we select it if (select) { lm.CurrentLayout = name; } return(id); }
public static void MainTesting() { Document doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; LayoutManager laymgr = LayoutManager.Current; try { Layout lay = doc.Create_NewLayout("Testing"); double w = 25.00; double h = 30.00; PlotPaperUnit ppunits = PlotPaperUnit.Inches; lay.SetPageSize(w, h, ppunits); } catch { } }
//a constructor for the class assigning a given list of cards as the deck list. public CardManager(List <BasicCard> list, LayoutManager lm, RetreatView rv, string name) { layoutManager = lm; rv.Setup(this); deckList = list; foreach (BasicCard card in list) { card.SetOwner(this); } deck = deckList; for (int i = 0; i < deck.Count; i++) { layoutManager.PlaceInDeck(deck[i]); } ShuffleDeck(); retreat = new List <BasicCard>(deckList.Count); playerName = name; }
protected override void BuildBody(Control parent) { var titlePanel = parent.EAdd(new TitlePanel("基本属性", "基本属性")); var layoutManager = new LayoutManager("main", mDFInfo, mDFContainer); var config = new AutoLayoutConfig(); config.Add("AccountingUnit_ID"); config.Add("Department_ID"); config.Add("StartDate"); config.Add("Store_ID"); config.Add("Remark"); layoutManager.Config = config; var section = mPageLayoutManager.AddSection("BaseProperties", "基本属性"); section.ApplyLayout(layoutManager, config, mPageLayoutManager, mDFInfo); titlePanel.Controls.Add(layoutManager.CreateLayout()); titlePanel.SetPageLayoutSetting(mPageLayoutManager, section.Name); CreateDetailPanel(parent.EAdd(new TitlePanel("成品明细"))); }
public void Arranges_InvalidateArranged_Control() { var target = new LayoutManager(); using (Start(target)) { var control = new LayoutTestControl(); var root = new LayoutTestRoot { Child = control }; target.ExecuteInitialLayoutPass(root); control.Measured = control.Arranged = false; control.InvalidateArrange(); target.ExecuteLayoutPass(); Assert.False(control.Measured); Assert.True(control.Arranged); } }
protected override object CreateControlsCore() { if (this.layoutManager == null) { this.layoutManager = base.Application.CreateLayoutManager(true); this.categoriesListView = base.Application.CreateListView(this.categoriesListViewId, this.CategoriesDataSource, false); this.categoriesListView.Caption = "Category"; this.categoriesListView.SelectionChanged += new EventHandler(this.categoriesListView_SelectionChanged); this.categoriesListView.CreateControls(); if (this.ObjectTreeList != null) { this.ObjectTreeList.OptionsSelection.MultiSelect = false; } ViewItemsCollection detailViewItems = new ViewItemsCollection(); detailViewItems.Add(new ControlViewItem("1", this.categoriesListView.Control)); detailViewItems.Add(new ControlViewItem("2", base.CreateControlsCore())); this.layoutManager.LayoutControls(base.Model.SplitLayout, detailViewItems); this.SubscribeToTreeList(); } return(this.layoutManager.Container); }
public MultiParent() { //Initialize Diagram Properties Connectors = new ObservableCollection <ConnectorVM>(); Constraints = Constraints.Remove(GraphConstraints.PageEditing, GraphConstraints.PanRails); Menu = null; Tool = Tool.ZoomPan; HorizontalRuler = new Ruler { Orientation = Orientation.Horizontal }; VerticalRuler = new Ruler { Orientation = Orientation.Vertical }; DefaultConnectorType = ConnectorType.Orthogonal; // Initialize Command for sample changes Orientation_Command = new Command(OnOrientation_Command); // Initialize DataSourceSettings for SfDiagram DataSourceSettings = new DataSourceSettings() { ParentId = "ReportingPerson", Id = "Name", DataSource = GetData(), }; // Initialize LayoutSettings for SfDiagram LayoutManager = new LayoutManager() { Layout = new DirectedTreeLayout() { Type = LayoutType.Hierarchical, Orientation = TreeOrientation.TopToBottom, AvoidSegmentOverlapping = true, HorizontalSpacing = 40, VerticalSpacing = 40, }, }; }
/// <summary> /// Shows the window as a dialog. /// </summary> /// <typeparam name="TResult"> /// The type of the result produced by the dialog. /// </typeparam> /// <param name="owner">The dialog's owner window.</param> /// <returns>. /// A task that can be used to retrieve the result of the dialog when it closes. /// </returns> public Task <TResult> ShowDialog <TResult>(IWindowImpl owner) { if (owner == null) { throw new ArgumentNullException(nameof(owner)); } if (IsVisible) { throw new InvalidOperationException("The window is already being shown."); } RaiseEvent(new RoutedEventArgs(WindowOpenedEvent)); EnsureInitialized(); IsVisible = true; LayoutManager.ExecuteInitialLayoutPass(this); var result = new TaskCompletionSource <TResult>(); using (BeginAutoSizing()) { PlatformImpl?.ShowDialog(owner); Renderer?.Start(); Observable.FromEventPattern <EventHandler, EventArgs>( x => this.Closed += x, x => this.Closed -= x) .Take(1) .Subscribe(_ => { owner.Activate(); result.SetResult((TResult)(_dialogResult ?? default(TResult))); }); OnOpened(EventArgs.Empty); } SetWindowStartupLocation(owner); return(result.Task); }
public MainViewModel() { m_window = new MainWindow {DataContext = this}; m_layoutManager = new LayoutManager(this); m_tabTrees = Enum.GetValues(typeof(TabTrees)).Cast<TabTrees>().ToList(); m_closeFileCommand = new GenericManualCommand<IFileViewModel>(CloseFile); m_saveFileCommand = new ManualCommand(Save, () => LayoutManager.ActiveLayoutElement != null && LayoutManager.ActiveLayoutElement.SelectedFile != null && LayoutManager.ActiveLayoutElement.SelectedFile.HasUnsavedChanges); m_saveAllFilesCommand = new ManualCommand(SaveAll, () => LayoutManager.LayoutElements.Any(layout => layout.OpenFiles.Any(n => n.HasUnsavedChanges))); m_openFileViewModelCommand = new GenericManualCommand<IFileViewModel>(file => OpenFile(file)); m_openFileCommand = new ManualCommand(OpenFile); m_openFolderCommand = new ManualCommand(OpenFolder); m_exitCommand = new ManualCommand(() => Environment.Exit(0)); m_newFileCommand = new ManualCommand(CreateNewFile); m_changeSettingsPathCommand = new ManualCommand(ChangeSettingsPath); m_renameSelectedNodeCommand = new ManualCommand(() => m_selectedNode.IsRenaming = true); m_renameSelectedNodeDoneCommand = new ManualCommand(() => m_selectedNode.IsRenaming = false); m_renameSelectedNodeCancelCommand = new ManualCommand(() => { m_selectedNode.RenameString = null; m_selectedNode.IsRenaming = false; }); m_createFileCommand = new GenericManualCommand<string>(s => CreateNewFileAtSelectedNode(s)); m_reloadFilesDialogViewModel = new ReloadFilesDialogViewModel(); m_createFolderCommand = new ManualCommand(() => CreateFolder("Newfolder")); m_deleteSelectedNodeCommand = new ManualCommand(DeleteSelectedNode); m_dialogHelper = new DialogHelper(this); ServiceProvider.Registre<IDialogHelper>(DialogHelper); if (string.IsNullOrEmpty(Properties.Settings.Default.SettingPath) || !Directory.Exists(Properties.Settings.Default.SettingPath)) { m_folderBrowserDialogViewModel = new FolderBrowserDialogViewModel(); m_folderBrowserDialogViewModel.PropertyChanged += StartFolderBrowserDialogViewModelOnPropertyChanged; m_folderBrowserDialogViewModel.Title = "Select settings path"; m_folderBrowserDialogViewModel.Path = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\sharpE\\settings"; DialogHelper.ShowDialog(m_folderBrowserDialogViewModel); } else { Init(); } }
/// <summary> /// Shows the window as a dialog. /// </summary> /// <typeparam name="TResult"> /// The type of the result produced by the dialog. /// </typeparam> /// <returns>. /// A task that can be used to retrive the result of the dialog when it closes. /// </returns> public Task <TResult> ShowDialog <TResult>() { if (IsVisible) { throw new InvalidOperationException("The window is already being shown."); } AddWindow(this); EnsureInitialized(); SetWindowStartupLocation(); IsVisible = true; LayoutManager.ExecuteInitialLayoutPass(this); using (BeginAutoSizing()) { var affectedWindows = Application.Current.Windows.Where(w => w.IsEnabled && w != this).ToList(); var activated = affectedWindows.Where(w => w.IsActive).FirstOrDefault(); SetIsEnabled(affectedWindows, false); var modal = PlatformImpl?.ShowDialog(); var result = new TaskCompletionSource <TResult>(); Renderer?.Start(); Observable.FromEventPattern <EventHandler, EventArgs>( x => this.Closed += x, x => this.Closed -= x) .Take(1) .Subscribe(_ => { modal?.Dispose(); SetIsEnabled(affectedWindows, true); activated?.Activate(); result.SetResult((TResult)(_dialogResult ?? default(TResult))); }); return(result.Task); } }
public void OpenDwgFile(string i_FileName) { DisposeCadComponent(); InitiailizeCadComponent(); if (lm != null) { lm.LayoutSwitched -= reinitGraphDevice; HostApplicationServices.WorkingDatabase = null; lm = null; } bool bLoaded = true; CadSelectionManager.Instance.Dispose(); database = new Database(false, false); try { database.ReadDwgFile(i_FileName, FileShare.Read, true, ""); } catch (System.Exception ex) { MessageBox.Show(ex.Message); bLoaded = false; } if (bLoaded) { HostApplicationServices.WorkingDatabase = database; lm = LayoutManager.Current; lm.LayoutSwitched += new Teigha.DatabaseServices.LayoutEventHandler(reinitGraphDevice); panel1.Enabled = true; Text = String.Format("外协件检验系统 - [{0}]", PmsService.Instance.CurrentPart == null ? "" : PmsService.Instance.CurrentPart.Name); OnDwgFileOpened(); } }
protected override void AddQueryControls(VLayoutPanel vPanel) { var customPanel = new LayoutManager("Main", _mainInfo, mQueryContainer); customPanel.Add("ProductionPlan_ID", new SimpleLabel("计划号"), QueryCreator.DFChoiceBoxEnableMultiSelection(_mainInfo.Fields["ProductionPlan_ID"], mQueryContainer, "ProductionPlan_ID", B3ButcheryDataSource.计划号)); customPanel["ProductionPlan_ID"].NotAutoAddToContainer = true; customPanel.Add("AccountingUnit_ID", QueryCreator.DFChoiceBoxEnableMultiSelection(_mainInfo.Fields["AccountingUnit_ID"], mQueryContainer, "AccountingUnit_ID", B3FrameworksConsts.DataSources.授权会计单位全部)); customPanel["AccountingUnit_ID"].NotAutoAddToContainer = true; customPanel.Add("Department_ID", QueryCreator.DFChoiceBoxEnableMultiSelection(_mainInfo.Fields["Department_ID"], mQueryContainer, "Department_ID", B3FrameworksConsts.DataSources.授权部门全部)); customPanel["Department_ID"].NotAutoAddToContainer = true; customPanel.Add("Employee_ID", QueryCreator.DFChoiceBoxEnableMultiSelection(_mainInfo.Fields["Employee_ID"], mQueryContainer, "Employee_ID", B3FrameworksConsts.DataSources.授权员工全部)); customPanel["Employee_ID"].NotAutoAddToContainer = true; customPanel.Add("Store_ID", new SimpleLabel("速冻库"), QueryCreator.DFChoiceBoxEnableMultiSelection(_mainInfo.Fields["Store_ID"], mQueryContainer, "Store_ID", B3ButcheryDataSource.速冻库)); customPanel["Store_ID"].NotAutoAddToContainer = true; customPanel.Add("OtherInStoreType_ID", QueryCreator.DFChoiceBoxEnableMultiSelection(_mainInfo.Fields["OtherInStoreType_ID"], mQueryContainer, "OtherInStoreType_ID", B3ButcheryDataSource.屠宰分割入库类型)); customPanel["OtherInStoreType_ID"].NotAutoAddToContainer = true; customPanel.Add("Remark", QueryCreator.DFTextBox(_mainInfo.Fields["Remark"])); customPanel.Add("Goods_ID", new SimpleLabel("存货"), QueryCreator.DFChoiceBoxEnableMultiSelection(_detailInfo.Fields["Goods_ID"], mQueryContainer, "Goods_ID", B3UnitedInfosConsts.DataSources.存货)); customPanel["Goods_ID"].NotAutoAddToContainer = true; customPanel.CreateDefaultConfig(2).Expand = false; vPanel.Add(customPanel.CreateLayout()); }
public void Doesnt_Measure_Removed_Control() { var target = new LayoutManager(); using (Start(target)) { var control = new LayoutTestControl(); var root = new LayoutTestRoot { Child = control }; target.ExecuteInitialLayoutPass(root); control.Measured = control.Arranged = false; control.InvalidateMeasure(); root.Child = null; target.ExecuteLayoutPass(); Assert.False(control.Measured); Assert.False(control.Arranged); } }
public void Measures_In_Correct_Order() { var target = new LayoutManager(); using (Start(target)) { LayoutTestControl control1; LayoutTestControl control2; var root = new LayoutTestRoot { Child = control1 = new LayoutTestControl { Child = control2 = new LayoutTestControl(), } }; var order = new List <ILayoutable>(); Size MeasureOverride(ILayoutable control, Size size) { order.Add(control); return(new Size(10, 10)); } root.DoMeasureOverride = MeasureOverride; control1.DoMeasureOverride = MeasureOverride; control2.DoMeasureOverride = MeasureOverride; target.ExecuteInitialLayoutPass(root); control2.InvalidateMeasure(); control1.InvalidateMeasure(); root.InvalidateMeasure(); order.Clear(); target.ExecuteLayoutPass(); Assert.Equal(new ILayoutable[] { root, control1, control2 }, order); } }
protected override void BuildBasePropertiesEditor(TitlePanel titlePanel, PageLayoutSection pageLayoutSection) { var layoutManager = new LayoutManager("", mDFInfo, mDFContainer); layoutManager.Add("CustomerAddress", new DFTextBox(mDFInfo.Fields["CustomerAddress"])); var config = new AutoLayoutConfig(); layoutManager.Config = config; config.Add("AccountingUnit_ID"); config.Add("Date"); config.Add("Department_ID"); config.Add("Customer_ID"); config.Add("Employee_ID"); config.Add("ProductionUnit_ID"); config.Add("CustomerAddress"); config.Add("Remark"); pageLayoutSection.SetRequired("AccountingUnit_ID"); pageLayoutSection.ApplyLayout(layoutManager, config, mPageLayoutManager, mDFInfo); titlePanel.Controls.Add(layoutManager.CreateLayout()); }
private void InitializeLayouts() { Document docPublish = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; ArrayList layoutIdList = GetLayoutIdList(docPublish.Database); using (docPublish.LockDocument()) { using (Transaction trans = docPublish.TransactionManager.StartTransaction()) { LayoutManager acLayoutMgr = LayoutManager.Current; Layout _layout = null; foreach (ObjectId layoutId in layoutIdList) { _layout = trans.GetObject(layoutId, OpenMode.ForRead) as Layout; acLayoutMgr.CurrentLayout = _layout.LayoutName; } acLayoutMgr.CurrentLayout = "Model"; trans.Commit(); } } //docPublish.CloseAndSave(docPublish.Name); }
CreateLayout ( LayoutUserSettings oLayoutUserSettings ) { Debug.Assert(oLayoutUserSettings != null); AssertValid(); LayoutManager oLayoutManager = new LayoutManager(); oLayoutManager.Layout = oLayoutUserSettings.Layout; IAsyncLayout oLayout = oLayoutManager.CreateLayout(); oLayoutUserSettings.TransferToLayout(oLayout); // Don't use binning, even if the user is using binning in the // NodeXLControl. oLayout.UseBinning = false; return(oLayout); }
protected override void OnTargetFound(View targetView, State state, Action action) { if (LayoutManager == null) { return; } int dx = CalculateDxToMakeVisible(targetView, HorizontalSnapPreference); int dy = CalculateDyToMakeVisible(targetView, VerticalSnapPreference); if (dx > 0) { dx = dx - LayoutManager .GetLeftDecorationWidth(targetView); } else { dx = dx + LayoutManager .GetRightDecorationWidth(targetView); } if (dy > 0) { dy = dy - LayoutManager .GetTopDecorationHeight(targetView); } else { dy = dy + LayoutManager .GetBottomDecorationHeight(targetView); } int distance = (int)Math.Sqrt(dx * dx + dy * dy); int time = CalculateTimeForDeceleration(distance); if (time > 0) { action.Update(-dx, -dy, time, MDecelerateInterpolator); } }
// [Timeout(2000)] public async Task ResolveBackgroundEventSingle() { logger.Debug("ResolveBackgroundEventSingle - Start"); LayoutManager layoutManager = (LayoutManager)ServiceManager.LayoutManager; await layoutManager.VerifyLayoutAsync(true); BeaconAction orgAction = layoutManager.Layout.ResolvedActions.FirstOrDefault(ra => ra.BeaconAction.Uuid == "9ded63644e424d758b0218f7c70f2473").BeaconAction; List <Beacon> list = new List <Beacon>() { new Beacon() { Id1 = "7367672374000000ffff0000ffff0004", Id2 = 39178, Id3 = 30929 }, new Beacon() { Id1 = "7367672374000000ffff0000ffff0004", Id2 = 39178, Id3 = 30929 } }; BackgroundEngine engine = new BackgroundEngine(); TaskCompletionSource <BeaconAction> action = new TaskCompletionSource <BeaconAction>(); int resolveCount = 0; engine.BeaconActionResolved += (sender, args) => { resolveCount++; action.SetResult(args); }; await engine.InitializeAsync(); await engine.ResolveBeaconActionsAsync(list, OUT_OF_RANGE_DB); BeaconAction result = await action.Task; Assert.AreEqual(orgAction, result, "action not found"); Assert.AreEqual(1, resolveCount, "More then onetime resolved"); logger.Debug("ResolveBackgroundEventSingle - End"); }
/// <summary> /// Shows the popup. /// </summary> public virtual void Show() { _ignoreVisibilityChange = true; try { EnsureInitialized(); IsVisible = true; if (!_hasExecutedInitialLayoutPass) { LayoutManager.ExecuteInitialLayoutPass(this); _hasExecutedInitialLayoutPass = true; } PlatformImpl?.Show(); Renderer?.Start(); } finally { _ignoreVisibilityChange = false; } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.stays); var toolbar = FindViewById <Android.Widget.Toolbar>(Resource.Id.toolbar); SetActionBar(toolbar); ActionBar.Title = "My Stays"; _recyclerView = FindViewById <RecyclerView>(Resource.Id.staysRecyclerView); // Plug in the linear layout manager: _layoutManager = new LinearLayoutManager(this); _recyclerView.SetLayoutManager(_layoutManager); var stays = DataEntryPoint.Instance.GetAllStays(); // Plug in my adapter: _adapter = new StaysListAdapter(stays); _recyclerView.SetAdapter(_adapter); }
public void YesNoPromptTest() { AssetMapping.GlobalIsThreadLocal = true; AssetMapping.Global.Clear() .RegisterAssetType(typeof(Base.SystemText), AssetType.Text) .RegisterAssetType(typeof(Base.Font), AssetType.Font) ; var systemText = new Dictionary <TextId, string> { { Base.SystemText.MainMenu_DoYouReallyWantToQuit, "Do you really want to quit?" }, { Base.SystemText.MsgBox_Yes, "Yes" }, { Base.SystemText.MsgBox_No, "No" } }; var ex = new EventExchange(new LogExchange()); var dm = new DialogManager(); var lm = new LayoutManager(); var mma = new MockModApplier() .Add(new AssetId(AssetType.MetaFont, (ushort)new MetaFontId(false, FontColor.White)), MockUniformFont.Font(AssetId.From(Base.Font.RegularFont))) .AddInfo(AssetId.From(Base.Font.RegularFont), MockUniformFont.Info) ; foreach (var kvp in systemText) { mma.Add(kvp.Key, kvp.Value); } ex .Attach(mma) .Attach(new AssetManager()) .Attach(new SpriteManager()) .Attach(new MockGameFactory()) .Attach(new WordLookup()) .Attach(new TextFormatter()) .Attach(new TextManager()) .Attach(new WindowManager { Resolution = (1920, 1080) })
public void DelLayouts() { Document doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; Editor ed = doc.Editor; LayoutManager LMR = LayoutManager.Current; ArrayList Layoutlist = new ArrayList(); using (Transaction Trans = db.TransactionManager.StartTransaction()) { try { //获取布局列表(剔除模型空间) DBDictionary Layouts = Trans.GetObject(db.LayoutDictionaryId, OpenMode.ForRead) as DBDictionary; foreach (DBDictionaryEntry item in Layouts) { if (item.Key != "Model") { Layout layoutobject = Trans.GetObject(item.Value, OpenMode.ForRead) as Layout; Layoutlist.Add(layoutobject); } } Trans.Commit(); } catch (Autodesk.AutoCAD.Runtime.Exception Ex) { ed.WriteMessage("出错啦!{0}", Ex.ToString()); } finally { Trans.Dispose(); } } foreach (Layout LT in Layoutlist) { LMR.DeleteLayout(LT.LayoutName); } }
protected override void BuildBasePropertiesEditor(TitlePanel titlePanel, PageLayoutSection pageLayoutSection) { var layoutManager = new LayoutManager("", mDFInfo, mDFContainer); var config = new AutoLayoutConfig(); layoutManager.Config = config; config.Add("Name"); config.Add("Department_ID"); config.Add("Employee_ID"); config.Add("DisplayMark"); config.Add("Packing_Attr"); config.Add("Packing_Pattern"); config.Add("ProductShift_Name"); config.Add("Abbreviation"); pageLayoutSection.SetRequired("Department_ID", "Name"); pageLayoutSection.ApplyLayout(layoutManager, config, mPageLayoutManager, mDFInfo); titlePanel.Controls.Add(layoutManager.CreateLayout()); }
CreateLayout ( LayoutUserSettings oLayoutUserSettings ) { Debug.Assert(oLayoutUserSettings != null); AssertValid(); LayoutManager oLayoutManager = new LayoutManager(); oLayoutManager.Layout = oLayoutUserSettings.Layout; ILayout oLayout = oLayoutManager.CreateLayout(); oLayoutUserSettings.TransferToLayout(oLayout); // Don't use groups or binning, even if the user is using one of those // in the NodeXLControl. oLayout.LayoutStyle = LayoutStyle.Normal; return(oLayout); }
public static void BuildRomFS(string infile, string outfile, RichTextBox TB_Progress = null, ProgressBar PB_Show = null) { OutFile = outfile; ROOT_DIR = infile; if (File.Exists(TempFile)) { File.Delete(TempFile); } FileNameTable FNT = new FileNameTable(ROOT_DIR); RomfsFile[] RomFiles = new RomfsFile[FNT.NumFiles]; LayoutManager.Input[] In = new LayoutManager.Input[FNT.NumFiles]; updateTB(TB_Progress, "Creating Layout..."); for (int i = 0; i < FNT.NumFiles; i++) { In[i] = new LayoutManager.Input { FilePath = FNT.NameEntryTable[i].FullName, AlignmentSize = 0x10 }; } LayoutManager.Output[] Out = LayoutManager.Create(In); for (int i = 0; i < Out.Length; i++) { RomFiles[i] = new RomfsFile { Offset = Out[i].Offset, PathName = Out[i].FilePath.Replace(Path.GetFullPath(ROOT_DIR), "").Replace("\\", "/"), FullName = Out[i].FilePath, Size = Out[i].Size }; } using (MemoryStream memoryStream = new MemoryStream()) { updateTB(TB_Progress, "Creating RomFS MetaData..."); BuildRomFSHeader(memoryStream, RomFiles, ROOT_DIR); MakeRomFSData(RomFiles, memoryStream, TB_Progress, PB_Show); } }
public MainWindow() { InitializeComponent(); LayoutManager = new LayoutManager(this, ProgrammaticDockSite) { LayoutFile = Path.Combine(_settingsFolder, "layout.xml") }; ConnectCommand = new DelegateCommand(Connect, CanConnect); SettingsCommand = new DelegateCommand(Settings, CanSettings); Directory.CreateDirectory(_settingsFolder); var storageRegistry = new StorageRegistry {DefaultDrive = new LocalMarketDataDrive(_settingsFolder)}; Connector = new Connector(); var storageAdapter = new StorageMessageAdapter(Connector.Adapter, new EntityRegistry(), storageRegistry); ConfigManager.RegisterService<ISecurityProvider>(new FilterableSecurityProvider(storageRegistry.GetSecurityStorage())); ConfigManager.RegisterService<IConnector>(Connector); ConfigManager.RegisterService<IMarketDataProvider>(Connector); _connectionFile = Path.Combine(_settingsFolder, "connection.xml"); if (File.Exists(_connectionFile)) Connector.Adapter.Load(new XmlSerializer<SettingsStorage>().Deserialize(_connectionFile)); _secView = new SecuritiesView(this) {SecurityGrid = {MarketDataProvider = Connector}}; Connector.MarketDepthsChanged += depths => { foreach (var depth in depths) { var ctrl = Depths.TryGetValue(depth.Security); if (ctrl != null) ctrl.UpdateDepth(depth); } }; }
public WorkAreaControl() { InitializeCommands(); InitializeComponent(); _controls = new Dictionary<string, Type>() { { "TradesPanel", typeof(TradesPanel) }, { "OrdersPanel", typeof(OrdersPanel) }, { "SecuritiesPanel", typeof(SecuritiesPanel) }, { "Level2Panel", typeof(Level2Panel) }, { "NewsPanel", typeof(NewsPanel) }, { "PortfoliosPanel", typeof(PortfoliosPanel) }, { "CandleChartPanel", typeof(CandleChartPanel) }, }; //_bufferedChart = new BufferedChart(Chart); _layoutManager = new LayoutManager(DockingManager); //WorkArea.PropertyChanging += WorkArea_PropertyChanging; //WorkArea.ChildrenCollectionChanged += WorkArea_ChildrenCollectionChanged; //WorkArea.ChildrenTreeChanged += WorkArea_ChildrenTreeChanged; //_pnlCurve = Curve.CreateCurve(LocalizedStrings.PnL, Colors.DarkGreen, EquityCurveChartStyles.Area); //_unrealizedPnLCurve = Curve.CreateCurve(LocalizedStrings.PnLUnreal, Colors.Black); //_commissionCurve = Curve.CreateCurve(LocalizedStrings.Str159, Colors.Red, EquityCurveChartStyles.DashedLine); //_posItems = PositionCurve.CreateCurve(LocalizedStrings.Str862, Colors.DarkGreen); }
public bool Render(DisplayInformation dpInfo, LayoutManager lm, bool isDesktopMode) { if( m_outputPath == string.Empty) return false; Rectangle wallRect; if (isDesktopMode) { wallRect = dpInfo.DesktopBounds; } else { wallRect = dpInfo.Primary.Bounds; wallRect.X = 0; wallRect.Y = 0; } // Create the bitmap representing the wallpaper Bitmap bmp = new Bitmap(wallRect.Width, wallRect.Height); Graphics e = Graphics.FromImage(bmp); e.FillRectangle(Brushes.Black, 0, 0, wallRect.Width, wallRect.Height); foreach(KeyValuePair<int, LayoutCanvas> kvp in lm) { LayoutCanvas canvas = kvp.Value; Screen screen = dpInfo.Screens[kvp.Key]; // Get X and Y coordinates of screen in IMAGE coordinates (taking into account // the shifts required to display the image properly) int x = (screen.X < 0) ? wallRect.Width + screen.X : screen.X; int y = (screen.Y < 0) ? -screen.Y : screen.Y; Rectangle scrBounds = new Rectangle(x, y, screen.Width, screen.Height); // Fill screen background if (screen.Y >= 0) { e.FillRectangle(new SolidBrush(canvas.BackgroundColour), scrBounds); } else { Rectangle scrTop = new Rectangle(x, wallRect.Height - y, scrBounds.Width, -wallRect.Y); Rectangle scrBtm = new Rectangle(x, -wallRect.Y - y, scrBounds.Width, scrBounds.Height + wallRect.Y); Brush brush = new SolidBrush(canvas.BackgroundColour); e.FillRectangle(brush, scrTop); e.FillRectangle(brush, scrBtm); } // Sort based on ZIndex LayoutObject[] clone = new LayoutObject[canvas.Count]; canvas.CopyTo(clone); BubbleSort(clone); for( int i = 0; i < clone.Length; i++) { LayoutObject lo = clone[i]; string trueSource = string.Empty; if (canvas.IsShuffleEnabled) { trueSource = FileRandomizer.GetRandomFile( Path.GetDirectoryName(lo.Source)); } else { trueSource = lo.Source; } Rectangle loBounds = new Rectangle(lo.X + x, lo.Y + y, lo.ActualWidth, lo.ActualHeight); if (scrBounds.IntersectsWith(loBounds)) { // Get intersecting region Rectangle intRect = Rectangle.Intersect(scrBounds, loBounds); // Resized image Bitmap bmpImage; if (lo.IsFlippedX || lo.IsFlippedY) { bmpImage = new Bitmap(loBounds.Width, loBounds.Height); Graphics gb = Graphics.FromImage(bmpImage); System.Drawing.Drawing2D.Matrix m = new System.Drawing.Drawing2D.Matrix(); m.Scale((lo.IsFlippedX) ? -1 : 1, (lo.IsFlippedY) ? -1 : 1); if(lo.IsFlippedX) m.Translate((float)-loBounds.Width + 1, 0); if (lo.IsFlippedY) m.Translate(0, (float)-loBounds.Height + 1); gb.Transform = m; gb.DrawImage(Image.FromFile(trueSource), new Rectangle(0, 0, loBounds.Width, loBounds.Height)); gb.Flush(); gb.Dispose(); gb = null; } else { bmpImage= new Bitmap(Image.FromFile(trueSource), loBounds.Size); } // The destination rectangle has the same width and height as the intersection rect // but we must update the coordinates Rectangle destRect = intRect; // Get the image's x and y coordinates relative to the screen position int ix = loBounds.X - x; int iy = loBounds.Y - y; // Offset the in image coords with the image coords destRect.X = (ix < 0) ? x : (x + ix); destRect.Y = (iy < 0) ? y : (y + iy); // Calculate the source rectangle Rectangle srcRect = intRect; srcRect.X = 0; srcRect.Y = 0; // If the image has negative coordinates, ie, it starts off the screen, we must // set the x to equal the portion into the image thats on the screen if (ix < 0) srcRect.X = (-1 * ix); if (iy < 0) srcRect.Y = (-1 * iy); if (screen.Y >= 0) { e.DrawImage(bmpImage, destRect, srcRect, GraphicsUnit.Pixel); } else { /* +----------------+ |xxxxxxxxxxxxxxxx| |xxxxxxxxxxxxxxxx| | +----------------+ | | | +----------------+ | | | +----------------+ */ destRect.Offset(0, screen.Y); Rectangle scrTop = new Rectangle(x, y + wallRect.Y, scrBounds.Width, -wallRect.Y); Rectangle scrBtm = new Rectangle(x, y, scrBounds.Width, scrBounds.Height + wallRect.Y); Rectangle destRectTop = Rectangle.Intersect(scrTop, destRect); Rectangle destRectBtm = Rectangle.Intersect(scrBtm, destRect); // destRectBtm -> Paints ontop // destRectTop -> Paints on bottom destRectTop.Y = destRect.Y + (wallRect.Height - y); destRectBtm.Y = -wallRect.Y - y; Rectangle srcRectTop = new Rectangle(srcRect.X, srcRect.Y, destRectTop.Width, destRectTop.Height); Rectangle srcRectBtm = new Rectangle(srcRect.X, srcRect.Y + srcRectTop.Height, destRectBtm.Width, destRectBtm.Height); e.DrawImage(bmpImage, destRectTop, srcRectTop, GraphicsUnit.Pixel); e.DrawImage(bmpImage, destRectBtm, srcRectBtm, GraphicsUnit.Pixel); } bmpImage.Dispose(); bmpImage = null; } } } e.Flush(System.Drawing.Drawing2D.FlushIntention.Flush); try { bmp.Save(m_outputPath, m_format); } catch(Exception) { e.Dispose(); e = null; bmp.Dispose(); bmp = null; return false; } e.Dispose(); e = null; bmp.Dispose(); bmp = null; GC.Collect(); return true; }
private void InitailizeAlbum() { // Update origin position & size _originPosition = new Point((double)PhotoHolder.GetValue(Canvas.LeftProperty), (double)PhotoHolder.GetValue(Canvas.TopProperty)); _originSize = new Point(PhotoHolder.Width, PhotoHolder.Height); // Initialize layout manager. _layoutManager = new LayoutManager(PhotoHolder, _photoDataSet, BtnSortCanvas, BtnRandomCanvas, BgCanvas, _sortNavi, _genuineSlice, _tracingIcon, _screenArrowLeft, _screenArrowRight); // Add host resize event listener. BrowserHost.Resize += new EventHandler(BrowserHost_Resize); }
public Panel(LayoutManager Layout,Window window) : base(window) { this.Layout = Layout; }
/// <summary> /// Sets the layout manager for this <code>JScrollPane</code>. /// </summary> public void setLayout(LayoutManager @layout) { }
public override sealed void SetLayoutManager(LayoutManager layout) { base.SetLayoutManager(layout); }
public LayoutManEvents() { m_bDone = false; m_lm = LayoutManager.Current; Do(); }
public override void SetLayoutManager(LayoutManager layout) { base.SetLayoutManager(layout); mLlm = layout; }
private void ApplicationLayout_ActiveLayoutChanged(object sender, LayoutManager.ActiveLayoutChangedArgs e) { UpdateStatusBar(); UpdateLayoutButtonSelection(); }
/// <summary> /// Sets the layout manager for this container. /// </summary> public void setLayout(LayoutManager @mgr) { }
/// <summary> /// Creates a new JPanel with the specified layout manager and buffering /// strategy. /// </summary> public JPanel(LayoutManager @layout, bool @isDoubleBuffered) { }
/// <summary> /// Create a new buffered JPanel with the specified layout manager /// </summary> public JPanel(LayoutManager @layout) { }
public MainWindow() { InitializeComponent(); Title = TypeHelper.ApplicationNameWithVersion; InitializeDataSource(); Directory.CreateDirectory(BaseApplication.AppDataPath); var compositionsPath = Path.Combine(BaseApplication.AppDataPath, "Compositions"); var strategiesPath = Path.Combine(BaseApplication.AppDataPath, "Strategies"); var logsPath = Path.Combine(BaseApplication.AppDataPath, "Logs"); _settingsFile = Path.Combine(BaseApplication.AppDataPath, "settings.xml"); var logManager = new LogManager(); logManager.Listeners.Add(new FileLogListener { Append = true, LogDirectory = logsPath, MaxLength = 1024 * 1024 * 100 /* 100mb */, MaxCount = 10, SeparateByDates = SeparateByDateModes.SubDirectories, }); logManager.Listeners.Add(new GuiLogListener(Monitor)); _strategiesRegistry = new StrategiesRegistry(compositionsPath, strategiesPath); logManager.Sources.Add(_strategiesRegistry); _strategiesRegistry.Init(); _layoutManager = new LayoutManager(DockingManager); _layoutManager.Changed += SaveSettings; logManager.Sources.Add(_layoutManager); var entityRegistry = ConfigManager.GetService<IEntityRegistry>(); var storageRegistry = ConfigManager.GetService<IStorageRegistry>(); _connector = new Connector(entityRegistry, storageRegistry) { StorageAdapter = { DaysLoad = TimeSpan.Zero } }; _connector.Connected += ConnectorOnConnectionStateChanged; _connector.Disconnected += ConnectorOnConnectionStateChanged; _connector.ConnectionError += ConnectorOnConnectionError; logManager.Sources.Add(_connector); ConfigManager.RegisterService(logManager); ConfigManager.RegisterService(_strategiesRegistry); ConfigManager.RegisterService(_layoutManager); ConfigManager.RegisterService<IConnector>(_connector); ConfigManager.RegisterService<ISecurityProvider>(_connector); SolutionExplorer.Compositions = _strategiesRegistry.Compositions; SolutionExplorer.Strategies = _strategiesRegistry.Strategies; }
public static Panel CreatePanel(LayoutManager layoutManager) { Panel p = new Panel(); layoutManagers.Add(p.GetHashCode(), layoutManager); return p; }