public MPCAPI(MainWindow main) { m_MainWindow = main; m_hWnd = new WindowInteropHelper(m_MainWindow).Handle; m_Source = HwndSource.FromHwnd(m_hWnd); m_Source.AddHook(WndProc); AniDBAPI.AppendDebugLine("MPC-HC hook added"); using (Process MPC = new Process()) { MPC.StartInfo = new ProcessStartInfo(ConfigFile.Read("mpcPath").ToString(), String.Format("/slave {0}", m_hWnd.ToInt32())); MPC.Start(); m_mpcProcID = MPC.Id; } m_PlayTimer = new DispatcherTimer(); m_PlayTimer.Interval = TimeSpan.FromMilliseconds(1000); m_PlayTimer.Tick += delegate { ++m_currentFileTick; SendData(MPCAPI_SENDCOMMAND.CMD_GETCURRENTPOSITION, String.Empty); }; }
private void RemoveHook() { SetTitle(MainWindow.m_AppName); m_Source.RemoveHook(WndProc); isHooked = false; AniDBAPI.AppendDebugLine("MPC-HC hook removed"); }
private void RemoveFromList_Click(object sender, RoutedEventArgs e) { FileEntry fEntry = (FileEntry)(sender as MenuItem).Tag; if (m_aniDBAPI.MyListDel(fEntry.lid)) { if (!String.IsNullOrEmpty(fEntry.path)) { AniDBAPI.AppendDebugLine(String.Format("Removed {0} from mylist.", Path.GetFileName(fEntry.path))); } m_myList.DeleteFile(fEntry.lid); MylistTreeListView.Refresh(); } }
public MainWindow(AniDBAPI api) { m_aniDBAPI = api; AniDBAPI.AppendDebugLine("Welcome to AniDBmini, connected to: " + m_aniDBAPI.APIServer); InitializeComponent(); SetMylistVisibility(); m_mpcProcWatcher = new MPCProcWatcher(); m_mpcProcWatcher.OnMPCStarted += new MPCStartedHandler(OnMPCStarted); m_mpcProcWatcher.StartUp(); mylistStats.ItemsSource = mylistStatsList; debugListBox.ItemsSource = m_aniDBAPI.DebugLog; hashingListBox.ItemsSource = hashFileList; animeTabControl.ItemsSource = animeTabList; animeTabList.OnCountChanged += new CountChangedHandler(animeTabList_OnCountChanged); m_aniDBAPI.OnFileHashingProgress += new FileHashingProgressHandler(OnFileHashingProgress); m_aniDBAPI.OnAnimeTabFetched += new AnimeTabFetchedHandler(OnAnimeTabFetched); m_aniDBAPI.OnFileInfoFetched += new FileInfoFetchedHandler(OnFileInfoFetched); }