void RefreshBar(NSView view)
 {
     if (service.GetTouchBarDelegate(view)?.NativeObject is TouchBarBaseDelegate currentDelegate)
     {
         currentDelegate.SetCurrentView(view);
         touchbar.Delegate = currentDelegate;
         touchbar.DefaultItemIdentifiers = currentDelegate.Identifiers;
         view.SetTouchBar(touchbar);
     }
 }