protected virtual IDisposable Present(NSPanel panel) { var app = NSApplication.SharedApplication; app.InvokeOnMainThread(() => app.MainWindow?.BeginSheet(panel, _ => { })); return(new DisposableAction(() => app.BeginInvokeOnMainThread(() => app.MainWindow?.EndSheet(panel)))); }
/// <summary> /// Görevler panelindeki önceki nesneleri sildiğimiz metod /// </summary> private void clearItems() { NSPanel.Controls.Clear(); NSPanel.Refresh(); IPPanel.Controls.Clear(); IPPanel.Refresh(); DPanel.Controls.Clear(); DPanel.Refresh(); }
private void FileExtensionRemoved(object sender, FileExtensionEventArgs e) { if (e.Extension == extension) { extension = null; _exceptionCaughtLayer.RemoveAllAdornments(); if (exceptionCaughtButtonWindow != null) { exceptionCaughtButtonWindow.Close(); exceptionCaughtButtonWindow = null; } } }
private void RenderAdornment(FileLineExtension fileLineExtension) { NSView view; bool mini; if (fileLineExtension is ExceptionCaughtButton button) { mini = false; view = CreateButton(cocoaViewFactory, button); } else if (fileLineExtension is ExceptionCaughtMiniButton miniButton) { mini = true; view = CreateMiniButton(cocoaViewFactory, miniButton); } else { return; } if (extension != fileLineExtension) { extension = fileLineExtension; var newSpan = textView.TextSnapshot.SpanFromMDColumnAndLine(extension.Line, extension.Column, extension.Line, extension.Column); trackingSpan = textView.TextSnapshot.CreateTrackingSpan(newSpan, SpanTrackingMode.EdgeInclusive); } var span = trackingSpan.GetSpan(textView.TextSnapshot); if (textView.TextViewLines == null) { return; } if (!textView.TextViewLines.FormattedSpan.Contains(span.End)) { return; } _exceptionCaughtLayer.RemoveAllAdornments(); if (exceptionCaughtButtonWindow != null) { exceptionCaughtButtonWindow.Close(); exceptionCaughtButtonWindow = null; } var charBound = textView.TextViewLines.GetCharacterBounds(span.End); if (mini) { try { view.SetFrameOrigin(new CGPoint( Math.Round(charBound.Left), Math.Round(charBound.TextTop - charBound.TextHeight / 2 - view.Frame.Height / 2))); } catch (Exception e) { view.SetFrameOrigin(default);
/// <summary> /// Show next introduction step /// </summary> private void ShowNextIntoductionStep() { NSPanel panelToShow = null; switch (__InotroductionStage) { case IntroductionStageEnum.Starting: panelToShow = GuiIntroductionPanelWelcome; __InotroductionStage = IntroductionStageEnum.Welcome; break; case IntroductionStageEnum.Welcome: panelToShow = GuiIntroductionPanelConnectBtn; __InotroductionStage = IntroductionStageEnum.ConnectBtn; break; case IntroductionStageEnum.ConnectBtn: panelToShow = GuiIntroductionPanelFirewall; __InotroductionStage = IntroductionStageEnum.Firewall; break; case IntroductionStageEnum.Firewall: panelToShow = GuiIntroductionPanelServers; __InotroductionStage = IntroductionStageEnum.Servers; break; case IntroductionStageEnum.Servers: __InotroductionStage = IntroductionStageEnum.Finished; break; } // fit transparent view to window size GuiTopTransparentView.Frame = MainPageView.Frame; // request View to redraw ((PageView)GuiTopTransparentView).SetDrawer(this); NSApplication.SharedApplication.StopModal(); if (panelToShow != null) { InitializeDialogPositions(); panelToShow.ParentWindow = Window; panelToShow.MakeKeyAndOrderFront(this); NSApplication.SharedApplication.RunModalForWindow(panelToShow); } }
public ProgressDialog(ProgressDialogConfig config) { this.config = config; this.title = config.Title; this.mainWindow = NSApplication.SharedApplication.KeyWindow; progressPanel = new NSPanel(new CGRect(0, 0, 100, 140), NSWindowStyle.DocModal, NSBackingStore.Buffered, true) { BackgroundColor = NSColor.White }; var view = new NSView(); txtTitle = new NSTextField { Editable = false, Hidden = string.IsNullOrEmpty(this.title), Alignment = NSTextAlignment.Center }; progressIndicator = new NSProgressIndicator { Style = NSProgressIndicatorStyle.Spinning, Indeterminate = !config.IsDeterministic, MinValue = 0, DoubleValue = 0, MaxValue = 100 }; view.AggregateSubviews(txtTitle, progressIndicator); NSButton cancelButton = null; if (config.OnCancel != null) { cancelButton = new NSButton { Title = config.CancelText }; cancelButton.Activated += (sender, e) => { Hide(true); }; view.AggregateSubviews(cancelButton); } txtTitle.TopAnchor.ConstraintEqualToAnchor(view.TopAnchor).Active = true; txtTitle.LeadingAnchor.ConstraintEqualToAnchor(view.LeadingAnchor).Active = true; txtTitle.TrailingAnchor.ConstraintEqualToAnchor(view.TrailingAnchor).Active = true; progressIndicator.TopAnchor.ConstraintEqualToAnchor(txtTitle.BottomAnchor, 2).Active = true; progressIndicator.LeadingAnchor.ConstraintEqualToAnchor(view.LeadingAnchor).Active = true; progressIndicator.TrailingAnchor.ConstraintEqualToAnchor(view.TrailingAnchor).Active = true; progressIndicator.HeightAnchor.ConstraintEqualToConstant(100).Active = true; progressIndicator.WidthAnchor.ConstraintEqualToConstant(100).Active = true; if (cancelButton == null) { progressIndicator.BottomAnchor.ConstraintLessThanOrEqualToAnchor(view.BottomAnchor).Active = true; } else { cancelButton.TopAnchor.ConstraintEqualToAnchor(progressIndicator.BottomAnchor, 2).Active = true; cancelButton.CenterXAnchor.ConstraintEqualToAnchor(view.CenterXAnchor).Active = true; cancelButton.BottomAnchor.ConstraintLessThanOrEqualToAnchor(view.BottomAnchor).Active = true; } progressPanel.ContentView = view; }