예제 #1
0
        }         // func UnloadAsync

        private IPpsWindowPane SetWindowPane(IPpsWindowPane newPane)
        {
            Resources[PpsShellWpf.CurrentWindowPaneKey] = newPane;

            newPane.PropertyChanged += CurrentPanePropertyChanged;

            SetValue(titlePropertyKey, newPane.Title);
            SetValue(subTitlePropertyKey, newPane.SubTitle);
            SetValue(imagePropertyKey, newPane.Image);
            SetValue(commandsPropertyKey, newPane.Commands);
            SetValue(controlPropertyKey, newPane.Control);
            SetValue(hasPaneSideBarPropertyKey, newPane.HasSideBar);

            if (charmBarControl != null)
            {
                charmBarControl.CurrentData = newPane.CurrentData;
                charmBarControl.HelpKey     = newPane.HelpKey;
            }

            SetValue(currentPanePropertyKey, newPane);

            // update focus, if it takes to long to load the pane
            UpdateFocus(false);

            return(newPane);
        }         // proc SetWindowPane
예제 #2
0
        }         // proc AddPane

        /// <summary></summary>
        /// <param name="paneType"></param>
        /// <param name="arguments"></param>
        /// <param name="compatibleAllowed"></param>
        /// <returns></returns>
        public Tuple <PpsWindowPaneCompareResult, IPpsWindowPane> FindPaneByArguments(Type paneType, LuaTable arguments, bool compatibleAllowed = false)
        {
            IPpsWindowPane compatiblePane = null;

            foreach (var p in panes)
            {
                // todo: fix cap between create and loading...
                if (p.CurrentPane?.GetType() == paneType)
                {
                    var r = p.CurrentPane.CompareArguments(arguments);
                    if (r == PpsWindowPaneCompareResult.Same)
                    {
                        return(new Tuple <PpsWindowPaneCompareResult, IPpsWindowPane>(r, p.CurrentPane));
                    }
                    else if (r == PpsWindowPaneCompareResult.Reload && compatiblePane == null)
                    {
                        compatiblePane = p.CurrentPane;
                    }
                }
            }

            return(compatiblePane == null ?
                   new Tuple <PpsWindowPaneCompareResult, IPpsWindowPane>(PpsWindowPaneCompareResult.Incompatible, null) :
                   new Tuple <PpsWindowPaneCompareResult, IPpsWindowPane>(PpsWindowPaneCompareResult.Reload, compatiblePane));
        }         // func FindPaneByArguments
예제 #3
0
        }         // proc Dispose

        /// <summary></summary>
        /// <param name="windowPane"></param>
        /// <returns></returns>
        public async Task LoadAsync(IPpsWindowPane windowPane)
        {
            using (var bar = windowPane.DisableUI(String.Format("Lade Dokument ({0})...", dataInfo.Name)))
            {
                // create access
                dataAccess = await dataInfo.LoadAsync();

                dataAccess.DisableUI    = () => windowPane.DisableUI("Pdf-Dokument wird bearbeitet...");
                dataAccess.DataChanged += async(sender, e) => await LoadFromObjectAsync();

                await LoadFromObjectAsync();
            }
        }         // func LoadAsync
예제 #4
0
        }         // proc SetWindowPane

        private void ClearWindowPane(IPpsWindowPane pane)
        {
            // remove object from memory
            pane.PropertyChanged -= CurrentPanePropertyChanged;
            pane.Dispose();

            SetValue(commandsPropertyKey, null);
            SetValue(hasPaneSideBarPropertyKey, false);
            SetValue(currentPanePropertyKey, null);

            // clear document
            charmBarControl.CurrentData = null;
            charmBarControl.HelpKey     = null;

            Resources[PpsShellWpf.CurrentWindowPaneKey] = null;
        }         // proc ClearWindowPane
예제 #5
0
 bool IPpsWindowPaneManager.ActivatePane(IPpsWindowPane pane)
 => pane == CurrentPane?Activate() : false;
예제 #6
0
 /// <summary></summary>
 /// <param name="pane"></param>
 /// <param name="text"></param>
 /// <param name="value"></param>
 /// <returns></returns>
 public static IPpsProgress DisableUI(this IPpsWindowPane pane, string text = null, int value = -1)
 => DisableUI(pane.PaneHost, text, value);
예제 #7
0
        }         // func LoadPaneDataAsync

        #endregion

        /// <summary>Are the pane equal to the pane arguments.</summary>
        /// <param name="pane">Pane to compare with.</param>
        /// <param name="paneType">Type of the other pane.</param>
        /// <param name="arguments">Arguments of the other pane.</param>
        /// <returns><c>true</c>, if the pane arguments are the same.</returns>
        public static bool EqualPane(this IPpsWindowPane pane, Type paneType, LuaTable arguments)
        => pane != null && paneType == pane.GetType() && pane.CompareArguments(arguments ?? new LuaTable()) == PpsWindowPaneCompareResult.Same;