Inheritance: Hildon.Window
Exemple #1
0
        private void ButtonFind_Click(object sender, RoutedEventArgs e)
        {
            List <FindHandler.FieldParameters> listOfField = FillFindFields();

            var findWindow = new FindWindow(currentFindDescription, listOfField);

            if (findWindow.ShowDialog().Value)
            {
                currentFindDescription = findWindow.Result;
            }
            else
            {
                return;
            }

            var    field = listOfField.Where(kvp => kvp.application_name == currentFindDescription.field).First().db_name;
            string query = getQueryText();
            string edited_query;


            edited_query  = query.Replace(";", " where " + field + " ");
            edited_query += string.Format(currentFindDescription.typeOfFind == TypeOfFind.TypesOfFind.byExactCoincidence ? "= \"{0}\"" : "like \"{0}%\"", currentFindDescription.value);


            MySqlConnection  connection = new MySqlConnection(connectionString);
            DataTable        dataTable  = new DataTable();
            MySqlCommand     command    = new MySqlCommand(edited_query, connection);
            MySqlDataAdapter adapter    = new MySqlDataAdapter(command);

            adapter.Fill(dataTable);
            productsGrid.ItemsSource = dataTable.DefaultView;
            connection.Close();
            buttonCancelFind.Style = (Style)buttonCancelFind.FindResource("Active");
        }
Exemple #2
0
        public Task ShowAsync()
        {
            FindWindow dialogWindow = _serviceProvider.GetRequiredService <FindWindow>();

            dialogWindow.Show();

            return(Task.CompletedTask);
        }
        private void FindMenu_Click(object sender, RoutedEventArgs e)
        {
            var window = new FindWindow(HexEdit)
            {
                Owner = this
            };

            window.Show();
        }
        public void PreviewPost(object sender, RoutedEventArgs e)
        {
            var mb = new FindWindow(inputTbx)
            {
                Width = 500, Height = 320
            };

            mb.Show(this);
        }
        public static void Find()
        {
            BufferData bufferData = BufferData.GetInstance();

            bufferData.EditMode = BufferData.EditModes.Find;

            FindWindow w = FindWindow.GetInstance();

            w.Show();
        }
Exemple #6
0
 public MainWindow()
 {
     _findWindow = new FindWindow(findCommandModel =>
     {
         this.Invoke(() =>
                     ((LocalizatorViewModel)DataContext).FindInProjectCommand.Execute(findCommandModel));
     });
     OriginalTitle = Title;
     DataContext   = new LocalizatorViewModel(this);
 }
Exemple #7
0
 private void SetNotZeroForeGroundHandle()
 {
     while (true)
     {
         IntPtr currentHandle = FindWindow.GetForegroundWindow();
         if (currentHandle != IntPtr.Zero && currentHandle != WinHelper.GetDesktopWindow())
         {
             WinHelper.foreGroundHandle = currentHandle;
         }
     }
 }
Exemple #8
0
        private void Find()
        {
            FindWindow findW = new FindWindow();

            findW.ShowDialog();
            if (findW.Founded)
            {
                string subStr = findW.itemName;
                ObservableCollection <IShellItem> foundedItems = new ObservableCollection <IShellItem>();
                IShellItem startDirectory = SelectedShell.InFolder;
                if (startDirectory != null)
                {
                    startDirectory.GetFoundedSubitems(subStr, foundedItems);
                }
                SelectedShell.InFolder = null;
                SelectedShell.Files    = foundedItems;
            }
        }
        private bool FindMainWindow()
        {
            var handle = FindWindow.EqualsWindowCaption("Demonbuddy", Proc.Id);

            if (handle != IntPtr.Zero)
            {
                MainWindowHandle = handle;
                Logger.Instance.Write(Parent, "Found Demonbuddy: MainWindow ({0})", handle);
                return(true);
            }
            handle = FindWindow.EqualsWindowCaption("Demonbuddy - BETA", Proc.Id);
            if (handle != IntPtr.Zero)
            {
                MainWindowHandle = handle;
                Logger.Instance.Write(Parent, "Found Demonbuddy - BETA: MainWindow ({0})", handle);
                return(true);
            }
            return(false);
        }
Exemple #10
0
        public void Start()
        {
            if (!Parent.IsStarted)
            {
                return;
            }

            if (!File.Exists(Location))
            {
                Logger.Instance.Write("File not found: {0}", Location);
                return;
            }

            _isStopped = false;
            // Ping check
            while (Settings.Default.ConnectionCheckPing && !ConnectionCheck.PingCheck() && !_isStopped)
            {
                Parent.Status = "Wait on internet connection";
                Logger.Instance.WriteGlobal("PingCheck: Waiting 10 seconds and trying again!");
                Thread.Sleep(10000);
            }

            // Check valid host
            while (Settings.Default.ConnectionCheckIpHost && !ConnectionCheck.CheckValidConnection() && !_isStopped)
            {
                Parent.Status = "Wait on host validation";
                Logger.Instance.WriteGlobal("ConnectionValidation: Waiting 10 seconds and trying again!");
                Thread.Sleep(10000);
            }

            // Check if we need to create a Diablo clone
            if (Parent.UseDiabloClone)
            {
                DiabloClone.Create(Parent);
            }

            Parent.Status = "Prepare Diablo"; // Update Status

            General.AgentKiller();            // Kill all Agent.exe processes

            // Prepare D3 for launch
            var agentDBPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\Battle.net\Agent\agent.db";

            if (File.Exists(agentDBPath))
            {
                Logger.Instance.Write("Deleting: {0}", agentDBPath);
                try
                {
                    File.Delete(agentDBPath);
                }
                catch (Exception ex)
                {
                    Logger.Instance.Write("Failed to delete! Exception: {0}", ex.Message);
                    DebugHelper.Exception(ex);
                }
            }

            // Copy D3Prefs
            if (!string.IsNullOrEmpty(Parent.D3PrefsLocation))
            {
                D3Prefs();
            }

            // Registry Changes
            RegistryClass.ChangeLocale(Parent.Diablo.Language); // change language
            RegistryClass.ChangeRegion(Parent.Diablo.Region);   // change region

            if (UseIsBoxer)
            {
                IsBoxerStarter();
            }
            else if (Settings.Default.UseD3Starter)
            {
                ApocD3Starter();
            }
            else
            {
                try
                {
                    var arguments = "-launch";
                    var pi        = new ProcessStartInfo(Location2, arguments)
                    {
                        WorkingDirectory = Path.GetDirectoryName(Location2)
                    };
                    pi = UserAccount.ImpersonateStartInfo(pi, Parent);
                    // Set working directory to executable location
                    Parent.Status = "Starting Diablo"; // Update Status
                    Proc          = Process.Start(pi);
                }
                catch (Exception ex)
                {
                    Parent.Stop();
                    DebugHelper.Exception(ex);
                    return;
                }
            }

            if (!UseIsBoxer) // Don't want to fight with isboxer
            {
                if (CpuCount != Environment.ProcessorCount)
                {
                    ProcessorAffinity = AllProcessors; // set it to all ones
                    CpuCount          = Environment.ProcessorCount;
                }
                Proc.ProcessorAffinity = (IntPtr)ProcessorAffinity;
            }


            if (_isStopped)
            {
                return;             // Halt here when bot is stopped while we where waiting for it to become active
            }
            // Wait for d3 to fully load
            var state    = (Settings.Default.UseD3Starter || UseIsBoxer ? 0 : 2);
            var handle   = IntPtr.Zero;
            var timedout = false;

            LimitStartTime(true); // reset startup time
            while ((!Proc.HasExited && state < 4))
            {
                if (timedout)
                {
                    return;
                }
                //Debug.WriteLine("Splash: " + FindWindow.FindWindowClass("D3 Splash Window Class", Proc.Id) + " Main:" + FindWindow.FindWindowClass("D3 Main Window Class", Proc.Id));
                switch (state)
                {
                case 0:
                    handle = FindWindow.FindWindowClass("D3 Splash Window Class", Proc.Id);
                    if (handle != IntPtr.Zero)
                    {
                        Logger.Instance.Write("Diablo:{0}: Found D3 Splash Window ({1})", Proc.Id, handle);
                        state++;
                        LimitStartTime(true);     // reset startup time
                    }
                    timedout = LimitStartTime();
                    break;

                case 1:
                    handle = FindWindow.FindWindowClass("D3 Splash Window Class", Proc.Id);
                    if (handle == IntPtr.Zero)
                    {
                        Logger.Instance.Write("Diablo:{0}: D3 Splash Window Closed ({1})", Proc.Id, handle);
                        state++;
                        LimitStartTime(true);     // reset startup time
                    }
                    timedout = LimitStartTime();
                    break;

                case 2:
                    handle = FindWindow.FindWindowClass("D3 Main Window Class", Proc.Id);
                    if (handle != IntPtr.Zero)
                    {
                        Logger.Instance.Write("Diablo:{0}: Found D3 Main Window ({1})", Proc.Id, handle);
                        state++;
                        LimitStartTime(true);     // reset startup time
                    }
                    timedout = LimitStartTime();
                    break;

                case 3:
                    if (CrashChecker.IsResponding(handle))
                    {
                        MainWindowHandle = handle;
                        state++;
                        LimitStartTime(true);     // reset startup time
                    }
                    timedout = LimitStartTime();
                    break;
                }
                Thread.Sleep(500);
            }
            if (timedout)
            {
                return;
            }

            if (Program.IsRunAsAdmin)
            {
                Proc.PriorityClass = General.GetPriorityClass(Priority);
            }
            else
            {
                Logger.Instance.Write(Parent, "Failed to change priority (No admin rights)");
            }
            // Continue after launching stuff
            Logger.Instance.Write("Diablo:{0}: Waiting for process to become ready", Proc.Id);

            var timeout = DateTime.Now;

            while (true)
            {
                if (General.DateSubtract(timeout) > 30)
                {
                    Logger.Instance.Write("Diablo:{0}: Failed to start!", Proc.Id);
                    Parent.Restart();
                    return;
                }
                Thread.Sleep(500);
                try
                {
                    Proc.Refresh();
                    if (Proc.WaitForInputIdle(100) || CrashChecker.IsResponding(MainWindowHandle))
                    {
                        break;
                    }
                }
                catch (Exception ex)
                {
                    DebugHelper.Exception(ex);
                }
            }

            if (!IsRunning)
            {
                return;
            }

            _lastRepsonse = DateTime.Now;

            Thread.Sleep(1500);
            if (NoFrame)
            {
                AutoPosition.RemoveWindowFrame(MainWindowHandle, true);          // Force remove window frame
            }
            if (ManualPosSize)
            {
                AutoPosition.ManualPositionWindow(MainWindowHandle, X, Y, W, H, Parent);
            }
            else if (Settings.Default.UseAutoPos)
            {
                AutoPosition.PositionWindows();
            }

            Logger.Instance.Write("Diablo:{0}: Process is ready", Proc.Id);

            // Demonbuddy start delay
            if (Settings.Default.DemonbuddyStartDelay > 0)
            {
                Logger.Instance.Write("Demonbuddy start delay, waiting {0} seconds", Settings.Default.DemonbuddyStartDelay);
                Thread.Sleep((int)Settings.Default.DemonbuddyStartDelay * 1000);
            }
        }
Exemple #11
0
        protected override void OnDocumentLoaded()
        {
            base.OnDocumentLoaded();

            var modelRoot = this.RootElement as global::nHydrate.Dsl.nHydrateModel;

            nHydrate.Dsl.nHydrateDiagram diagram = null;
            if (modelRoot != null)
            {
                diagram = Microsoft.VisualStudio.Modeling.Diagrams.PresentationViewsSubject.GetPresentation(modelRoot).FirstOrDefault() as nHydrate.Dsl.nHydrateDiagram;
                if (diagram != null)
                {
                    diagram.ShapeDoubleClick += new EventHandler <nHydrate.Dsl.ModelElementEventArgs>(diagram_ShapeDoubleClick);
                    diagram.ShapeConfiguring += new EventHandler <nHydrate.Dsl.ModelElementEventArgs>(diagram_ShapeConfiguring);
                }
            }

            if (diagram != null)
            {
                var mainInfo  = new FileInfo(this.FileName);
                var modelName = mainInfo.Name.Replace(".nhydrate", ".model");
                nHydrate.Dsl.Custom.SQLFileManagement.LoadDiagramFiles(modelRoot, mainInfo.DirectoryName, modelName, diagram);
            }

            #region Load the delete tracking file
            var fi        = new FileInfo(this.FileName);
            var cacheFile = Path.Combine(fi.DirectoryName, fi.Name + ".deletetracking");
            if (File.Exists(cacheFile))
            {
                var document = new XmlDocument();
                try
                {
                    document.Load(cacheFile);
                }
                catch (Exception ex)
                {
                    //Do Nothing, there is a file error
                    return;
                }

                //Tables
                foreach (XmlNode node in document.DocumentElement.SelectNodes("tables/table"))
                {
                    modelRoot.RemovedTables.Add(node.InnerText);
                }

                //Views
                foreach (XmlNode node in document.DocumentElement.SelectNodes("views/view"))
                {
                    modelRoot.RemovedViews.Add(node.InnerText);
                }
            }
            #endregion

            modelRoot.IsDirty   = false;
            modelRoot.IsLoading = false;
            this.SetDocDataDirty(0);

            var package = this.ServiceProvider.GetService(typeof(nHydratePackage)) as Microsoft.VisualStudio.Modeling.Shell.ModelingPackage;
            if (package != null)
            {
                this.FindWindow = package.GetToolWindow(typeof(FindWindow), true) as FindWindow;
                this.ModelExplorerToolWindow = package.GetToolWindow(typeof(nHydrateExplorerToolWindow), true) as nHydrateExplorerToolWindow;
            }
        }
Exemple #12
0
        private void searchUser_Click(object sender, RoutedEventArgs e)
        {
            FindWindow win = new FindWindow(this);

            win.ShowDialog();
        }
Exemple #13
0
        private void capturePic_Click(object sender, EventArgs e)
        {
            SHDocVw.WebBrowser m_browser = null;                                 //get browser

            SHDocVw.ShellWindows shellWindows = new SHDocVw.ShellWindowsClass(); //
            string filename;

            foreach (SHDocVw.WebBrowser ie in shellWindows)
            {
                filename = Path.GetFileNameWithoutExtension(ie.FullName).ToLower();

                if (filename.Equals("iexplore"))
                {
                    m_browser = ie;
                    break;
                }
            }
            //Assign Browser Document
            mshtml.IHTMLDocument2 myDoc     = (mshtml.IHTMLDocument2)m_browser.Document;
            DispHTMLDocument      myDocImpl = myDoc as DispHTMLDocument;
            HTMLDocument          myHtmlDoc = myDoc as HTMLDocument;
            //      IHTMLDocument2 doc2 = (IHTMLDocument2)m_browser.Document;
            //      IHTMLDocument3 doc3 = (IHTMLDocument3)m_browser.Document;
            //      IHTMLElement2 body2 = (IHTMLElement2)doc2.body;
            //      IHTMLElement2 root2 = (IHTMLElement2)doc3.documentElement;

            //      int width = Math.Max(body2.scrollWidth, root2.scrollWidth);
            //      int height = Math.Max(root2.scrollHeight, body2.scrollHeight);

            //      //m_browser.SetBounds(0, 0, width, height);
            //      width = Math.Max(body2.scrollWidth, root2.scrollWidth);
            //      height = Math.Max(root2.scrollHeight, body2.scrollHeight);
            //      //m_browser.SetBounds(0, 0, width, height);

            //      Bitmap image = new Bitmap(width, height);
            //      Graphics g = Graphics.FromImage(image);

            //      _RECTL bounds;
            //      bounds.left = 0;
            //      bounds.top = 0;
            //      bounds.right = width;
            //      bounds.bottom = height;

            //      IntPtr hdc = g.GetHdc();
            //      IViewObject iv = doc2 as IViewObject;

            //      // TODO: Write to Metafile instead if requested.1, -1, (IntPtr)0, (IntPtr)0, (IntPtr)0,(IntPtr)hdc, ref bounds, (IntPtr)0, (IntPtr)0, 0

            //      iv.Draw(1, -1, (IntPtr)0, (IntPtr)0, (IntPtr)0,
            //(IntPtr)hdc, ref bounds, (IntPtr)0, (IntPtr)0, 0);

            //      g.ReleaseHdc(hdc);
            //      image.Save("c:\\1.jpg");
            //      image.Dispose();



            //URL Location

            IHTMLDocument2 doc2  = (IHTMLDocument2)m_browser.Document;
            IHTMLDocument3 doc3  = (IHTMLDocument3)m_browser.Document;
            IHTMLElement2  body2 = (IHTMLElement2)doc2.body;
            IHTMLElement2  root2 = (IHTMLElement2)doc3.documentElement;

            int width  = Math.Max(body2.scrollWidth, root2.scrollWidth);
            int height = Math.Max(root2.scrollHeight, body2.scrollHeight);

            string myLocalLink    = myDoc.url;
            int    URLExtraHeight = 0;
            int    URLExtraLeft   = 0;

            //Adjustment variable for capture size.
            //if (chkWriteURL.Checked == true)
            //  URLExtraHeight = 25;

            //TrimHeight and TrimLeft trims off some captured IE graphics.
            int trimHeight = 3;
            int trimLeft   = 3;

            //Use UrlExtra height to carry trimHeight.
            URLExtraHeight = URLExtraHeight - trimHeight;
            URLExtraLeft   = URLExtraLeft - trimLeft;

            myDoc.body.setAttribute("scroll", "yes", 0);

            //Get Browser Window Height
            int heightsize = (int)myDoc.body.getAttribute("scrollHeight", 0);
            int widthsize  = (int)myDoc.body.getAttribute("scrollWidth", 0);

            //Get Screen Height
            int screenHeight = (int)myDoc.body.getAttribute("clientHeight", 0);
            int screenWidth  = (int)myDoc.body.getAttribute("clientWidth", 0);

            //Get bitmap to hold screen fragment.
            Bitmap bm = new Bitmap(screenWidth, screenHeight, System.Drawing.Imaging.PixelFormat.Format32bppRgb);

            //Create a target bitmap to draw into.
            Bitmap   bm2 = new Bitmap(widthsize + URLExtraLeft, heightsize + URLExtraHeight - trimHeight, System.Drawing.Imaging.PixelFormat.Format32bppRgb);
            Graphics g2  = Graphics.FromImage(bm2);

            Graphics g = null;
            IntPtr   hdc;
            Image    screenfrag = null;
            int      brwTop     = 0;
            int      brwLeft    = 0;
            int      myPage     = 0;
            IntPtr   myIntptr   = (IntPtr)m_browser.HWND;


            //Get inner browser window.
            int    hwndInt = myIntptr.ToInt32();
            IntPtr hwnd    = myIntptr;

            FindWindow fw = new FindWindow(hwnd, "Internet Explorer_Server");

            hwnd = fw.FoundHandle;

            string bodyId = (string)myDoc.body.getAttribute("id", 0);

            if (bodyId == null)
            {
                myDoc.body.setAttribute("id", "current", 0);
                bodyId = (string)myDoc.body.getAttribute("id", 0);
            }
            //Get Screen Height (for bottom up screen drawing)
            while ((myPage * screenHeight) < height)
            {
                myDoc.body.setAttribute("scrollTop", (screenHeight - 5) * myPage, 0);
                ++myPage;
            }
            //Rollback the page count by one
            --myPage;

            int myPageWidth = 0;

            while ((myPageWidth * screenWidth) < width)
            {
                //myDocImpl.getElementById(bodyId).setAttribute("scrollLeft", (screenWidth - 5) * myPageWidth, 0);
                //myDoc.body.setAttribute("scrollLeft", (screenWidth - 5) * myPageWidth, 0);
                //brwLeft = (int)myDoc.body.getAttribute("scrollLeft", 0);
                //brwLeft = (int)myDocImpl.getElementById(bodyId).getAttribute("scrollLeft", 0);
                for (int i = myPage; i >= 0; --i)
                {
                    //Shoot visible window
                    g   = Graphics.FromImage(bm);
                    hdc = g.GetHdc();
                    //myDoc.body.setAttribute("scrollTop", (screenHeight - 5) * i, 0);
                    //brwTop = (int)myDoc.body.getAttribute("scrollTop", 0);
                    //myDocImpl.getElementById(bodyId).setAttribute("scrollTop", (screenHeight - 5) * myPageWidth, 0);
                    //brwTop = (int)myDocImpl.getElementById(bodyId).getAttribute("scrollTop", 0);
                    if (i == 0)
                    {
                        myDocImpl.parentWindow.scrollBy(0, (screenHeight - 5) * i);// = height;
                    }
                    else
                    {
                        myDocImpl.parentWindow.scrollTo((screenWidth - 5) * myPageWidth, (screenHeight - 5) * i);
                    }
                    PrintWindow(hwnd, hdc, 0);
                    g.ReleaseHdc(hdc);
                    g.Flush();
                    screenfrag = Image.FromHbitmap(bm.GetHbitmap());
                    g2.DrawImage(screenfrag, brwLeft + URLExtraLeft, brwTop + URLExtraHeight);
                }
                ++myPageWidth;
            }


            //Reduce Resolution Size
            double   myResolution = Convert.ToDouble(1024) * 0.01;
            int      finalWidth   = (int)((widthsize + URLExtraLeft) * myResolution);
            int      finalHeight  = (int)((heightsize + URLExtraHeight) * myResolution);
            Bitmap   finalImage   = new Bitmap(finalWidth, finalHeight, System.Drawing.Imaging.PixelFormat.Format32bppRgb);
            Graphics gFinal       = Graphics.FromImage((Image)finalImage);

            gFinal.DrawImage(bm2, 0, 0, finalWidth, finalHeight);

            //Get Time Stamp
            DateTime myTime = DateTime.Now;
            String   format = "MM.dd.hh.mm.ss";

            //Create Directory to save image to.
            if (!Directory.Exists("C:\\IECapture"))
            {
                Directory.CreateDirectory("C:\\IECapture");
            }

            //Write Image.
            EncoderParameters eps = new EncoderParameters(1);
            long myQuality        = 75L;//Convert.ToInt64(cmbQuality.Text);

            eps.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, myQuality);
            ImageCodecInfo ici = GetEncoderInfo("image/jpeg");

            finalImage.Save(@"c:\\IECapture\Captured_" + myTime.ToString(format) + ".jpg", ici, eps);



            myDoc = null;
            g.Dispose();
            g2.Dispose();
            gFinal.Dispose();
            bm.Dispose();
            bm2.Dispose();
            finalImage.Dispose();
        }
Exemple #14
0
 private void FindAccount_Click(object sender, RoutedEventArgs e)
 {
     FindWindow findWindow = new FindWindow();  findWindow.ShowDialog();
 }