protected override void OnClick(EventArgs e)
 {
     try
     {
         SEBWindowHandler.BringWindowToTop(SEBWindowHandler.GetOpenWindows().First <KeyValuePair <IntPtr, string> >((Func <KeyValuePair <IntPtr, string>, bool>)(w => w.Key.GetProcess().GetExecutableName().Contains("xul"))).Key);
         if ((bool)SEBSettings.settingsCurrent["touchOptimized"])
         {
             if ((bool)SEBSettings.settingsCurrent["showReloadWarning"])
             {
                 if (SEBMessageBox.Show(SEBUIStrings.reloadPage, SEBUIStrings.reloadPageMessage, MessageBoxIcon.Exclamation, MessageBoxButtons.YesNo, false) != DialogResult.Yes)
                 {
                     return;
                 }
                 SEBXULRunnerWebSocketServer.SendReloadPage();
             }
             else
             {
                 SEBXULRunnerWebSocketServer.SendReloadPage();
             }
         }
         else
         {
             SEBXULRunnerWebSocketServer.SendReloadPage();
         }
     }
     catch
     {
     }
 }
        protected override void OnClick(EventArgs e)
        {
            try
            {
                SEBWindowHandler.BringWindowToTop(
                    SEBWindowHandler.GetOpenWindows()
                    .First(w => w.Key.GetProcess().GetExecutableName().Contains("xul")).Key);

                if ((bool)SEBSettings.settingsCurrent[SEBSettings.KeyTouchOptimized])
                {
                    if ((bool)SEBSettings.settingsCurrent[SEBSettings.KeyShowReloadWarning])
                    {
                        if (
                            SEBMessageBox.Show(SEBUIStrings.reloadPage, SEBUIStrings.reloadPageMessage,
                                               MessageBoxIcon.Warning, MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            SEBXULRunnerWebSocketServer.SendReloadPage();
                        }
                    }
                    else
                    {
                        SEBXULRunnerWebSocketServer.SendReloadPage();
                    }
                }
                else
                {
                    SEBXULRunnerWebSocketServer.SendReloadPage();
                }
            }
            catch {}
        }
示例#3
0
 protected override void OnClick(EventArgs e)
 {
     try
     {
         SEBWindowHandler.BringWindowToTop(
             SEBWindowHandler.GetOpenWindows()
             .First(w => w.Key.GetProcess().GetExecutableName().Contains("firefox")).Key);
     }
     catch { }
 }
示例#4
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     this.txtQuitPassword.Text = "";
     this.Visible = false;
     if ((bool)SEBSettings.valueForDictionaryKey(SEBSettings.settingsCurrent, SEBSettings.KeyTouchOptimized))
     {
         var topWindow = SEBWindowHandler.GetOpenWindows().FirstOrDefault();
         if (topWindow.Value != null)
         {
             topWindow.Key.AdaptWindowToWorkingArea();
         }
     }
 }
示例#5
0
        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.txtQuitPassword.Text = "";
            this.Visible = false;
            if (!(bool)SEBSettings.valueForDictionaryKey(SEBSettings.settingsCurrent, "touchOptimized"))
            {
                return;
            }
            KeyValuePair <IntPtr, string> keyValuePair = SEBWindowHandler.GetOpenWindows().FirstOrDefault <KeyValuePair <IntPtr, string> >();

            if (keyValuePair.Value == null)
            {
                return;
            }
            keyValuePair.Key.AdaptWindowToWorkingArea(new int?());
        }
示例#6
0
 private void ResizeTopOpenWindow()
 {
     try
     {
         if ((bool)SEBSettings.valueForDictionaryKey(SEBSettings.settingsCurrent, SEBSettings.KeyTouchOptimized))
         {
             var topWindow = SEBWindowHandler.GetOpenWindows().FirstOrDefault();
             if (topWindow.Value != null)
             {
                 topWindow.Key.AdaptWindowToWorkingArea();
             }
         }
     }
     catch
     { }
 }
 private void ResizeTopOpenWindow()
 {
     try
     {
         if (!(bool)SEBSettings.valueForDictionaryKey(SEBSettings.settingsCurrent, "touchOptimized"))
         {
             return;
         }
         KeyValuePair <IntPtr, string> keyValuePair = SEBWindowHandler.GetOpenWindows().FirstOrDefault <KeyValuePair <IntPtr, string> >();
         if (keyValuePair.Value == null)
         {
             return;
         }
         keyValuePair.Key.AdaptWindowToWorkingArea(new int?());
     }
     catch
     {
     }
 }
        /// ----------------------------------------------------------------------------------------
        /// <summary>
        /// Fill listApplications with running Applications, lWindowHandles with Window Handles
        ///  of running Applications and ilApplicationIcons with running Applications Icons.
        /// </summary>
        /// ----------------------------------------------------------------------------------------
        public void fillListApplications()
        {
            List <string> lRunningApplications = new List <string>();
            ImageList     ilApplicationIcons   = new ImageList();

            int iconSize = (int)(32 * SEBClientInfo.scaleFactor);

            if ((Boolean)SEBClientInfo.getSebSetting(SEBSettings.KeyTouchOptimized)[SEBSettings.KeyTouchOptimized] ==
                true)
            {
                iconSize = (int)(48 * SEBClientInfo.scaleFactor);
            }

            ilApplicationIcons.ImageSize  = new Size(iconSize, iconSize);
            ilApplicationIcons.ColorDepth = ColorDepth.Depth32Bit;
            this.lWindowHandles.Clear();

            int index = 0;

            foreach (var oW in SEBWindowHandler.GetOpenWindows())
            {
                if (oW.Key.IsAllowed())
                {
                    this.lWindowHandles.Add(oW.Key);
                    this.lWindowTitles.Add(oW.Value);
                    lRunningApplications.Add(oW.Value);

                    if (oW.Key.GetProcess().ProcessName.Contains("xulrunner"))
                    {
                        Bitmap sebIconBitmap = Icon.ExtractAssociatedIcon(Application.ExecutablePath).ToBitmap();
                        //sebIconBitmap.MakeTransparent(BackColor);
                        ilApplicationIcons.Images.Add(sebIconBitmap);
                    }
                    else
                    {
                        Image image = GetSmallWindowIcon(oW.Key);
                        ilApplicationIcons.Images.Add("rAppIcon" + index, image);
                    }
                    index++;
                }
            }

            // Suspending automatic refreshes as items are added/removed.
            this.listApplications.BeginUpdate();
            this.listApplications.Clear();
            this.listApplications.View           = View.LargeIcon;
            this.listApplications.LargeImageList = ilApplicationIcons;
            this.listApplications.Scrollable     = false;

            //listApplications.SmallImageList = imagesSmall;
            //listApplications.LargeImageList = imagesLarge;
            int appItemsTotalWidth = 0;
            int appItemsMaxHeight  = 0;

            for (int i = 0; i < lRunningApplications.Count(); i++)
            {
                ListViewItem listItem = new ListViewItem(lRunningApplications[i]);
                listItem.ImageIndex = i;

                this.listApplications.Items.Add(listItem);

                Rectangle listItemRect = this.listApplications.GetItemRect(i);
                Logger.AddInformation("ListView.GetItemRect: " + listItemRect.ToString(), null, null);
                appItemsTotalWidth += listItemRect.Width;
                if (listItemRect.Height > appItemsMaxHeight)
                {
                    appItemsMaxHeight = listItemRect.Height;
                }
            }
            this.listApplications.Dock     = DockStyle.Fill;
            this.listApplications.AutoSize = true;
            //this.Width = listApplications.Items.Count*128;

            // Calculate necessary size of the app chooser form according to number of applications/icons
            int   numberIcons = lRunningApplications.Count();
            int   formWidth;
            float scaleFactor = SEBClientInfo.scaleFactor;

            //if (numberIcons > 0) formWidth = (int)Math.Round(2 * appChooserFormXPadding * scaleFactor + numberIcons * 32 + (numberIcons - 1) * appChooserFormXGap * scaleFactor);
            //else formWidth = (int)Math.Round(2 * appChooserFormXPadding * scaleFactor);
            //if (numberIcons > 0) formWidth = (int)Math.Round((2 * appChooserFormXPadding + appItemsTotalWidth) * scaleFactor);
            if (numberIcons > 0)
            {
                formWidth = (int)Math.Round(2 * appChooserFormXPadding * scaleFactor + appItemsTotalWidth);
            }
            else
            {
                formWidth = (int)Math.Round(2 * appChooserFormXPadding * scaleFactor);
            }
            // Check if calculated width is larger that current screen width, if yes, adjust height accordingly
            if (Screen.PrimaryScreen.Bounds.Width < formWidth)
            {
                formWidth   = Screen.PrimaryScreen.Bounds.Width;
                this.Height = (int)Math.Round((2 * appChooserFormXPadding + 2 * appItemsMaxHeight + appChooserFormXPadding) * scaleFactor);
            }
            else
            {
                this.Width  = formWidth;
                this.Height = (int)Math.Round(2 * appChooserFormXPadding * scaleFactor + appItemsMaxHeight);
                //this.Height = (int)Math.Round(SEBClientInfo.appChooserHeight * scaleFactor);
            }

            int formHeight = this.Height;

            listApplications.Height = formHeight - 24;

            this.CenterToScreen();

            // Re-enable the display.
            this.listApplications.EndUpdate();

            if (this.listApplications.Items.Count == 1)
            {
                //this.listApplications.Items[0].Selected = true;
                selectedItemIndex = 0;
            }
            if (this.listApplications.Items.Count > 1)
            {
                //this.listApplications.Items[1].Selected = true;
                selectedItemIndex = 1;
            }

            SelectNextListItem();
        }