public ActionResult Edit([Bind(Include = "InfoId,Title,Description,Image, File")] DisplayInfo displayInfo, HttpPostedFileBase file)
        {
            if (ModelState.IsValid)
            {
                var currentInfo = db.DisplayInfo.Find(displayInfo.InfoId);
                currentInfo.Title       = displayInfo.Title;
                currentInfo.Description = displayInfo.Description;

                if (file != null && file.ContentLength > 0)
                {
                    var img = ImageUploadController.ImageBytes(file, out string convertedLogo);
                    currentInfo.Image = img;
                    currentInfo.File  = file.FileName;
                }
                else
                {
                    currentInfo.Image = displayInfo.Image;
                    currentInfo.File  = displayInfo.File;
                }
                db.Entry(currentInfo).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(displayInfo));
        }
Exemplo n.º 2
0
        //
        // To calculate right margin of the title image to compansate the burger menu at the left hand side
        //
        private bool AdjustTitleImage()
        {
            var titleView      = Shell.GetTitleView(this);
            var titleViewBound = titleView.Bounds;

            if (titleViewBound.Width == -1)
            {
                //The layout still not yet render, exit from execution
                return(false);
            }

            //Get display information using xamarin essential
            DisplayInfo displayInfo  = DeviceDisplay.MainDisplayInfo;
            double      displayWidth = displayInfo.Width / displayInfo.Density;

            double marginWidth = 0;

            if (Device.RuntimePlatform == Device.iOS)
            {
                marginWidth = 10; //FIXME: please don't hardcode 10 margin
            }

            //Calculate right margin needed by calculating the burger menu button width
            double leftButtonWidth = displayWidth - titleViewBound.Width - marginWidth * 2;

            TitleImage.Margin         = new Thickness(0, 0, leftButtonWidth, 0);
            TitleImage.Opacity        = 1; //Turn on the Title image
            App.TitleImageRightMargin = leftButtonWidth;

            //Save the value for future use, no need to go through this calculation again
            SecureStorage.SetAsync(Constants.TITLE_IMAGE_RIGHT_MARGIN_TAG, App.TitleImageRightMargin.ToString());
            return(true);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 统计图书数量和可借阅数
        /// </summary>
        /// <param name="booknum">图书信息</param>
        /// <returns>显示数据</returns>
        private List <DisplayInfo> GetRepeat(List <BookItem> booknum)
        {
            List <DisplayInfo> displayInfolist = new List <DisplayInfo>();

            for (int i = 0; i < booknum.Count; i++)
            {
                int         sum             = 0;
                int         isloan          = 0;
                DisplayInfo tempdisplayInfo = new DisplayInfo();
                tempdisplayInfo.BookID = booknum[i].BookID;
                for (int j = 0; j < booknum.Count; j++)
                {
                    if (booknum[i].BookID == booknum[j].BookID)
                    {
                        // 记录重复数
                        sum++;
                        if (booknum[j].ISLoan == 0)
                        {
                            // 记录图书可借阅数
                            isloan++;
                        }

                        // 从列表中删除重复数据
                        booknum.Remove(booknum[j]);
                    }
                }

                tempdisplayInfo.BookNum  = sum;
                tempdisplayInfo.Bookleft = isloan;
                displayInfolist.Add(tempdisplayInfo);
            }

            return(displayInfolist);
        }
        /// <summary>
        /// Initializes a new instance of <see cref="MaterialDateField"/>.
        /// </summary>
        public MaterialDateField()
        {
            InitializeComponent();

            _propertyChangeActions = new Dictionary <string, Action>
            {
                { nameof(HelperText), () => OnHelperTextChanged() },
                { nameof(ErrorText), () => OnErrorTextChanged() },

                { nameof(Date), () => OnDateChanged(Date) },
                { nameof(IsEnabled), () => OnEnabledChanged(IsEnabled) },
                { nameof(HasError), () => UpdateErrorState() },
                { nameof(ErrorIcon), () => UpdateErrorState() },
                { nameof(DropDrownArrowIcon), () => UpdateErrorState() },

                { nameof(FloatingPlaceholderEnabled), () => OnFloatingPlaceholderEnabledChanged() },
            };

            datePicker.DateSelected += DatePicker_DateChanged;
            //datePicker.SizeChanged += Entry_SizeChanged;
            datePicker.Focused   += DatePicker_Focused;
            datePicker.Unfocused += DatePicker_Unfocused;

            _lastDeviceDisplay = DeviceDisplay.MainDisplayInfo;
            DeviceDisplay.MainDisplayInfoChanged += DeviceDisplay_MainDisplayInfoChanged;
        }
Exemplo n.º 5
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = CardsFixedAtLevel?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ (ComputerDifficulty != null ? ComputerDifficulty.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (DisplayInfo != null ? DisplayInfo.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Hide.GetHashCode();
         hashCode = (hashCode * 397) ^ (Id?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Image != null ? Image.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ IsNew.GetHashCode();
         hashCode = (hashCode * 397) ^ IsQuickmatchPlaylist.GetHashCode();
         hashCode = (hashCode * 397) ^ IsTeamGamePlaylist.GetHashCode();
         hashCode = (hashCode * 397) ^ LonelyPartyUsesWildcard.GetHashCode();
         hashCode = (hashCode * 397) ^ MatchTicketTimeoutDurationSeconds;
         hashCode = (hashCode * 397) ^ MaxPartySize;
         hashCode = (hashCode * 397) ^ MaxPlayerCount;
         hashCode = (hashCode * 397) ^ MinPartySize;
         hashCode = (hashCode * 397) ^ MinPlayerCount;
         hashCode = (hashCode * 397) ^ (MpsdHopperName?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (MpsdHopperStatName?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (PlaylistEntries?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (StatsClassification?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (TargetPlatform?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (ThumbnailImage != null ? ThumbnailImage.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ UsesBanRules.GetHashCode();
         hashCode = (hashCode * 397) ^ Voting.GetHashCode();
         return(hashCode);
     }
 }
Exemplo n.º 6
0
 public virtual void EvaluateDisplayInfo(DisplayInfo displayInfo)
 {
     foreach (var item in SubObjects)
     {
         item.EvaluateDisplayInfo(displayInfo);
     }
 }
Exemplo n.º 7
0
        public DisplayInfo GetInfo(HashedString category)
        {
            DisplayInfo result = default(DisplayInfo);

            if (data != null && typeof(IList <DisplayInfo>).IsAssignableFrom(data.GetType()))
            {
                IList <DisplayInfo> list = (IList <DisplayInfo>)data;
                {
                    foreach (DisplayInfo item in list)
                    {
                        DisplayInfo current = item;
                        result = current.GetInfo(category);
                        if (result.category == category)
                        {
                            return(result);
                        }
                        if (current.category == category)
                        {
                            return(current);
                        }
                    }
                    return(result);
                }
            }
            return(result);
        }
Exemplo n.º 8
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(((Cards?.GetHashCode() ?? 0) * 397) ^ (DisplayInfo != null ? DisplayInfo.GetHashCode() : 0));
     }
 }
Exemplo n.º 9
0
        public static float2 GetScreenSize(ComponentSystemBase sys)
        {
            var         env = sys.World.TinyEnvironment();
            DisplayInfo di  = env.GetConfigData <DisplayInfo>();

            return(new float2(di.width, di.height));
        }
Exemplo n.º 10
0
        public void TestGetBounds()
        {
            var displayInfo   = DisplayInfo.AllDisplayInfos.First();
            var displayBounds = DisplayInfo.GetBounds(displayInfo.Bounds.Location);

            Assert.Equal(displayInfo.Bounds, displayBounds);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Returns the number of Displays using the Win32 functions.
        /// </summary>
        /// <returns>A collection of DisplayInfo with information about each monitor.</returns>
        public static List<DisplayInfo> QueryDisplays()
        {
            // Output monitors.
            var lMonitors = new List<DisplayInfo>();

            // Get the monitors, for each one, add it to the list.
            EnumDisplayMonitors(IntPtr.Zero, IntPtr.Zero,
                delegate(IntPtr hMonitor, IntPtr hdcMonitor, ref Rect lprcMonitor, IntPtr dwData)
                {
                    // Create a struct to contain the info and query it.
                    MonitorInfo mi = new MonitorInfo();
                    mi.Size = (uint)Marshal.SizeOf(mi);
                    mi.DeviceName = string.Empty;
                    bool bSuccess = GetMonitorInfo(hMonitor, ref mi);

                    // If it didn't fail, write the data.
                    if (bSuccess)
                    {
                        DisplayInfo di = new DisplayInfo();
                        di.ScreenWidth = mi.Monitor.Right - mi.Monitor.Left;
                        di.ScreenHeight = mi.Monitor.Bottom - mi.Monitor.Top;
                        di.MonitorArea = new Rect(mi.Monitor.Left, mi.Monitor.Top, di.ScreenWidth, di.ScreenHeight);
                        di.WorkArea = new Rect(mi.WorkArea.Left, mi.WorkArea.Top, (mi.WorkArea.Right - mi.WorkArea.Left), (mi.WorkArea.Bottom - mi.WorkArea.Top));
                        di.Availability = mi.Flags.ToString();
                        di.DeviceName = mi.DeviceName;
                        lMonitors.Add(di);
                    }
                    return true;
                }, IntPtr.Zero);
            return lMonitors;
        }
Exemplo n.º 12
0
        public void Display(DisplayInfo displayInfo)
        {
            if (displayInfo.HasFlag(DisplayInfo.DisplaySuffixLinks))
            {
                foreach (var p in internals)
                {
                    if (p.Parent != null)
                    {
                        var thisSuffix = this.Tree.GetNodeSuffix(p);
                        var linkSuffix = this.Tree.GetNodeSuffix(p.Link);

                        if (displayInfo.HasFlag(DisplayInfo.DisplayContent))
                        {
                            Debug.Write(thisSuffix); Debug.Write(" | "); Debug.WriteLine(linkSuffix);
                        }
                        else
                        {
                            Debug.Write(thisSuffix.Length.ToString()); Debug.Write(" | "); Debug.WriteLine(linkSuffix.Length.ToString());
                        }
                    }
                }
            }

            if (displayInfo.HasFlag(DisplayInfo.DisplaySuffixes))
            {
                foreach (var p in suffixes.Values)
                {
                    var    suffix = this.Tree.GetNodeSuffix(p);
                    string format = string.Format("leaf node {{0, 3}} -- Sx={{1, {0}}}", this.Tree.Text.Length);
                    Debug.WriteLine(string.Format(format, p.LeafNumber, displayInfo.HasFlag(DisplayInfo.DisplayContent) ? suffix : suffix.Length.ToString()));
                }
            }
        }
Exemplo n.º 13
0
        // Initializes the DetectDisplays library.
        public static void Initialize()
        {
            displayInfo = new DisplayInfo();
            IntPtr pointer = IntPtr.Zero;

            try
            {
                pointer = Marshal.AllocHGlobal(Marshal.SizeOf(displayInfo));
                int returnValue = DD.Initialize(pointer);

                displayInfo = (DisplayInfo)Marshal.PtrToStructure(pointer, typeof(DisplayInfo));

                // Detection failed
                if (returnValue == 0)
                {
                    InitializeNoDetectDisplays();
                }
            }
            catch
            {
                //// (Exception e)
                //// MessageBox.Show(string.Format("Exception: {0}\n\nStack Trace:\n{1}", e.Message, e.StackTrace));
                InitializeNoDetectDisplays();

                throw;
            }
            finally
            {
                Marshal.FreeHGlobal(pointer);
            }
        }
Exemplo n.º 14
0
        private void Configure(Window view, object viewModel = null)
        {
            // without VieWModel we cannot uniquely identify the window
            if (!(viewModel is IMaintainPosition) || _uiConfiguration == null || !_uiConfiguration.AreWindowLocationsStored)
            {
                return;
            }

            var windowName = viewModel.GetType().FullName;

            var screenBounds = DisplayInfo.GetAllScreenBounds();
            var hasPlacement = _uiConfiguration.WindowLocations.TryGetValue(windowName, out var placement);

            if (!hasPlacement || placement.ShowCmd == ShowWindowCommands.Normal && !screenBounds.Contains(placement.NormalPosition))
            {
                view.WindowStartupLocation = view.Owner != null ? WindowStartupLocation.CenterOwner : _uiConfiguration.DefaultWindowStartupLocation;
                hasPlacement = false;
            }
            if (hasPlacement)
            {
                view.WindowStartupLocation = WindowStartupLocation.Manual;
            }

            // Storage for the event handlers, so we can remove them again
            EventHandler[] eventHandlers = new EventHandler[3];

            // Store Placement
            eventHandlers[1] = (sender, args) =>
            {
                // ReSharper disable once InvokeAsExtensionMethod
                var newPlacement = WindowsExtensions.RetrievePlacement(view);
                if (newPlacement.ShowCmd == ShowWindowCommands.Hide)
                {
                    // Ignore
                    return;
                }
                Log.Debug().WriteLine("Stored placement {0} for Window {1}", newPlacement.NormalPosition, windowName);
                _uiConfiguration.WindowLocations[windowName] = newPlacement;
            };
            // Cleanup handlers
            eventHandlers[2] = (s, e) =>
            {
                view.LocationChanged -= eventHandlers[1];
                view.Closed          -= eventHandlers[2];
            };

            //Initialize handlers
            eventHandlers[0] = (sender, args) =>
            {
                if (hasPlacement)
                {
                    // Make sure the placement is set
                    WindowsExtensions.ApplyPlacement(view, placement);
                }
                view.LocationChanged -= eventHandlers[0];
                view.LocationChanged += eventHandlers[1];
                view.Closed          += eventHandlers[2];
            };
            view.LocationChanged += eventHandlers[0];
        }
Exemplo n.º 15
0
        /// <summary>
        /// Returns the number of Displays using the Win32 functions.
        /// </summary>
        /// <returns>A collection of DisplayInfo with information about each monitor.</returns>
        public static List <DisplayInfo> QueryDisplays()
        {
            // Output monitors.
            var lMonitors = new List <DisplayInfo>();

            // Get the monitors, for each one, add it to the list.
            EnumDisplayMonitors(IntPtr.Zero, IntPtr.Zero,
                                delegate(IntPtr hMonitor, IntPtr hdcMonitor, ref Rect lprcMonitor, IntPtr dwData)
            {
                // Create a struct to contain the info and query it.
                MonitorInfo mi = new MonitorInfo();
                mi.Size        = (uint)Marshal.SizeOf(mi);
                mi.DeviceName  = string.Empty;
                bool bSuccess  = GetMonitorInfo(hMonitor, ref mi);

                // If it didn't fail, write the data.
                if (bSuccess)
                {
                    DisplayInfo di  = new DisplayInfo();
                    di.ScreenWidth  = mi.Monitor.Right - mi.Monitor.Left;
                    di.ScreenHeight = mi.Monitor.Bottom - mi.Monitor.Top;
                    di.MonitorArea  = new Rect(mi.Monitor.Left, mi.Monitor.Top, di.ScreenWidth, di.ScreenHeight);
                    di.WorkArea     = new Rect(mi.WorkArea.Left, mi.WorkArea.Top, (mi.WorkArea.Right - mi.WorkArea.Left), (mi.WorkArea.Bottom - mi.WorkArea.Top));
                    di.Availability = mi.Flags.ToString();
                    di.DeviceName   = mi.DeviceName;
                    lMonitors.Add(di);
                }
                return(true);
            }, IntPtr.Zero);
            return(lMonitors);
        }
    void Start()
    {
        displayInfo = GetComponent <DisplayInfo>();

        screenUL = displayInfo.Px_UpperLeft;
        screenLL = displayInfo.Px_LowerLeft;
        screenLR = displayInfo.Px_LowerRight;

        head = GetComponentInParent <VRDisplayManager>().headTrackedUser;

        vrCamera = new GameObject(gameObject.name + " (VR Camera)");
        vrCamera.transform.parent           = GetComponentInParent <VRDisplayManager>().virtualHead;
        vrCamera.transform.localPosition    = Vector3.zero;
        vrCamera.transform.localEulerAngles = new Vector3(0, displayInfo.h + GetComponentInParent <VRDisplayManager>().displayAngularOffset, 0);

        virtualCamera             = vrCamera.AddComponent <Camera>();
        virtualCamera.cullingMask = virtualCameraCullingMask;

        RenderTexture cameraRT = new RenderTexture((int)displayResolution.x, (int)displayResolution.y, 16);

        if (renderTextureToVRCamera)
        {
            virtualCamera.targetTexture = cameraRT;
        }

        Material displayMat = new Material(Shader.Find("Unlit/Texture"));

        displayMat.name        = gameObject.name + " (VR Camera Material)";
        displayMat.mainTexture = cameraRT;

        Transform displaySpace = transform.Find("Borders/PixelSpace");

        displaySpace.GetComponent <MeshRenderer>().material = displayMat;
        //displaySpace.gameObject.layer = GetComponentInParent<VRDisplayManager>().gameObject.layer;
    }
Exemplo n.º 17
0
        /// <summary>
        /// 模糊查询
        /// </summary>
        /// <param name="bookname">借阅人</param>
        /// <returns>图书</returns>
        public List <DisplayInfo> QueryByName(string bookname)
        {
            GetBookInfoMgr     getBookInfoMgr     = new GetBookInfoMgr();
            GetBookItemInfoMgr getBookItemInfoMgr = new GetBookItemInfoMgr();
            List <DisplayInfo> displayInfolist    = new List <DisplayInfo>();
            List <Bookinfo>    bookinfoList       = new List <Bookinfo>();

            // 获取全部图书信息
            bookinfoList = getBookInfoMgr.QueryBookByName(bookname);

            foreach (Bookinfo tempinfo in bookinfoList)
            {
                DisplayInfo displayInfo = new DisplayInfo();
                displayInfo.BookID   = tempinfo.BookID;
                displayInfo.Title    = tempinfo.Title;
                displayInfo.Decrible = tempinfo.Decrible;

                // 获取该书的总数
                displayInfo.BookNum = getBookItemInfoMgr.GetKindBookSum(tempinfo.BookID);

                // 获取该数的可借阅数
                displayInfo.Bookleft = getBookItemInfoMgr.GetISloanBookSum(tempinfo.BookID);
                displayInfolist.Add(displayInfo);
            }

            return(displayInfolist);
        }
Exemplo n.º 18
0
 protected override void OnUpdate()
 {
     using (var query = EntityManager.CreateEntityQuery(typeof(ConfigurationTag))) {
         int num = query.CalculateEntityCount();
         Assert.IsTrue(num != 0);
         var               singletonEntity = query.GetSingletonEntity();
         DisplayInfo       di = DisplayInfo.Default;
         RenderGraphConfig rc = RenderGraphConfig.Default;
         di.colorSpace = UnityEditor.PlayerSettings.colorSpace == UnityEngine.ColorSpace.Gamma ? ColorSpace.Gamma : ColorSpace.Linear;
         if (BuildConfiguration != null)
         {
             if (BuildConfiguration.TryGetComponent <TinyRenderingSettings>(out var settings))
             {
                 di.width               = settings.WindowSize.x;
                 di.height              = settings.WindowSize.y;
                 di.autoSizeToFrame     = settings.AutoResizeFrame;
                 di.disableVSync        = settings.DisableVsync;
                 di.gpuSkinning         = settings.GPUSkinning;
                 rc.RenderBufferWidth   = settings.RenderResolution.x;
                 rc.RenderBufferHeight  = settings.RenderResolution.y;
                 rc.RenderBufferMaxSize = settings.MaxResolution;
                 rc.Mode = settings.RenderGraphMode;
             }
             else
             {
                 UnityEngine.Debug.LogWarning($"The {nameof(TinyRenderingSettings)} build component is missing from the build configuration {BuildConfiguration.name}. Default rendering settings have been exported.");
             }
         }
         EntityManager.AddComponentData(singletonEntity, di);
         EntityManager.AddComponentData(singletonEntity, rc);
     }
 }
Exemplo n.º 19
0
        /// <summary>
        /// 组装显示信息
        /// </summary>
        /// <returns>显示信息</returns>
        public List <DisplayInfo> GetDisplayinfo()
        {
            GetBookInfoMgr     getBookInfoMgr     = new Business.GetBookInfoMgr();
            GetBookItemInfoMgr getBookItemInfoMgr = new GetBookItemInfoMgr();
            List <DisplayInfo> displayInfolist    = new List <DisplayInfo>();
            List <Bookinfo>    bookinfoList       = new List <Bookinfo>();

            // 获取全部图书信息
            bookinfoList = getBookInfoMgr.GetAllBookInfo();
            foreach (Bookinfo tempinfo in bookinfoList)
            {
                DisplayInfo displayInfo = new DisplayInfo();
                displayInfo.BookID   = tempinfo.BookID;
                displayInfo.Title    = tempinfo.Title;
                displayInfo.Decrible = tempinfo.Decrible;

                // 获取该书的总数
                displayInfo.BookNum = getBookItemInfoMgr.GetKindBookSum(tempinfo.BookID);

                // 获取该数的可借阅数
                displayInfo.Bookleft = getBookItemInfoMgr.GetISloanBookSum(tempinfo.BookID);
                displayInfolist.Add(displayInfo);
            }

            return(displayInfolist);
        }
Exemplo n.º 20
0
        protected override void OnUpdate()
        {
            Entities.WithAll <CameraAutoAspectFromDisplay>().ForEach((ref Camera c) =>
            {
                TinyEnvironment env = World.TinyEnvironment();
                DisplayInfo di      = env.GetConfigData <DisplayInfo>();
                c.aspect            = (float)di.width / (float)di.height;
            });

            // add camera matrices if needed
            EntityCommandBuffer ecb = new EntityCommandBuffer(Allocator.Temp);

            Entities.WithNone <CameraMatrices>().WithAll <Camera>().ForEach((Entity e) =>
            {
                ecb.AddComponent <CameraMatrices>(e);
            });
            ecb.Playback(EntityManager);
            ecb.Dispose();

            // update
            Entities.ForEach((ref Camera c, ref LocalToWorld tx, ref CameraMatrices cm, ref Frustum f) =>
            { // with frustum
                cm.projection = ProjectionMatrixFromCamera(ref c);
                cm.view       = math.inverse(tx.Value);
                FrustumFromCamera(ref cm, ref f);
            });
            Entities.WithNone <Frustum>().ForEach((ref Camera c, ref LocalToWorld tx, ref CameraMatrices cm) =>
            { // no frustum
                cm.projection = ProjectionMatrixFromCamera(ref c);
                cm.view       = math.inverse(tx.Value);
            });
        }
Exemplo n.º 21
0
    private void UpdateDisplayInfo(BaseEventData base_ev_data, ref DisplayInfo display_info, IList <MinionIdentity> minions)
    {
        PointerEventData pointerEventData = base_ev_data as PointerEventData;

        if (pointerEventData != null)
        {
            switch (pointerEventData.button)
            {
            case PointerEventData.InputButton.Left:
                if (Components.LiveMinionIdentities.Count < display_info.selectedIndex)
                {
                    display_info.selectedIndex = -1;
                }
                if (Components.LiveMinionIdentities.Count > 0)
                {
                    display_info.selectedIndex = (display_info.selectedIndex + 1) % Components.LiveMinionIdentities.Count;
                    MinionIdentity minionIdentity = minions[display_info.selectedIndex];
                    SelectTool.Instance.SelectAndFocus(minionIdentity.transform.GetPosition(), minionIdentity.GetComponent <KSelectable>(), new Vector3(5f, 0f, 0f));
                }
                break;

            case PointerEventData.InputButton.Right:
                display_info.selectedIndex = -1;
                break;
            }
        }
    }
        public IApplicationDisplayService(ViServiceType serviceType)
        {
            _serviceType  = serviceType;
            _displayInfo  = new List <DisplayInfo>();
            _openDisplays = new Dictionary <ulong, DisplayState>();

            void AddDisplayInfo(string name, bool layerLimitEnabled, ulong layerLimitMax, ulong width, ulong height)
            {
                DisplayInfo displayInfo = new DisplayInfo()
                {
                    Name = new Array64 <byte>(),
                    LayerLimitEnabled = layerLimitEnabled,
                    Padding           = new Array7 <byte>(),
                    LayerLimitMax     = layerLimitMax,
                    Width             = width,
                    Height            = height
                };

                Encoding.ASCII.GetBytes(name).AsSpan().CopyTo(displayInfo.Name.ToSpan());

                _displayInfo.Add(displayInfo);
            }

            AddDisplayInfo("Default", true, 1, 1920, 1080);
            AddDisplayInfo("External", true, 1, 1920, 1080);
            AddDisplayInfo("Edid", true, 1, 0, 0);
            AddDisplayInfo("Internal", true, 1, 1920, 1080);
            AddDisplayInfo("Null", false, 0, 1920, 1080);
        }
        void init()
        {
            DisplayInfo mainDisplayInfo = DeviceDisplay.MainDisplayInfo;
            double      width           = mainDisplayInfo.Width / mainDisplayInfo.Density / 2;

            PlaylistsContainer.Children.Clear();

            if (playlists != null && playlists.Count != 0)
            {
                foreach (Playlist playlist in playlists)
                {
                    Image image = new Image()
                    {
                        Source = "track_ico.png", WidthRequest = width * 0.9
                    };
                    Label label = new Label()
                    {
                        Text = playlist.Name, HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.Center, WidthRequest = width * 0.9
                    };

                    TapGestureRecognizer gestureRecognizer = new TapGestureRecognizer();
                    gestureRecognizer.Tapped += onPlaylistClicked;

                    StackLayout stack = new StackLayout();
                    stack.Children.Add(image);
                    stack.Children.Add(label);
                    stack.VerticalOptions = LayoutOptions.Start;
                    stack.GestureRecognizers.Add(gestureRecognizer);
                    stack.Margin = width * 0.05;

                    playlistsDictionary.Add(stack, playlist);
                    PlaylistsContainer.Children.Add(stack);
                }
            }
        }
Exemplo n.º 24
0
        /// <summary>
        /// Returns the number of Displays using the Win32 functions
        /// </summary>
        /// <returns>collection of Display Info</returns>
        public DisplayInfoCollection GetDisplays()
        {
            DisplayInfoCollection col = new DisplayInfoCollection();

            EnumDisplayMonitors(IntPtr.Zero, IntPtr.Zero,
                                delegate(IntPtr hMonitor, IntPtr hdcMonitor, ref RectStruct lprcMonitor, IntPtr dwData)
            {
                MonitorInfoEx mi = new MonitorInfoEx();
                mi.Size          = Marshal.SizeOf(mi);
                bool success     = GetMonitorInfo(hMonitor, ref mi);
                if (success)
                {
                    DisplayInfo di  = new DisplayInfo();
                    di.hdcMonitor   = hdcMonitor;
                    di.hMonitor     = hMonitor;
                    di.ScreenWidth  = (mi.Monitor.Right - mi.Monitor.Left);
                    di.ScreenHeight = (mi.Monitor.Bottom - mi.Monitor.Top);
                    di.MonitorArea  = mi.Monitor;
                    di.WorkArea     = mi.WorkArea;
                    di.Availability = mi.Flags.ToString();
                    di.DeviceName   = mi.DeviceName;

                    col.Add(di);
                }
                return(true);
            }, IntPtr.Zero);
            return(col);
        }
        public void GetDisplayInfoForVirtualPathWithConsistentDisplayModeBeginsSearchAtCurrentDisplayMode()
        {
            // Arrange
            Mock<HttpContextBase> httpContext = new Mock<HttpContextBase>(MockBehavior.Strict);

            var displayModeProvider = new DisplayModeProvider();
            displayModeProvider.Modes.Clear();
            var displayMode1 = new Mock<IDisplayMode>(MockBehavior.Strict);
            displayMode1.Setup(d => d.CanHandleContext(It.IsAny<HttpContextBase>())).Returns(true);
            displayModeProvider.Modes.Add(displayMode1.Object);

            var displayMode2 = new Mock<IDisplayMode>(MockBehavior.Strict);
            displayMode2.Setup(d => d.CanHandleContext(It.IsAny<HttpContextBase>())).Returns(false);
            displayModeProvider.Modes.Add(displayMode2.Object);

            var displayMode3 = new Mock<IDisplayMode>(MockBehavior.Strict);
            displayMode3.Setup(d => d.CanHandleContext(It.IsAny<HttpContextBase>())).Returns(true);
            displayModeProvider.Modes.Add(displayMode3.Object);

            var displayInfo = new DisplayInfo("Foo", displayMode3.Object);
            Func<string, bool> fileExists = path => true;
            displayMode3.Setup(d => d.GetDisplayInfo(httpContext.Object, "path", fileExists)).Returns(displayInfo);

            // Act
            DisplayInfo result = displayModeProvider.GetDisplayInfoForVirtualPath("path", httpContext.Object, fileExists, currentDisplayMode: displayMode2.Object,
                requireConsistentDisplayMode: true);

            // Assert
            Assert.Same(displayInfo, result);
        }
        public void GetDisplayInfoForVirtualPathWithoutConsistentDisplayModeIgnoresCurrentDisplayMode()
        {
            // Arrange
            Mock <HttpContextBase> httpContext = new Mock <HttpContextBase>(MockBehavior.Strict);
            var displayModeProvider            = new DisplayModeProvider();

            displayModeProvider.Modes.Clear();
            var displayMode1 = new Mock <IDisplayMode>(MockBehavior.Strict);

            displayMode1.Setup(d => d.CanHandleContext(It.IsAny <HttpContextBase>())).Returns(true);
            displayModeProvider.Modes.Add(displayMode1.Object);

            var displayMode2 = new Mock <IDisplayMode>(MockBehavior.Strict);

            displayMode2.Setup(d => d.CanHandleContext(It.IsAny <HttpContextBase>())).Returns(false);
            displayModeProvider.Modes.Add(displayMode2.Object);

            var displayMode3 = new Mock <IDisplayMode>(MockBehavior.Strict);

            displayMode3.Setup(d => d.CanHandleContext(It.IsAny <HttpContextBase>())).Returns(true);
            displayModeProvider.Modes.Add(displayMode3.Object);

            var displayInfo = new DisplayInfo("Foo", displayMode3.Object);
            Func <string, bool> fileExists = path => true;

            displayMode1.Setup(d => d.GetDisplayInfo(httpContext.Object, "path", fileExists)).Returns(displayInfo);

            // Act
            DisplayInfo result = displayModeProvider.GetDisplayInfoForVirtualPath("path", httpContext.Object, fileExists, currentDisplayMode: displayMode1.Object,
                                                                                  requireConsistentDisplayMode: false);

            // Assert
            Assert.Same(displayInfo, result);
        }
        public void GetDisplayInfoForVirtualPathReturnsDisplayInfoFromFirstDisplayModeToHandleRequest()
        {
            // Arrange
            var displayModeProvider = new DisplayModeProvider();
            displayModeProvider.Modes.Clear();
            var displayMode1 = new Mock<IDisplayMode>(MockBehavior.Strict);
            displayMode1.Setup(d => d.CanHandleContext(It.IsAny<HttpContextBase>())).Returns(false);
            displayModeProvider.Modes.Add(displayMode1.Object);

            var displayMode2 = new Mock<IDisplayMode>(MockBehavior.Strict);
            displayMode2.Setup(d => d.CanHandleContext(It.IsAny<HttpContextBase>())).Returns(false);
            displayModeProvider.Modes.Add(displayMode2.Object);

            var displayMode3 = new Mock<IDisplayMode>(MockBehavior.Strict);
            displayMode3.Setup(d => d.CanHandleContext(It.IsAny<HttpContextBase>())).Returns(true);
            displayModeProvider.Modes.Add(displayMode3.Object);

            Mock<HttpContextBase> httpContext = new Mock<HttpContextBase>(MockBehavior.Strict);

            var expected = new DisplayInfo("Foo", displayMode3.Object);
            Func<string, bool> fileExists = path => true;
            displayMode3.Setup(d => d.GetDisplayInfo(httpContext.Object, "path", fileExists)).Returns(expected);

            // Act
            DisplayInfo result = displayModeProvider.GetDisplayInfoForVirtualPath("path", httpContext.Object, fileExists, currentDisplayMode: null);

            // Assert
            Assert.Same(expected, result);
        }
        public void GetDisplayModesForRequestReturnsNullIfNoDisplayModesHandleRequest()
        {
            // Arrange
            Mock <HttpContextBase> httpContext = new Mock <HttpContextBase>(MockBehavior.Strict);
            var displayModeProvider            = new DisplayModeProvider();

            displayModeProvider.Modes.Clear();
            var displayMode1 = new Mock <IDisplayMode>(MockBehavior.Strict);

            displayMode1.Setup(d => d.CanHandleContext(It.IsAny <HttpContextBase>())).Returns(false);
            displayModeProvider.Modes.Add(displayMode1.Object);

            var displayMode2 = new Mock <IDisplayMode>(MockBehavior.Strict);

            displayMode2.Setup(d => d.CanHandleContext(It.IsAny <HttpContextBase>())).Returns(false);
            displayModeProvider.Modes.Add(displayMode2.Object);

            var displayMode3 = new Mock <IDisplayMode>(MockBehavior.Strict);

            displayMode3.Setup(d => d.CanHandleContext(It.IsAny <HttpContextBase>())).Returns(false);
            displayModeProvider.Modes.Add(displayMode3.Object);

            // Act
            DisplayInfo displayModeForRequest = displayModeProvider.GetDisplayInfoForVirtualPath("path", httpContext.Object, path => false, currentDisplayMode: null);

            // Assert
            Assert.Null(displayModeForRequest);
        }
        public void GetDisplayInfoForVirtualPathReturnsDisplayInfoFromFirstDisplayModeToHandleRequest()
        {
            // Arrange
            var displayModeProvider = new DisplayModeProvider();

            displayModeProvider.Modes.Clear();
            var displayMode1 = new Mock <IDisplayMode>(MockBehavior.Strict);

            displayMode1.Setup(d => d.CanHandleContext(It.IsAny <HttpContextBase>())).Returns(false);
            displayModeProvider.Modes.Add(displayMode1.Object);

            var displayMode2 = new Mock <IDisplayMode>(MockBehavior.Strict);

            displayMode2.Setup(d => d.CanHandleContext(It.IsAny <HttpContextBase>())).Returns(false);
            displayModeProvider.Modes.Add(displayMode2.Object);

            var displayMode3 = new Mock <IDisplayMode>(MockBehavior.Strict);

            displayMode3.Setup(d => d.CanHandleContext(It.IsAny <HttpContextBase>())).Returns(true);
            displayModeProvider.Modes.Add(displayMode3.Object);

            Mock <HttpContextBase> httpContext = new Mock <HttpContextBase>(MockBehavior.Strict);

            var expected = new DisplayInfo("Foo", displayMode3.Object);
            Func <string, bool> fileExists = path => true;

            displayMode3.Setup(d => d.GetDisplayInfo(httpContext.Object, "path", fileExists)).Returns(expected);

            // Act
            DisplayInfo result = displayModeProvider.GetDisplayInfoForVirtualPath("path", httpContext.Object, fileExists, currentDisplayMode: null);

            // Assert
            Assert.Same(expected, result);
        }
Exemplo n.º 30
0
        /// <summary>
        /// Returns the number of Displays using the Win32 functions.
        /// </summary>
        /// <returns>A collection of DisplayInfo with information about each monitor.</returns>
        public static List <DisplayInfo> QueryDisplays()
        {
            var Monitors = new List <DisplayInfo>();

            // Get the all Display Monitors.
            EnumDisplayMonitors(IntPtr.Zero, IntPtr.Zero,
                                delegate(IntPtr hMonitor, IntPtr hdcMonitor, ref Rect lprcMonitor, IntPtr dwData)
            {
                MonitorInfo monitor = new MonitorInfo();
                monitor.Size        = (uint)Marshal.SizeOf(monitor);
                monitor.DeviceName  = null;
                bool Success        = GetMonitorInfo(hMonitor, ref monitor);
                if (Success)
                {
                    DisplayInfo displayinfo  = new DisplayInfo();
                    displayinfo.ScreenWidth  = monitor.Monitor.Right - monitor.Monitor.Left;
                    displayinfo.ScreenHeight = monitor.Monitor.Bottom - monitor.Monitor.Top;
                    displayinfo.MonitorArea  = new Rect(monitor.Monitor.Left, monitor.Monitor.Top, displayinfo.ScreenWidth, displayinfo.ScreenHeight);
                    displayinfo.MonitorTop   = monitor.Monitor.Top;
                    displayinfo.MonitorLeft  = monitor.Monitor.Left;
                    displayinfo.Availability = monitor.Flags.ToString();
                    displayinfo.DeviceName   = monitor.DeviceName;
                    displayinfo.FriendlyName = QueryDisplaysFriendlyName(monitor.DeviceName);
                    displayinfo.VendorsName  = QueryDisplaysVendorName(monitor.DeviceName);
                    Monitors.Add(displayinfo);
                }
                return(true);
            }, IntPtr.Zero);
            return(Monitors);
        }
Exemplo n.º 31
0
 public DebugWindowControl(Game game, DisplayInfo displayInfo, GeneralDebugComponent fps, ByteColor LeftPanelColor)
 {
     _fps         = fps;
     _displayInfo = displayInfo;
     _game        = game;
     BuildWindow(ref LeftPanelColor);
 }
Exemplo n.º 32
0
        private static List <DisplayInfo> GetDisplays()
        {
            List <DisplayInfo>  displayCollection = new List <DisplayInfo>();
            MonitorEnumDelegate monitorDelegate   = delegate(IntPtr hMonitor, IntPtr hdcMonitor, ref Rect lprcMonitor, IntPtr dwData)
            {
                MonitorInfoEx monitorInfo = new MonitorInfoEx();
                monitorInfo.size = (uint)Marshal.SizeOf(monitorInfo);
                if (GetMonitorInfo(hMonitor, ref monitorInfo))
                {
                    var info = new DevMode();
                    EnumDisplaySettings(monitorInfo.deviceName, -1, ref info);

                    var monitor = new Rect
                    {
                        left   = info.dmPositionX,
                        right  = info.dmPositionX + info.dmPelsWidth,
                        top    = info.dmPositionY,
                        bottom = info.dmPositionY + info.dmPelsHeight
                    };

                    DisplayInfo displayInfo = new DisplayInfo(monitor, monitorInfo.flags);
                    displayCollection.Add(displayInfo);
                }
                return(true);
            };

            EnumDisplayMonitors(IntPtr.Zero, IntPtr.Zero, monitorDelegate, IntPtr.Zero);
            return(displayCollection);
        }
Exemplo n.º 33
0
        public async void ShowInfo()
        {
            try
            {
                ControlInfoContainer.Children.Clear();
                lblAreTherePatronsToShow.Visibility = System.Windows.Visibility.Hidden;

                var listPatrons = await _services.GetPatrons();

                if (listPatrons != null)
                {
                    foreach (var patron in listPatrons)
                    {
                        ControlInfoContainer.Children.Add(DisplayInfo.GetInfoContainer(patron.Name, patron.Id, patron.Picture));
                    }
                }
                else
                {
                    lblAreTherePatronsToShow.Visibility = System.Windows.Visibility.Visible;
                }
            }
            catch (System.Exception ex)
            {
                new MessageControl("Error", ex.Message, MessageType.Error);
            }
        }
Exemplo n.º 34
0
 public DisplaySettingsDialog(DisplayInfo displayInfo)
 {
     InitializeComponent();
     if (Properties.Settings.Default.disableGlowBrush)
     {
         this.GlowBrush = null;
     }
     Result = getCurrentDisplayInfo(displayInfo);
     DeviceListView.ItemsSource = Result.devices;
 }
        public void ConstructorSetsDisplayInfoProperties()
        {
            // Arrange
            string path = "testPath";
            IDisplayMode displayMode = new Mock<IDisplayMode>().Object;

            // Act
            DisplayInfo info = new DisplayInfo(path, displayMode);

            // Assert
            Assert.Equal(path, info.FilePath);
            Assert.Equal(displayMode, info.DisplayMode);
        }
Exemplo n.º 36
0
 private DisplayInfo getCurrentDisplayInfo(DisplayInfo displayInfo)
 {
     DisplayInfo res = DisplaySettings.GetDisplayDevices();
     foreach (var device in res.devices)
     {
         var device2 = displayInfo.devices.FirstOrDefault(_device => _device.DeviceID == device.DeviceID && _device.Enabled == true);
         if (device2 != null)
         {
             device.Enabled = true;
             device.Scaling = device2.Scaling;
         }
     }
     return res;
 }
Exemplo n.º 37
0
            public static DisplayInfo Parse(string data)
            {
                try
                {
                    XmlDocument xml = new XmlDocument();
                    xml.LoadXml(data);

                    XmlElement root = xml.DocumentElement;
                    XmlElement nameNode = root["name"];
                    XmlElement authorNode = root["author"];
                    XmlElement versionNode = root["version"];
                    XmlElement descriptionNode = root["description"];
                    XmlElement packageUrlNode = root["packageurl"];

                    string name = nameNode.InnerText.Trim();
                    string author = authorNode.InnerText.Trim();
                    string version = versionNode.InnerText.Trim();
                    string description = descriptionNode.InnerText.Trim();
                    string packageUrl = packageUrlNode.InnerText.Trim();

                    DisplayInfo info = new DisplayInfo(name, author, version, description, packageUrl);
                    return info;
                }
                catch
                {
                    return null;
                }
            }
Exemplo n.º 38
0
    public static void ComputeColorComposition(Camera camera, Material colorCompositeMaterial, RenderTexture dst, RenderTexture instanceIdBuffer, RenderTexture atomIdBuffer, RenderTexture depthBuffer)
    {
        var temp1 = new DisplayInfo[CPUBuffers.Get.IngredientsDisplayInfo.Count];
        var temp2 = new DisplayInfo[CPUBuffers.Get.IngredientGroupsDisplayInfo.Count];

        GPUBuffers.Get.IngredientsColorInfo.GetData(temp1);
        GPUBuffers.Get.IngredientGroupsColorInfo.GetData(temp2);

        CPUBuffers.Get.IngredientsDisplayInfo = temp1.ToList();
        CPUBuffers.Get.IngredientGroupsDisplayInfo = temp2.ToList();

        //Debug.Log(temp2[5].ToString());

        /**************/

        //colorCompositeMaterial.SetFloat("_depth", ColorManager.Get.depthSlider);
        colorCompositeMaterial.SetFloat("_UseHCL", Convert.ToInt32(ColorManager.Get.UseHCL));
        colorCompositeMaterial.SetFloat("_ShowAtoms", Convert.ToInt32(ColorManager.Get.ShowAtoms));
        colorCompositeMaterial.SetFloat("_ShowChains", Convert.ToInt32(ColorManager.Get.ShowChains));
        colorCompositeMaterial.SetFloat("_ShowResidues", Convert.ToInt32(ColorManager.Get.ShowResidues));
        colorCompositeMaterial.SetFloat("_ShowSecondaryStructures", Convert.ToInt32(ColorManager.Get.ShowSecondaryStructures));
        
        colorCompositeMaterial.SetFloat("_AtomDistance", ColorManager.Get.AtomDistance);
        colorCompositeMaterial.SetFloat("_ChainDistance", ColorManager.Get.ChainDistance);
        colorCompositeMaterial.SetFloat("_ResidueDistance", ColorManager.Get.ResidueDistance);
        colorCompositeMaterial.SetFloat("_SecondaryStructureDistance", ColorManager.Get.SecondaryStructureDistance);

        // LOD infos

        var rangeValues = Matrix4x4.zero;
        
        int distAcc = 0;
        for (int i = 0; i < ColorManager.Get.LevelRanges.Length; i++)
        {
            distAcc += (int)(ColorManager.Get.LevelRanges[i] * ColorManager.Get.DistanceMax);
            rangeValues[i] = distAcc;
        }
        rangeValues[ColorManager.Get.LevelRanges.Length] = ColorManager.Get.DistanceMax;

        var selectionSphere = (Vector4)SelectionManager.Instance.SelectionGameObject.transform.position;
        selectionSphere.w = SelectionManager.Instance.SelectionGameObject.GetComponent<SphereCollider>().radius;

        colorCompositeMaterial.SetVector("_FocusSphere", selectionSphere);
        colorCompositeMaterial.SetMatrix("_ProjectionMatrix", camera.projectionMatrix);
        colorCompositeMaterial.SetMatrix("_InverseViewMatrix", camera.cameraToWorldMatrix);

        colorCompositeMaterial.SetInt("_UseDistanceLevels", Convert.ToInt32(ColorManager.Get.UseDistanceLevels));
        
        colorCompositeMaterial.SetInt("_NumLevelMax", ColorManager.Get.NumLevelMax);
        colorCompositeMaterial.SetInt("_DistanceMax", ColorManager.Get.DistanceMax);
        colorCompositeMaterial.SetMatrix("_LevelRanges", rangeValues);

        //*****//
        colorCompositeMaterial.SetFloat("_LevelLerpFactor", ColorManager.Get.LevelLerpFactor);
        colorCompositeMaterial.SetInt("_NumPixels", instanceIdBuffer.width * instanceIdBuffer.height);

        //*****//
        colorCompositeMaterial.SetTexture("_DepthBuffer", depthBuffer);
        colorCompositeMaterial.SetTexture("_AtomIdBuffer", atomIdBuffer);
        colorCompositeMaterial.SetTexture("_InstanceIdBuffer", instanceIdBuffer);

        // Properties
        colorCompositeMaterial.SetBuffer("_ProteinAtomInfos", GPUBuffers.Get.ProteinAtomInfo);
        colorCompositeMaterial.SetBuffer("_ProteinAtomInfos2", GPUBuffers.Get.ProteinAtomInfo2);
        colorCompositeMaterial.SetBuffer("_ProteinInstanceInfo", GPUBuffers.Get.ProteinInstancesInfo);
        colorCompositeMaterial.SetBuffer("_LipidAtomInfos", GPUBuffers.Get.LipidAtomPositions);
        colorCompositeMaterial.SetBuffer("_LipidInstancesInfo", GPUBuffers.Get.LipidInstancesInfo);

        colorCompositeMaterial.SetBuffer("_IngredientsInfo", GPUBuffers.Get.IngredientsInfo);
        colorCompositeMaterial.SetBuffer("_IngredientGroupsColorInfo", GPUBuffers.Get.IngredientGroupsColorInfo);
        colorCompositeMaterial.SetBuffer("_ProteinIngredientsColorInfo", GPUBuffers.Get.IngredientsColorInfo);

        // Predifined colors 
        colorCompositeMaterial.SetBuffer("_AtomColors", GPUBuffers.Get.AtomColors);
        colorCompositeMaterial.SetBuffer("_AminoAcidColors", GPUBuffers.Get.AminoAcidColors);
        colorCompositeMaterial.SetBuffer("_IngredientsColors", GPUBuffers.Get.IngredientsColors);
        colorCompositeMaterial.SetBuffer("_IngredientsChainColors", GPUBuffers.Get.IngredientsChainColors);
        colorCompositeMaterial.SetBuffer("_IngredientGroupsColor", GPUBuffers.Get.IngredientGroupsColor);

        // Values for color generation on the fly 
        colorCompositeMaterial.SetBuffer("_IngredientGroupsLerpFactors", GPUBuffers.Get.IngredientGroupsLerpFactors);
        colorCompositeMaterial.SetBuffer("_IngredientGroupsColorValues", GPUBuffers.Get.IngredientGroupsColorValues);
        colorCompositeMaterial.SetBuffer("_IngredientGroupsColorRanges", GPUBuffers.Get.IngredientGroupsColorRanges);
        colorCompositeMaterial.SetBuffer("_ProteinIngredientsRandomValues", GPUBuffers.Get.ProteinIngredientsRandomValues);

        Graphics.Blit(null, dst, colorCompositeMaterial, 0);
    }