public void setup() { db = new Mock <IShareLabelMonitorDB>(); fac = new Mock <IShareTaskFactory>(); monitor = new ShareLabelMonitor(db.Object, fac.Object); }
public StationServer() { // ----- notify icon and controller ----- m_notifyIcon = new NotifyIcon(); m_notifyIconController = new NotifyIconController(m_notifyIcon, this); initNotifyIconAndController(); // ----- notify icon menu refresh ---- m_NotifyTimer = new Timer(); m_NotifyTimer.Tick += (s, e) => { m_notifyIconController.refreshNotifyIconContextMenu(); }; m_NotifyTimer.Interval = 200; // ----- auto label ------ m_autoLabel = new AutoLabelController(); InfiniteStorageWebSocketService.FileReceived += ProgressTooltip.Instance.OnFileEnding; InfiniteStorageWebSocketService.FileReceived += m_autoLabel.FileReceived; // ----- pair ----- InfiniteStorageWebSocketService.PairingRequesting += InfiniteStorageWebSocketService_PairingRequesting; Pair.PairWebSocketService.PairingModeChanging += PairWebSocketService_PairingModeChanging; Pair.PairWebSocketService.NewDeviceAccepting += PairWebSocketService_NewDeviceAccepting; Pair.PairWebSocketService.NewDeviceRejecting += PairWebSocketService_NewDeviceRejecting; // ----- backup status timer ----- m_pingTimer = new NoReentrantTimer(pingPeerToCheckConnection, null, 3000, 10000); m_pingTimer.Start(); // ----- notifier ----- m_notifier = new Notifier(); NotifyWebSocketService.Subscribing += m_notifier.OnSubscribing; NotifyWebSocketService.Disconnected += m_notifier.OnChannelDisconnected; // ----- rest server ----- rest_server = new HttpServer(14005); rest_server.AddHandler("/image/", new ImageApiHandler()); rest_server.AddHandler("/label/list_all", new LabelListApiHandler()); rest_server.AddHandler("/label/tag", new LabelTagApiHandler()); rest_server.AddHandler("/label/untag", new LabelUntagApiHandler()); rest_server.AddHandler("/label/clear", new LabelClearApiHandler()); rest_server.AddHandler("/label/rename", new LabelRenameApiHandler()); rest_server.AddHandler("/label/add", new LabelAddApiHandler()); rest_server.AddHandler("/label/delete", new LabelDeleteApiHandler()); rest_server.AddHandler("/label/get", new LabelGetApiHandler()); rest_server.AddHandler("/label/on_air", new LabelOnAirApiHandler()); rest_server.AddHandler("/label/share", new LabelShareApiHandler()); rest_server.AddHandler("/label/invite", new LabelInviteApiHandler()); rest_server.AddHandler("/file/get", new FileGetApiHandler()); rest_server.AddHandler("/pending/get", new PendingGetApiHandler()); rest_server.AddHandler("/pending/sort", new PendingSortApiHandler()); rest_server.AddHandler("/label_cover", new LabelCoverApiHandler()); m_ReRegBonjourTimer = new NoReentrantTimer(reregisterBonjour, null, 60 * 1000, 60 * 1000); // ----- remove out of date labels ---- m_recentLabelTimer = new NoReentrantTimer(removeOutOfDateLabels, null, 5000, 10 * 60 * 1000); // ----- ConnectedClientCollection ----- InfiniteStorageWebSocketService.DeviceAccepted += (s, e) => { ConnectedClientCollection.Instance.Add(e.ctx); }; InfiniteStorageWebSocketService.DeviceDisconnected += (s, e) => { ConnectedClientCollection.Instance.Remove(e.ctx); }; m_autoUpdate = new AutoUpdate(false); ProgramIPC.Instance.OnWinMsg += (s, e) => { if (e.Message == ProgramIPC.MsgShowTooltip) { showProgramIsAtServiceBallonTips(); } }; m_thumbnailCreator = new ThumbnailCreator(); m_shareMonitor = new ShareLabelMonitor(); postServiceLibrary.postServiceClass.serverBaseUrl = ProgramConfig.FromApiBase("v3"); }