Ejemplo n.º 1
0
 internal static void window_changed(Window_Info info)
 {
     if (Active_Window_Changed != null)
     {
         Active_Window_Changed.Invoke(info);
     }
 }
Ejemplo n.º 2
0
        public virtual bool match(Window_Info info)
        {
            foreach (string process_name in processes)
            {
                Process process = Process.GetProcessById(info.process_id);
                if (process.ProcessName.ToLower() == process_name.ToLower() ||
                    (process.ProcessName.Length > process_name.Length &&
                     process.ProcessName.Substring(0, process_name.Length) == process_name
                    ))
                {
                    last_window = info;
                    return(true);
                }
            }

            foreach (Regex pattern in title_patterns)
            {
                if (pattern.Match(info.title).Success)
                {
                    last_window = info;
                    return(true);
                }
            }

            foreach (Regex pattern in class_patterns)
            {
                if (pattern.Match(info.class_name).Success)
                {
                    last_window = info;
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 3
0
 private void MenuItem_Info_Click(object sender, RoutedEventArgs e)
 {
     if (SelectedPosition >= 0)
     {
         Window_Info window_Info = new Window_Info(output);
         window_Info.Show();
     }
 }
Ejemplo n.º 4
0
        void Automation_Active_Window_Changed(Window_Info info)
        {
            return;

            AutomationElement element = AutomationElement.FromHandle(info.handle);

            //    Threading.start_new_thread(this, "update", new object[] {element});
            //update();
            //       get_text(element);
        }
Ejemplo n.º 5
0
        private bool window_match(Sentence result, Window_Info info)
        {
            foreach (Token parameter in result.parameters["words"])
            {
                if (!info.title.ToLower().Contains(parameter.text.ToLower()))
                {
                    return(false);
                }
            }

            Windows.set_foreground_window(info.handle);
            Windows.bring_window_to_front(info.handle);

            return(true);
        }
Ejemplo n.º 6
0
        protected void on_window_changed(Window_Info window_info)
        {
            var process = System.Diagnostics.Process.GetProcessById(window_info.process_id);

            if (process.ProcessName == "devenv")
            {
                if (window_info.class_name == "wndclass_desked_gsk")
                {
                    studio = (DTE2)SilentOrb.Utility.Windows.SeekObjectInstanceFromROT("!VisualStudio.DTE.9.0:" + window_info.process_id.ToString());
                }
                else
                {
                    studio = (DTE2)SilentOrb.Utility.Windows.SeekObjectInstanceFromROT("!VisualStudio.DTE.10.0:" + window_info.process_id.ToString());
                }
            }
        }
Ejemplo n.º 7
0
        public override bool match(Window_Info info)
        {
            //Window_Info info = Windo
            //Control control= Control.FromChildHandle(info2.handle);

            if (processes.Count > 0)
            {
                bool progress = false;
                foreach (string process_name in processes)
                {
                    Process process = Process.GetProcessById(info.process_id);
                    if (process.ProcessName == process_name)
                    {
                        progress = true;
                        break;
                    }
                }

                if (!progress)
                {
                    return(false);
                }
            }

            List <Window_Info> children = Windows.enum_child_windows(info.handle);

            foreach (Window_Info child in children)
            {
                foreach (Regex pattern in title_patterns)
                {
                    if (pattern.Match(child.title).Success)
                    {
                        return(true);
                    }
                }

                foreach (Regex pattern in class_patterns)
                {
                    if (pattern.Match(child.class_name).Success)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Ejemplo n.º 8
0
        //protected override void OnFormClosing(FormClosingEventArgs e)
        //{
        //    base.OnFormClosing(e);
        //    UnregisterFromSystemEvents();
        //}

        private void timer_Tick(Object sender, EventArgs e)
        {
            if (Global.thread_busy)
            {
                return;
            }
            //          Program.debug_string += "(";

            lock (Global.thread_control)
            {
                Window_Info current_window = Windows.GetForegroundWindow();
                if (current_window.title != active_window.title && current_window.handle != (IntPtr)0)
                {
                    active_window = current_window;
                    Automation.window_changed(active_window);
                    text_active_window.Text = active_window.class_name;
                }
            }
        }
Ejemplo n.º 9
0
        public void Active_Application_Changed(Window_Info window_info)
        {
            foreach (Context setting in applications.Values)
            {
                if (setting.match(window_info))
                {
                    if (active_profile != setting)
                    {
                        setting.Activate();
                    }

                    //      mainwindow.manager.send("set_title", "Speech Familiar - " + active_profile.name + "--" + window_info.title);

                    return;
                }
            }
            //      mainwindow.manager.send("set_title", "Speech Familiar - " + active_profile.name + "--" + window_info.title);

            if (applications.ContainsKey("global") && active_profile != applications["global"])
            {
                applications["global"].Activate();
            }
        }