private void ApplicationPathChanged(IntPtr hWnd)
        {
            StringBuilder buff = new StringBuilder(256);

            Win32.GetClassName(hWnd, buff, 256);
            string wndName = buff.ToString();

            Win32.GetWindowText(hWnd, buff, 256);
            string wndText = buff.ToString();

            Debug.WriteLine(string.Format("AppPathChanged hWnd: {0} ClassName: {1} WindowText: {2}", hWnd, wndName, wndText));

            if (AppGroupOptions.IsTaskbar(wndName))
            {
                m_tempGesture.Action = new AppGroupOptions(AppGroupOptions.APP_GROUP_TASKBAR);
                tB_name.Text         = tB_path.Text = Languages.Translation.GetText(m_tempGesture.Action.Name);
                pB_icon.Image        = m_tempGesture.Action.GetIcon(pB_icon.Width);
            }
            else if (AppGroupOptions.IsDesktop(wndName))
            {
                m_tempGesture.Action = new AppGroupOptions(AppGroupOptions.APP_GROUP_DESKTOP);
                tB_name.Text         = tB_path.Text = Languages.Translation.GetText(m_tempGesture.Action.Name);
                pB_icon.Image        = m_tempGesture.Action.GetIcon(pB_icon.Width);
            }
            else
            {
                m_tempGesture.Action = new AppGroupOptions(AppGroupOptions.APP_GROUP_USERS);
                string path = AppGroupOptions.GetPathFromHwnd(hWnd);
                tB_path.Text = path;
                tB_name.Text = Path.GetFileNameWithoutExtension(path); //ExtractName(path);
                if (path != string.Empty)
                {
                    pB_icon.Image = Icon.ExtractAssociatedIcon(path).ToBitmap();
                }
                else
                {
                    pB_icon.Image = null;
                }
            }
            SetValues();
        }
Beispiel #2
0
        private static BaseActionClass InitializeAction(string category, string actionName)
        {
            BaseActionClass action = null;

            switch (category)
            {
            case InternetOptions.NAME:
                if (category != actionName)
                {
                    action = new InternetOptions(actionName);
                }
                else
                {
                    action = new InternetOptions();
                }
                break;

            case WinampOptions.NAME:
                if (category != actionName)
                {
                    action = new WinampOptions(actionName);
                }
                else
                {
                    action = new WinampOptions();
                }
                break;

            case MediaControl.NAME:
                if (category != actionName)
                {
                    action = new MediaControl(actionName);
                }
                else
                {
                    action = new MediaControl();
                }
                break;

            case WindowOptions.NAME:
                if (category != actionName)
                {
                    action = new WindowOptions(actionName);
                }
                else
                {
                    action = new WindowOptions();
                }
                break;

            case WindowsShell.NAME:
                if (category != actionName)
                {
                    action = new WindowsShell(actionName);
                }
                else
                {
                    action = new WindowsShell();
                }
                break;

            case KeystrokesOptions.NAME:
                if (category != actionName)
                {
                    action = new KeystrokesOptions(actionName);
                }
                else
                {
                    action = new KeystrokesOptions();
                }
                break;

            case SpecialOptions.NAME:
                if (category != actionName)
                {
                    action = new SpecialOptions(actionName);
                }
                else
                {
                    action = new SpecialOptions();
                }
                break;

            case AppGroupOptions.NAME:
                if (category != actionName)
                {
                    action = new AppGroupOptions(actionName);
                }
                else
                {
                    action = new AppGroupOptions();
                }
                break;

            case ExtrasOptions.NAME:
                if (category != actionName)
                {
                    action = new ExtrasOptions(actionName);
                }
                else
                {
                    action = new ExtrasOptions();
                }
                break;

            case VolumeOptions.NAME:
                if (category != actionName)
                {
                    action = new VolumeOptions(actionName);
                }
                else
                {
                    action = new VolumeOptions();
                }
                break;

            default:
                //if (category != actionName)
                //    action = new BaseActionClass(actionName);
                //else
                action = new BaseActionClass();
                break;
            }
            return(action);
        }