Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Vision.Windows.WindowsCore.Init();

            OpenFileDialog ofd = new OpenFileDialog()
            {
                InitialDirectory = Environment.CurrentDirectory
            };

            if (DialogResult.OK == ofd.ShowDialog())
            {
                var file = new Vision.FileNode(ofd.FileName, true);
                EyeGazeCalibrationLog log = new EyeGazeCalibrationLog(file);
                log.Load();

                LinearEyeGazeCalibratorEngine e = new LinearEyeGazeCalibratorEngine();
                e.SetData(log.Data);
                e.Train();

                var plot = log.Plot(ScreenProperties.CreatePixelScreen(1920, 1080, 96), new EyeGazeCalibrater()
                {
                    Engine = e
                });
                Core.Cv.ImgShow("plt", plot, 0, true);
            }
        }
Ejemplo n.º 2
0
        protected virtual void NativeArrangeContent(System.Drawing.RectangleF rectangleF)
        {
            if (this.contentTemplateInstance != null)
            {
                this.contentTemplateInstance.Arrange(rectangleF);
                return;
            }
            RectangleF rectangleContent = rectangleF;

            if (this.Content is UIElement)
            {
                ((UIElement)this.Content).Arrange(rectangleContent);

                if (this.ContentNativeUIElement != null)
                {
                    this.ContentNativeUIElement.Layout((int)ScreenProperties.ConvertDPIToPixels(rectangleContent.Left),
                                                       (int)ScreenProperties.ConvertDPIToPixels(rectangleContent.Top),
                                                       (int)ScreenProperties.ConvertDPIToPixels(rectangleContent.Right),
                                                       (int)ScreenProperties.ConvertDPIToPixels(rectangleContent.Bottom));
                }
            }
            else
            {
                if (this.ContentNativeUIElement != null)
                {
                    this.ContentNativeUIElement.Layout((int)ScreenProperties.ConvertDPIToPixels(rectangleContent.Left),
                                                       (int)ScreenProperties.ConvertDPIToPixels(rectangleContent.Top),
                                                       (int)ScreenProperties.ConvertDPIToPixels(rectangleContent.Right),
                                                       (int)ScreenProperties.ConvertDPIToPixels(rectangleContent.Bottom));
                }
            }
        }
Ejemplo n.º 3
0
        protected virtual Thickness GetNativePadding()
        {
            if (this.NativeUIElement.Background == null)
            {
                return(new Thickness(0));
            }

            Android.Graphics.Rect rect = new Android.Graphics.Rect();
            this.NativeUIElement.Background.GetPadding(rect);

            Thickness absoluteNativePadding = new Thickness();

            absoluteNativePadding.Left   = rect.Left + (this.NativeUIElement.Background.MinimumWidth - rect.Left - rect.Right) / 2.0;
            absoluteNativePadding.Top    = rect.Top + (this.NativeUIElement.Background.MinimumHeight - rect.Top - rect.Bottom) / 2.0;
            absoluteNativePadding.Right  = rect.Right + (this.NativeUIElement.Background.MinimumWidth - rect.Left - rect.Right) / 2.0;
            absoluteNativePadding.Bottom = rect.Bottom + (this.NativeUIElement.Background.MinimumHeight - rect.Top - rect.Bottom) / 2.0;

            Thickness dpiNativePadding = new Thickness();

            dpiNativePadding.Left   = ScreenProperties.ConvertPixelsToDPI((float)absoluteNativePadding.Left);
            dpiNativePadding.Top    = ScreenProperties.ConvertPixelsToDPI((float)absoluteNativePadding.Top);
            dpiNativePadding.Right  = ScreenProperties.ConvertPixelsToDPI((float)absoluteNativePadding.Right);
            dpiNativePadding.Bottom = ScreenProperties.ConvertPixelsToDPI((float)absoluteNativePadding.Bottom);

            return(dpiNativePadding);
        }
Ejemplo n.º 4
0
        protected virtual System.Drawing.SizeF NativeMeasureContent(System.Drawing.SizeF sizeF)
        {
            if (this.contentTemplateInstance != null)
            {
                return(this.contentTemplateInstance.MeasureOverride(sizeF));
            }
            if (this.Content is UIElement)
            {
                System.Drawing.SizeF measuredSize = ((UIElement)this.Content).MeasureOverride(sizeF);
                return(measuredSize);
            }
            else
            {
                if (this.ContentNativeUIElement == null)
                {
                    return(new SizeF());
                }

                SizeF absoluteSizeF = new SizeF();
                absoluteSizeF.Width  = ScreenProperties.ConvertDPIToPixels(sizeF.Width);
                absoluteSizeF.Height = ScreenProperties.ConvertDPIToPixels(sizeF.Height);

                int widthMeasureSpec  = Android.Views.View.MeasureSpec.MakeMeasureSpec((int)absoluteSizeF.Width, MeasureSpecMode.AtMost);
                int heightMeasureSpec = Android.Views.View.MeasureSpec.MakeMeasureSpec((int)absoluteSizeF.Height, MeasureSpecMode.AtMost);
                this.ContentNativeUIElement.Measure(widthMeasureSpec, heightMeasureSpec);

                SizeF dpiMeasuredContentSize = new SizeF();
                dpiMeasuredContentSize.Width  = ScreenProperties.ConvertPixelsToDPI(this.ContentNativeUIElement.MeasuredWidth);
                dpiMeasuredContentSize.Height = ScreenProperties.ConvertPixelsToDPI(this.ContentNativeUIElement.MeasuredHeight);

                return(dpiMeasuredContentSize);
            }
        }
Ejemplo n.º 5
0
        private void FormPrincipal_Load(object sender, EventArgs e)
        {
            this.Text += " " + Application.ProductVersion;

            //abre a conexão com o banco de dados
            try
            {
                aConnection.Open();
            }
            catch (OleDbException)
            {
                MessageBox.Show("Um arquivo de Dados não se encontra em seu computador e necessitamos dele para que possamos executar a Coletânea de Louvor.", "Falha na execução do programa!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Download download = new Download();
                download.abrir(@"Dados.zip");
                ArquivoZip.ExtrairArquivoZip("Dados.zip", AppDomain.CurrentDomain.BaseDirectory.ToString());//chamando classe para extrair o Dados.mdb e deletar o arquivo zip
            }
            catch (Exception)
            {
                MessageBox.Show("Um erro ocorreu ao executar a Coletânea de Louvor.\nPara corrigir, precisamos realizar novamente o download do arquivo de Dados.", "Falha na execução do programa!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Download download = new Download();
                download.abrir(@"Dados.zip");
                ArquivoZip.ExtrairArquivoZip("Dados.zip", AppDomain.CurrentDomain.BaseDirectory.ToString());//chamando classe para extrair o Dados.mdb e deletar o arquivo zip
            }

            try
            {
                if (File.Exists("Dados.zip"))
                {
                    File.Delete("Dados.zip");
                    aConnection.Open();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            foreach (var post in ScreenProperties.getAllScreens())
            {
                cboTela.Items.Add(post.DeviceName.Replace(@"\\.\DISPLAY", "Tela "));
            }

            //SELECIONAR A TELA SECUNDÁRIA COMO PADRÃO NO COMBO
            if (cboTela.Items.Count != 1)
            {
                cboTela.SelectedIndex = ScreenProperties.getScreenSecondary() - 1;
            }
            else //SE NÃO TIVER, SERÁ SELECIONADA A TELA PRINCIPAL
            {
                cboTela.SelectedIndex = 0;
            }

            btnJa_Click(sender, e);

            timer.Tick += T_Tick;

            txtBusca.Focus();
            txtBusca.SelectAll();
        }
Ejemplo n.º 6
0
        public GazeEventArgs(Point pt, ScreenProperties screen, bool isFace, bool isGaze)
        {
            Position         = pt;
            ScreenProperties = screen;

            IsFaceDetected = isFace;
            IsGazeDetected = isGaze;
        }
Ejemplo n.º 7
0
 internal D3D11RenderBackend(Func <IFrameData> OnUpdate, Action OnQuit, Action OnRunned, Action <char> OnCharPressed)
 {
     EngineOnRunned      = OnRunned;
     EngineUpdateAction  = OnUpdate;
     EngineQuitAction    = OnQuit;
     EngineOnCharPressed = OnCharPressed;
     ScreenProps         = new ScreenProperties();
 }
        protected override SizeF NativeMeasureOverride(SizeF availableSize)
        {
            SizeF measuredSize = base.NativeMeasureOverride(availableSize);

            measuredSize.Width += ScreenProperties.ConvertPixelsToDPI(this.androidRadioButtonBackground.IntrinsicWidth);
            measuredSize.Height = Math.Max(measuredSize.Height, ScreenProperties.ConvertPixelsToDPI(this.androidRadioButtonBackground.IntrinsicHeight));

            return(new SizeF(measuredSize.Width, measuredSize.Height));
        }
Ejemplo n.º 9
0
        //AO INICIAR O PROGRAMA
        private void FormPrincipal_Load(object sender, EventArgs e)
        {
            //abre a conexão com o banco de dados
            try
            {
                aConnection.Open();
            }
            catch (OleDbException)
            {
                MessageBox.Show("Um arquivo de Dados não se encontra em seu computador e necessitamos dele para que possamos executar a Coletânea de Louvor.", "Falha na execução do programa!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Download download = new Download();
                download.abrir(@"Dados.zip");
                ArquivoZip.ExtrairArquivoZip("Dados.zip", AppDomain.CurrentDomain.BaseDirectory.ToString());//chamando classe para extrair o Dados.mdb e deletar o arquivo zip
            }
            catch (Exception)
            {
                MessageBox.Show("Um erro ocorreu ao executar a Coletânea de Louvor.\nPara corrigir, precisamos realizar novamente o download do arquivo de Dados.", "Falha na execução do programa!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Download download = new Download();
                download.abrir(@"Dados.zip");
                ArquivoZip.ExtrairArquivoZip("Dados.zip", AppDomain.CurrentDomain.BaseDirectory.ToString());//chamando classe para extrair o Dados.mdb e deletar o arquivo zip
            }

            try
            {
                if (File.Exists("Dados.zip"))
                {
                    File.Delete("Dados.zip");
                    aConnection.Open();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            //efeito ao iniciar o formprincipal
            Opacity     = 0;                        //first the opacity is 0
            t1.Interval = 10;                       //we'll increase the opacity every 10ms
            t1.Tick    += new EventHandler(fadeIn); //this calls the function that changes opacity
            t1.Start();

            //LISTA TODAS AS TELAS DO COMPUTADOR
            foreach (var post in ScreenProperties.getAllScreens())
            {
                comboScreen.Items.Add(post.DeviceName);
            }

            //SELECIONAR A TELA SECUNDÁRIA COMO PADRÃO NO COMBO
            if (comboScreen.Items.Count != 1)
            {
                comboScreen.SelectedIndex = ScreenProperties.getScreenSecondary() - 1;
            }
            else //SE NÃO TIVER, SERÁ SELECIONADA A TELA PRINCIPAL
            {
                comboScreen.SelectedIndex = 0;
            }
        }
        private void NativeArrangeVideoView(System.Drawing.RectangleF finalRect)
        {
            int left   = (int)ScreenProperties.ConvertDPIToPixels(finalRect.Left);
            int top    = (int)ScreenProperties.ConvertDPIToPixels(finalRect.Top);
            int right  = (int)ScreenProperties.ConvertDPIToPixels(finalRect.Right);
            int bottom = (int)ScreenProperties.ConvertDPIToPixels(finalRect.Bottom);

            this.videoView.Layout(left, top, right, bottom);
        }
Ejemplo n.º 11
0
        private void EscolaSabatina_Click(object sender, EventArgs e)
        {
            //Comando para selecionar o monitor da tela estendida
            string selecionaTela = Convert.ToString(cboTela.SelectedItem);
            int    numTela       = ScreenProperties.getIndexFromName(selecionaTela);

            FormEscolaSabatina abrir = new FormEscolaSabatina(numTela - 1); //variável 'numTela' diminui um valor para que se inicie em '0'

            abrir.Show();
        }
Ejemplo n.º 12
0
        public static int GetDialogWidth()
        {
            var isLandscape = (ScreenProperties.InterfaceOrientation == InterfaceOrientation.LandScapeRight ||
                               ScreenProperties.InterfaceOrientation == InterfaceOrientation.LandscapeLeft);
            var widthRatioResName = isLandscape ? "dialog_min_width_major" : "dialog_min_width_minor";
            var widthRatioId      = Application.Context.Resources.GetIdentifier(widthRatioResName, "dimen", "android");
            var widthRatio        = float.Parse(Android.Content.Res.Resources.System.GetString(widthRatioId).Trim(new[] { '%' }), CultureInfo.InvariantCulture);

            return((int)(ScreenProperties.DisplaySize.Width * widthRatio / 100 - ScreenProperties.ConvertDPIToPixels(32)));
        }
Ejemplo n.º 13
0
        private void btnProvaieVede_Click(object sender, EventArgs e)
        {
            //Comando para selecionar o monitor da tela estendida
            string selecionaTela = Convert.ToString(cboTela.SelectedItem);
            int    numTela       = ScreenProperties.getIndexFromName(selecionaTela);

            FormProvaieVede abrir = new FormProvaieVede();

            abrir.Show();
        }
        protected override SizeF NativeMeasureContent(System.Drawing.SizeF availableSize)
        {
            var   checkBoxHeightPx = ScreenProperties.ConvertPixelsToDPI(this.androidRadioButtonBackground.IntrinsicHeight);
            SizeF measuredContent  = base.NativeMeasureContent(availableSize);
            var   width            = Math.Min(measuredContent.Width, availableSize.Width);

            this.originalContentSize = Math.Min(measuredContent.Height, availableSize.Height);
            var height = Math.Max(this.originalContentSize, checkBoxHeightPx);

            return(new SizeF(width, height));
        }
        private void innerDefaultControl_ScrollChanged(object sender, NativeScrollChangedEventArgs e)
        {
            ScrollChangedEventArgs args = new ScrollChangedEventArgs()
            {
                HorizontalOffset = ScreenProperties.ConvertPixelsToDPI(e.l),
                HorizontalChange = ScreenProperties.ConvertPixelsToDPI(e.l - e.oldl),
                VerticalOffset   = ScreenProperties.ConvertPixelsToDPI(e.t),
                VerticalChange   = ScreenProperties.ConvertPixelsToDPI(e.t - e.oldt),
            };

            this.OnScrollChanged(args);
        }
Ejemplo n.º 16
0
        private void BogieDashboard_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            ScreenProperties s = new ScreenProperties()
            {
                ScreenName = this.Name,
                ScreenTop  = this.Top.ToString(),
                ScreenLeft = this.Left.ToString()
            };
            WindowManager w = new WindowManager();

            w.WriteToXmlFile(s, true);
        }
Ejemplo n.º 17
0
 // --- static functions
 /// <summary>Initializes the SDL window.</summary>
 /// <param name="Options">The options to set up the window.</param>
 /// <returns>A boolean indicating the success of the operation.</returns>
 internal static bool Initialize(ScreenOptions options)
 {
     if (Sdl.SDL_InitSubSystem(Sdl.SDL_INIT_VIDEO) != 0) {
         return false;
     } else {
         Sdl.SDL_GL_SetAttribute(Sdl.SDL_GL_DOUBLEBUFFER, 1);
         Sdl.SDL_GL_SetAttribute(Sdl.SDL_GL_RED_SIZE, Program.CurrentOptions.RedSize);
         Sdl.SDL_GL_SetAttribute(Sdl.SDL_GL_GREEN_SIZE, Program.CurrentOptions.GreenSize);
         Sdl.SDL_GL_SetAttribute(Sdl.SDL_GL_BLUE_SIZE, Program.CurrentOptions.BlueSize);
         Sdl.SDL_GL_SetAttribute(Sdl.SDL_GL_ALPHA_SIZE, Program.CurrentOptions.AlphaSize);
         Sdl.SDL_GL_SetAttribute(Sdl.SDL_GL_DEPTH_SIZE, Program.CurrentOptions.DepthSize);
         Sdl.SDL_GL_SetAttribute(Sdl.SDL_GL_SWAP_CONTROL, options.VerticalSynchronization ? 1 : 0);
         Sdl.SDL_ShowCursor(Sdl.SDL_DISABLE);
         int flags = Sdl.SDL_OPENGL | Sdl.SDL_HWSURFACE | Sdl.SDL_ANYFORMAT | Sdl.SDL_DOUBLEBUF;
         if (options.Fullscreen) {
             flags |= Sdl.SDL_FULLSCREEN;
         } else {
             flags |= Sdl.SDL_RESIZABLE;
         }
         IntPtr video = Sdl.SDL_SetVideoMode(options.Width, options.Height, options.BitsPerPixel, flags);
         if (video == IntPtr.Zero) {
             Sdl.SDL_QuitSubSystem(Sdl.SDL_INIT_VIDEO);
             return false;
         } else {
             {
                 int value;
                 Sdl.SDL_GL_GetAttribute(Sdl.SDL_GL_RED_SIZE, out value);
                 Program.Log.Append("SDL_GL_RED_SIZE = ").Append(value.ToString(CultureInfo.InvariantCulture)).Append(" (").Append(Program.CurrentOptions.RedSize).AppendLine(" requested)");
                 Sdl.SDL_GL_GetAttribute(Sdl.SDL_GL_GREEN_SIZE, out value);
                 Program.Log.Append("SDL_GL_GREEN_SIZE = ").Append(value.ToString(CultureInfo.InvariantCulture)).Append(" (").Append(Program.CurrentOptions.GreenSize).AppendLine(" requested)");
                 Sdl.SDL_GL_GetAttribute(Sdl.SDL_GL_BLUE_SIZE, out value);
                 Program.Log.Append("SDL_GL_BLUE_SIZE = ").Append(value.ToString(CultureInfo.InvariantCulture)).Append(" (").Append(Program.CurrentOptions.BlueSize).AppendLine(" requested)");
                 Sdl.SDL_GL_GetAttribute(Sdl.SDL_GL_ALPHA_SIZE, out value);
                 Program.Log.Append("SDL_GL_ALPHA_SIZE = ").Append(value.ToString(CultureInfo.InvariantCulture)).Append(" (").Append(Program.CurrentOptions.AlphaSize).AppendLine(" requested)");
                 Sdl.SDL_GL_GetAttribute(Sdl.SDL_GL_DEPTH_SIZE, out value);
                 Program.Log.Append("SDL_GL_DEPTH_SIZE = ").Append(value.ToString(CultureInfo.InvariantCulture)).Append(" (").Append(Program.CurrentOptions.DepthSize).AppendLine(" requested)");
                 Program.Log.AppendLine();
             }
             Sdl.SDL_WM_SetCaption("openBVE", null);
             string[] extensions = Gl.glGetString(Gl.GL_EXTENSIONS).Split(new char[] { ' ' });
             for (int i = 0; i < extensions.Length; i++) {
                 if (string.Equals(extensions[i], "GL_EXT_texture_filter_anisotropic", StringComparison.OrdinalIgnoreCase)) {
                     Gl.glGetFloatv(Gl.GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, out Program.AnisotropicMaximum);
                     break;
                 }
             }
             Properties = new ScreenProperties(options);
             Initialized = true;
             return true;
         }
     }
 }
        public void OnGlobalLayout()
        {
            var rootView = this.Window.DecorView.RootView.RootView;
            var rect     = new Rect();
            var diff     = rootView.Height - rootLayout.Height;

            if (diff > (keyboardShown == true ? 0 : ScreenProperties.ConvertDPIToPixels(100)) && diff != prevoiusDiff)
            {
                keyboardShown = keyboardShown == true ? !keyboardShown : true;
                prevoiusDiff  = diff;
                UpdateRootLayouts();
            }
        }
        private void RearrangeVisualRoot()
        {
            var marginTop = !GetIsTabsEmbedded() &&
                            this.ActionBar.NavigationMode == ActionBarNavigationMode.Tabs? GetTabsView().Height : 0;

            this.PageHeight = rootLayout.Height - rootLayout.PaddingTop - marginTop;
            this.PageWidth  = rootLayout.Width;

            var dpiPageSize = new RectangleF(
                0.0f, 0.0f, ScreenProperties.ConvertPixelsToDPI(this.PageWidth), ScreenProperties.ConvertPixelsToDPI(this.PageHeight));

            this.pagerPage.Arrange(dpiPageSize);
            AppercodeVisualRoot.Instance.Arrange(dpiPageSize);
        }
Ejemplo n.º 20
0
            public override View GetView(int position, View reusableView, ViewGroup parent)
            {
                UIElement listItem;

                if (reusableView == null)
                {
                    reusableView = new WrapedViewGroup(parent.Context);
                    listItem     = (UIElement)this.Generator.ContainerFromIndex(position);
                    LogicalTreeHelper.AddLogicalChild(this.ListPicker, listItem);
                    this.NativeViewContainers.Add(listItem.NativeUIElement, listItem);
                    ((WrapedViewGroup)reusableView).AddView(listItem.NativeUIElement);
                }
                else
                {
                    var nativeItem = ((WrapedViewGroup)reusableView).GetChildAt(0);
                    if (this.NativeViewContainers.ContainsKey(nativeItem))
                    {
                        listItem = this.NativeViewContainers[nativeItem];
                        this.Generator.Reuse(position, listItem);
                    }
                    else
                    {
                        ((WrapedViewGroup)reusableView).RemoveAllViews();
                        listItem = (UIElement)this.Generator.ContainerFromIndex(position);
                        LogicalTreeHelper.AddLogicalChild(this.ListPicker, listItem);
                        this.NativeViewContainers.Add(listItem.NativeUIElement, listItem);
                        ((WrapedViewGroup)reusableView).AddView(listItem.NativeUIElement);
                    }
                }
                var width         = GetDialogWidth() / WidthDivider;
                var availableSize = new SizeF(ScreenProperties.ConvertPixelsToDPI(width), float.PositiveInfinity);
                var measuredSize  = listItem.MeasureOverride(availableSize);

                listItem.Arrange(new RectangleF(PointF.Empty, measuredSize));
                ThreadPool.QueueUserWorkItem(o => DisableTouch((View)listItem.NativeUIElement.Parent));
                // Need to use AbsListView.LayoutParams to prevent Java.CastException
                reusableView.LayoutParameters = new AbsListView.LayoutParams((int)width, (int)ScreenProperties.ConvertDPIToPixels(listItem.measuredSize.Height));
                //if (position == this.SelectedItemPosition)
                //{
                //    listItem.NativeUIElement.SetBackgroundColor(Android.Graphics.Color.ParseColor("#33b5e5"));
                //    lastSelectedView = listItem.NativeUIElement;
                //}
                //else
                //{
                //    listItem.NativeUIElement.SetBackgroundColor(Android.Graphics.Color.Transparent);
                //}

                return(reusableView);
            }
Ejemplo n.º 21
0
        //public void DeleteData(string toDelete) //            DeleteData("Radar1");
        //{

        //    if (System.Windows.MessageBox.Show("Do you Really Want To Delete This Movie ?", "Delete Confirmation", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
        //    {
        //        XDocument doc = XDocument.Load(@"C:\0\Workspace\bin\Debug\MovieDB.xml");
        //        foreach (var item in doc.Descendants("Screen"))
        //        {
        //            if (item.Element("ScreenName").Value == toDelete)
        //            {
        //                ((XElement)item.Element("ScreenName")).Parent.Remove();
        //                doc.Save(@"C:\0\Workspace\bin\Debug\MovieDB.xml");
        //                break;
        //            }
        //        }
        //        LoadData();

        //    }
        //}

        public void WriteToXmlFile(ScreenProperties screen, bool isUpdate)
        {
            #region Add New
            if (!isUpdate)
            {
                XmlDocument xmlDoc = new XmlDocument();
                using (FileStream fs = new FileStream(fileLocation, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                {
                    xmlDoc.Load(fs);
                    fs.Close();
                }

                XmlElement newScreen  = xmlDoc.CreateElement("Screen");
                XmlElement screenName = xmlDoc.CreateElement("ScreenName");
                screenName.InnerText = screen.ScreenName;
                newScreen.AppendChild(screenName);
                XmlElement screenTop = xmlDoc.CreateElement("ScreenTop");
                screenTop.InnerText = screen.ScreenTop;
                newScreen.AppendChild(screenTop);
                XmlElement screenLeft = xmlDoc.CreateElement("ScreenLeft");
                screenLeft.InnerText = screen.ScreenLeft;
                newScreen.AppendChild(screenLeft);


                xmlDoc.DocumentElement.InsertAfter(newScreen, xmlDoc.DocumentElement.LastChild);
                using (FileStream fsxml = new FileStream(fileLocation, FileMode.Truncate, FileAccess.Write, FileShare.ReadWrite))
                {
                    xmlDoc.Save(fsxml);
                    fsxml.Close();
                }
            }
            #endregion
            #region Update
            else
            {
                XDocument doc = XDocument.Load(fileLocation);
                foreach (var item in doc.Descendants("Screen"))
                {
                    if (item.Element("ScreenName").Value == screen.ScreenName)
                    {
                        item.Element("ScreenTop").SetValue(screen.ScreenTop);
                        item.Element("ScreenLeft").SetValue(screen.ScreenLeft);
                        doc.Save(fileLocation);
                        break;
                    }
                }
            }
            #endregion
        }
Ejemplo n.º 22
0
        public SplashScreen()
        {
            var splashPosition = ScreenProperties.Center(
                ContentChest.Splash.Width / 2,
                ContentChest.Splash.Height / 2
                );

            _splashRectangle = new Rectangle(
                (int)splashPosition.X,
                (int)splashPosition.Y,
                ContentChest.Splash.Width / 2,
                ContentChest.Splash.Height / 2);

            ContentChest.OnLoaded = OnContentLoaded;
        }
        protected override void NativeArrange(System.Drawing.RectangleF finalRect)
        {
            base.NativeArrange(finalRect);

            int newWidth  = Android.Views.View.MeasureSpec.MakeMeasureSpec((int)finalRect.Width, MeasureSpecMode.Exactly);
            int newHeight = Android.Views.View.MeasureSpec.MakeMeasureSpec((int)finalRect.Height, MeasureSpecMode.Exactly);

            this.ContentNativeUIElement.Measure(newWidth, newHeight);

            this.ContentNativeUIElement.Layout(0,
                                               0,
                                               (int)ScreenProperties.ConvertDPIToPixels(finalRect.Width),
                                               (int)ScreenProperties.ConvertDPIToPixels(finalRect.Height));

            this.NativeUpdateLayout();
        }
Ejemplo n.º 24
0
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            rWin.Close(); //otherwise the exe hangs around
            eWin.Close();
            sWin.Close();

            ScreenProperties s = new ScreenProperties()
            {
                ScreenName = this.Name,
                ScreenTop  = this.Top.ToString(),
                ScreenLeft = this.Left.ToString()
            };
            WindowManager w = new WindowManager();

            w.WriteToXmlFile(s, true);
        }
Ejemplo n.º 25
0
        protected override ScreenProperties InternalGetDefaultScreen()
        {
            Graphics g                    = Graphics.FromHwnd(IntPtr.Zero);
            IntPtr   desktop              = g.GetHdc();
            int      LogicalScreenHeight  = GetDeviceCaps(desktop, (int)DeviceCap.VERTRES);
            int      PhysicalScreenHeight = GetDeviceCaps(desktop, (int)DeviceCap.DESKTOPVERTRES);

            var scaleFactor = PhysicalScreenHeight / (double)LogicalScreenHeight;
            var dpi         = 96 * scaleFactor;

            var scr = Screen.PrimaryScreen.Bounds.Size;

            var ret = ScreenProperties.CreatePixelScreen(new Size(scr.Width * scaleFactor, scr.Height * scaleFactor), dpi);

            return(ret);
        }
        public static void PositionWindowOnScreenWithOffsetIgnoringSystemDPI(Window window, System.Windows.Forms.Screen screen, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment, float hOffset, float vOffset)
        {
            System.IntPtr monitor = NativeMethods.GetMonitorFromWindow(NativeMethods.GetWindowHwnd(window));


            var _screenProps = new ScreenProperties();

            _screenProps.GetMonitorsInformation();
            var    monitorInfo   = _screenProps.GetMonitorInformation(monitor);
            var    workingArea   = monitorInfo.rcWork;
            var    dpiScale      = DpiUtilities.CalculateScale((uint)monitorInfo.dpiX, (uint)monitorInfo.dpiY, 96, 96);
            double workingLeft   = (workingArea.left + hOffset) / dpiScale.X;
            double workingWidth  = workingArea.width / dpiScale.X;
            double workingTop    = (workingArea.top + vOffset) / dpiScale.Y;
            double workingHeight = workingArea.height / dpiScale.Y;

            PositionWindow(window, workingLeft, workingTop, workingWidth, workingHeight, horizontalAlignment, verticalAlignment);
        }
Ejemplo n.º 27
0
 //CHECK
 public void SetScreen(string NxtScreenname)
 {
     foreach (GameObject g in mScreens)
     {
         ScreenProperties sp = g.GetComponent <ScreenProperties> ();
         if (sp.GetScreenName().Equals(NxtScreenname))
         {
             g.SetActive(true);
             g.transform.FindChild("ScreenSpace").gameObject.SetActive(true);
             mScreenStack.Push(NxtScreenname);
         }
         else
         {
             g.SetActive(false);
             g.transform.FindChild("ScreenSpace").gameObject.SetActive(false);
         }
     }
     TriggerScreenLoadEvents(NxtScreenname);
 }
Ejemplo n.º 28
0
            public override View GetView(int position, View reusableView, ViewGroup parent)
            {
                UIElement listItem;

                if (reusableView == null)
                {
                    reusableView = new WrapedViewGroup(parent.Context);
                    listItem     = (UIElement)this.Generator.ContainerFromIndex(position);
                    LogicalTreeHelper.AddLogicalChild(this.VirtualizingStackPanel, listItem);
                    this.NativeViewContainers.Add(listItem.NativeUIElement, listItem);
                    ((WrapedViewGroup)reusableView).AddView(listItem.NativeUIElement);
                }
                else
                {
                    var nativeItem = ((WrapedViewGroup)reusableView).GetChildAt(0);
                    if (this.NativeViewContainers.ContainsKey(nativeItem))
                    {
                        listItem = this.NativeViewContainers[nativeItem];
                        this.Generator.Reuse(position, listItem);
                    }
                    else
                    {
                        ((WrapedViewGroup)reusableView).RemoveAllViews();
                        listItem = (UIElement)this.Generator.ContainerFromIndex(position);
                        LogicalTreeHelper.AddLogicalChild(this.VirtualizingStackPanel, listItem);
                        this.NativeViewContainers.Add(listItem.NativeUIElement, listItem);
                        ((WrapedViewGroup)reusableView).AddView(listItem.NativeUIElement);
                    }
                }

                var availableSize = this.VirtualizingStackPanel.Orientation == Orientation.Horizontal
                        ? new SizeF(float.PositiveInfinity, this.VirtualizingStackPanel.measuredSize.Height)
                        : new SizeF(this.VirtualizingStackPanel.measuredSize.Width, float.PositiveInfinity);
                var measuredSize = listItem.MeasureOverride(availableSize);

                listItem.Arrange(new RectangleF(PointF.Empty, measuredSize));

                // Need to use AbsListView.LayoutParams to prevent Java.CastException
                reusableView.LayoutParameters = new AbsListView.LayoutParams((int)ScreenProperties.ConvertDPIToPixels(listItem.measuredSize.Width), (int)ScreenProperties.ConvertDPIToPixels(listItem.measuredSize.Height));

                return(reusableView);
            }
        protected override void NativeArrange(RectangleF finalRect)
        {
            base.NativeArrange(finalRect);

            // rendering of the checkmark
            if (this.controlTemplateInstance == null)
            {
                RectangleF rectCheckBox = new RectangleF();
                rectCheckBox.X = 0.0f;
                rectCheckBox.Y = 0.0f;

                rectCheckBox.Width  = Math.Min(finalRect.Width, ScreenProperties.ConvertPixelsToDPI(this.androidRadioButtonBackground.IntrinsicWidth));
                rectCheckBox.Height = Math.Min(finalRect.Height, ScreenProperties.ConvertPixelsToDPI(this.androidRadioButtonBackground.IntrinsicHeight));

                this.androidRadioButton.Layout((int)ScreenProperties.ConvertDPIToPixels(rectCheckBox.Left),
                                               (int)ScreenProperties.ConvertDPIToPixels(rectCheckBox.Top),
                                               (int)ScreenProperties.ConvertDPIToPixels(rectCheckBox.Right),
                                               (int)ScreenProperties.ConvertDPIToPixels(rectCheckBox.Bottom));
            }
        }
        protected override void NativeArrangeContent(System.Drawing.RectangleF finalRect)
        {
            var rectContent    = new Rectangle();
            var checkBoxWidhPx = ScreenProperties.ConvertPixelsToDPI(this.androidRadioButtonBackground.IntrinsicWidth);
            var y = (finalRect.Height - this.Padding.Top - this.Padding.Bottom - this.originalContentSize) / 2d;

            if (y < 0)
            {
                y = finalRect.Y;
            }
            else
            {
                y += this.Padding.Top;
            }
            rectContent.X      = (int)(checkBoxWidhPx + this.Padding.Left);
            rectContent.Y      = (int)y;
            rectContent.Width  = (int)finalRect.Width;
            rectContent.Height = (int)finalRect.Height;
            base.NativeArrangeContent(rectContent);
        }
Ejemplo n.º 31
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            RootLayout rootLayout = new RootLayout(this);

            FrameLayout frgmCont = new FrameLayout(this);

            frgmCont.Id = this.fragmentPageFrameLayoutResourceId;
            rootLayout.AddView(frgmCont, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent));
            rootLayout.SizeChanged += (s, e) =>
            {
                this.PageHeight = rootLayout.Height;
                this.PageWidth  = rootLayout.Width;

                var dpiPageSize = new RectangleF(
                    0.0f, 0.0f, ScreenProperties.ConvertPixelsToDPI(this.PageWidth), ScreenProperties.ConvertPixelsToDPI(this.PageHeight));
                AppercodeVisualRoot.Instance.Arrange(dpiPageSize);
            };

            this.SetContentView(rootLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent));
            this.Navigate(this.StartPage, null, NavigationType.Default);
        }
Ejemplo n.º 32
0
 /// <summary>Informs about a change of the window size.</summary>
 internal static void ResizeNotify(int width, int height)
 {
     Properties = new ScreenProperties(width, height);
 }