Ejemplo n.º 1
0
        public static void UpdateCornerTextDisplayData(DisplayData displaydata, ImgTxtDisplayState type, bool shouldRefresh = true)
        {
            lock (_syncObj)
            {
                try
                {
                    Logger.LogFuncUp();

                    if (null == displaydata)
                    {
                        Logger.LogError("displaydata is Null! ");
                        return;
                    }

                    if (!shouldRefresh)
                    {
                        ImgTxtDisplayState displayMode;
                        if (Enum.TryParse(type.ToString(), out displayMode))
                        {
                            displaydata.IsDirty            = true;
                            displaydata.PState.DisplayMode = displayMode;
                            return;
                        }
                        Logger.LogError("Transfor ImgTxtDisplayState failed! ");
                        return;
                    }

                    var overlayText = (OverlayFilmingF1ProcessText)displaydata.GetOverlay(OverlayType.FilmingF1ProcessText);
                    if (overlayText == null)
                    {
                        throw new NullReferenceException("no overlayText to be updated");
                    }

                    var graphicImageTxt = overlayText.GraphicFilmingF1ProcessText as GraphicFilmingF1ProcessText;
                    if (graphicImageTxt == null)
                    {
                        throw new NullReferenceException("no graphic image text to be updated");
                    }

                    switch (type)
                    {
                    case ImgTxtDisplayState.Customization:
                        var displaymode = overlayText.ImgTxtDisplayMode.ToString();     //保留高级应用显示状态
                        overlayText.SetImageTextDisplayMode(displaymode);
                        break;

                    case ImgTxtDisplayState.None:
                        overlayText.SetImageTextDisplayMode(ImgTxtDisplayState.None.ToString());
                        displaydata.PState.DisplayMode = ImgTxtDisplayState.None;
                        break;
                    }
                    Logger.LogFuncDown();
                }
                catch (Exception ex)
                {
                    Logger.LogWarning(ex.StackTrace);
                }
            }
        }