private void ensureSingleton()
 {
     if (_instance == null)
     {
         _instance = new RTLHelper();
         fireChangeOnAllProperties();
     }
 }
 private void ensureSingleton()
 {
     if (_instance == null)
     {
         _instance = new RTLHelper();
         fireChangeOnAllProperties();
     }
 }
        private void ShowWindow(bool isModal)
        {
            if (this.IsOpen)
                return;

            _modal = isModal;
            if (this._overlay != null)
                this._overlay.Visibility = isModal ? Visibility.Visible : Visibility.Collapsed;

            this.SubscribeToEvents();
            this.SubscribeToTemplatePartEvents();
            this.SubscribeToStoryBoardEvents();

            // Set the FloatingWindow FlowDirection since it is not inherited
            RTLHelper helper = new RTLHelper();
            this.FlowDirection = helper.FlowDirection;

            if (this.ChildWindowPopup == null)
            {
                this.ChildWindowPopup = new Popup();
                this.ChildWindowPopup.Child = this;
            }

            // Margin, MaxHeight and MinHeight properties should not be overwritten:
            this.Margin = new Thickness(0);
            this.MaxHeight = double.PositiveInfinity;
            this.MaxWidth = double.PositiveInfinity;

            if (this.ChildWindowPopup != null && System.Windows.Application.Current.RootVisual != null)
            {
                this.ChildWindowPopup.IsOpen = true;

                // while the ChildWindow is open, the DialogResult is always NULL:
                this._dialogresult = null;
            }

            // if the template is already loaded, display loading visuals animation
            if (this.ContentRoot != null)
            {
                this._isOpening = true;
                try
                {
                    this.ChangeVisualState();
                }
                finally
                {
                    this._isOpening = false;
                }
            }
        }