コード例 #1
0
        void ShowMenu()
        {
            var windowContent = new WindowContent();

            windowContent.onSelectionChanged += selected => value = selected;

            var content = getContent?.Invoke() ?? default;

            windowContent.Show(visualInput.worldBound, value, content.Items);
        }
コード例 #2
0
ファイル: WindowHelper.cs プロジェクト: Egyuza/Bentley.simpen
        internal static void show(Form form, string id = null)
        {
            if (id == null)
            {
                id = Assembly.GetExecutingAssembly().GetName().Name + "_" + form.GetType().Name;
            }

            WindowManager winMngr = // ! вычислит только если Addin загружено в DefaultDomain
                                    WindowManager.GetForMicroStation();

            if (winMngr == null)
            {
                form.Show();
                return;
            }

            WindowContent m_window = null;

            if (cache.ContainsKey(form))
            {
                m_window = cache[form];
            }
            else
            {
                try
                {
                    m_window = winMngr.DockPanel(form, id,
                                                 form.Text, DockLocation.Floating); // здесь вызов Frm_Load
                }
                catch (System.Exception ex)
                {
                    ex.Alert();
                    return;
                }

                cache.Add(form, m_window);

                form.FormClosed += Form_FormClosed;
            }
            FormWindowState state = form.WindowState;

            form.WindowState = state != FormWindowState.Normal ? FormWindowState.Normal : state;

            m_window.MinimumSize = new System.Drawing.Size(
                form.MinimumSize.Width + 5, form.MinimumSize.Height + 5);
            m_window.Show();
            m_window.FloatingHostForm?.Refresh();
            form.Refresh();
        }