Esempio n. 1
0
 private static void StandaloneModeButton_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     Properties.Settings.Default.backup = "NONE";
     Properties.Settings.Default.Save();
     LogCtrl.Warning("Setting to Standalone Mode.");
     LogCtrl.Warning("Restart CueController now.");
 }
Esempio n. 2
0
    // 设置当前游戏状态;
    public bool SetActiveState(Int32 stateId, object param = null)
    {
        // 别闹;
        if (_currentState != null && _currentState.GetStateID() == stateId)
        {
            return(false);
        }
        GameState nextState = null;

        if (!_stateMap.TryGetValue(stateId, out nextState))
        {
            // 如果找不到新状态,就别切换了;
            LogCtrl.Error("切换游戏错误: 要切换的状态不存在 : " + stateId);
            return(false);
        }

        bool tryLeaveState = _currentState == null ? true : _currentState.TryLeaveState(nextState);
        bool tryEnterState = nextState.TryEnterState(_currentState);

        // 尝试离开或进入失败,则意味着,当前条件下,不允许切换(至于具体为什么,请查阅详细代码);
        if (!tryLeaveState || !tryEnterState)
        {
            return(false);
        }

        if (_currentState != null)
        {
            _currentState.LeaveState(nextState);
        }

        _preState     = _currentState;
        _currentState = nextState;
        _currentState.EnterState(_preState, param);
        return(true);
    }
Esempio n. 3
0
    /// <summary>
    /// 提取配置属性
    /// </summary>
    /// <returns>The prototype.</returns>
    /// <param name="prototypeID">Prototype I.</param>
    /// <typeparam name="T">The 1st type parameter.</typeparam>
    public T GetPrototype(int prototypeID)
    {
        T basePrototype = null;

        Type refType = typeof(T);

        Dictionary <int, T> table = GetPrototypeTable();

        if (table != null)
        {
            if (table.TryGetValue(prototypeID, out basePrototype))
            {
                if (basePrototype == null)
                {
                    return(null);
                }

                return(basePrototype);
            }
            else
            {
#if UNITY_EDITOR
                LogCtrl.Error("此表中没有此ID GetPrototype = " + refType.Name + "   prototypeID = " + prototypeID);
#else
                LogCtrl.Warn("此表中没有此ID GetPrototype = " + refType.Name + "   prototypeID = " + prototypeID);
#endif
            }
        }

        return(null);
    }
Esempio n. 4
0
        public static void SendMatrixCmd(MatrixCmd matrixCmd)
        {
            LogCtrl.Status(matrixCmd.description);
            Thread thread = new Thread(() => ExecuteMatrixCmd(matrixCmd));

            thread.Start();
        }
Esempio n. 5
0
        public JsonResult SetDistFinish(DistMasterModel distModel)
        {
            try
            {
                if (distModel.dist_idx == null)
                {
                    throw new Exception(Resources.Resource.res0219);                              /*잘못된 호출입니다*/
                }

                distModel.dist_st = "DF";

                Mapper.Instance().Update("DIST.udtDistMaster", distModel);

                Mapper.Instance().Update("DIST.udtDistReceiverStatus", new DistReceiverModel {
                    dist_idx = distModel.dist_idx, recv_dist_st = "DF"
                });

                DistMasterModel distMaster = Mapper.Instance().QueryForObject <DistMasterModel>("DIST.selDistMaster", new DistMasterModel {
                    dist_idx = distModel.dist_idx
                });

                LogCtrl.SetLog(distModel, eActionType.CompulsionExpire, this.HttpContext, distMaster.dist_title);

                return(Json("1"));
            }
            catch (Exception ex)
            {
                return(Json(new ResultJsonModel {
                    isError = true, resultMessage = ex.Message, resultDescription = ex.ToString()
                }));
            }
        }
Esempio n. 6
0
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            Core.SetWnd(this);
            CuelistCtrl.Init();
            FollowCtrl.Init();
            GoCtrl.Init();
            LogCtrl.Init();
            LogCtrl.Status("CueController 3.43b");
            MidiController.Init();
            MidiInputCtrl.Init();
            MidiOutputCtrl.Init();
            PbCtrl.Init();
            BeamerlistCtrl.Init();
            RecentFilesCtrl.Init();
            ReadWriteCtrl.Init();
            MatrixCtrl.Init();
            ScriptlistCtrl.Init();
            CopyCutCtrl.Init();
            OscCtrl.Init();
            OscListCtrl.Init();

            string[] args = Environment.GetCommandLineArgs();
            if (args.Length >= 2)
            {
                ReadWriteCtrl.Read(args[1]);
            }
        }
Esempio n. 7
0
        public ActionResult RecvView(int?dist_idx)
        {
            if (dist_idx == null)
            {
                return(RedirectToAction("ErrorView", "Error", Resources.Resource.res0270 /*잘못된 페이지를 호출하셨습니다*/));
            }

            var distModel = Mapper.Instance().QueryForObject <DistMasterModel>("Recv.selReciverDistInfo", new DistMasterModel {
                dist_idx = dist_idx, recv_us = Convert.ToInt32(Session["USER_IDX"])
            });
            var distEoModel = Mapper.Instance().QueryForObject <DistEoModel>("DIST.selDistEo", new DistEoModel {
                dist_idx = dist_idx
            });
            var distRecvFile = Mapper.Instance().QueryForList <DistRecvFileModel>("DIST.selDistRecvFile", new DistRecvFileModel {
                dist_idx = dist_idx, recv_us = Convert.ToInt32(Session["USER_IDX"]), use_fl = "Y"
            });
            var distRecieverInfo = Mapper.Instance().QueryForObject <DistReceiverModel>("DIST.selDistReceiver", new DistReceiverModel {
                dist_idx = dist_idx, recv_us = Convert.ToInt32(Session["USER_IDX"])
            });

            var eoBom = Mapper.Instance().QueryForList <ItfBomInfo>("Part.selPartBom", new ItfBomInfo {
                eo_idx = distModel.eo_idx
            });

            ViewBag.distModel        = distModel;
            ViewBag.distEoModel      = distEoModel;
            ViewBag.distRecvFile     = distRecvFile;
            ViewBag.eoBomList        = eoBom;
            ViewBag.distRecieverInfo = distRecieverInfo;
            LogCtrl.SetLog(distModel, eActionType.RecvView, this.HttpContext, distModel.dist_title);

            return(View());
        }
Esempio n. 8
0
 public static void LoadScripts(DataTable dataTable)
 {
     try
     {
         int x = 0;
         foreach (DataRow row in dataTable.Rows)
         {
             if (row.ItemArray.Length == 2)
             {
                 string   title  = row[0].ToString();
                 string   body   = row[1].ToString();
                 string[] lines  = body.Split('\n');
                 Script   script = new Script(title, lines, body);
                 editItems[x].Header    = (x + 1) + " " + script.title;
                 executeItems[x].Header = (x + 1) + " " + script.title;
                 scripts[x]             = script;
             }
             x++;
         }
     }
     catch (Exception e)
     {
         LogCtrl.Error("Couldn't load Scripts.");
         LogCtrl.Error(e.ToString());
     }
 }
Esempio n. 9
0
        public JsonResult SetCommCode(CommLibraryModel commcode)
        {
            try
            {
                int resultInt = 0;

                if (commcode.idx == null)
                {
                    commcode.create_us = Convert.ToInt32(Session["USER_IDX"]);

                    resultInt    = (int)Mapper.Instance().Insert("Common.insCommCode", commcode);
                    commcode.idx = resultInt;
                    LogCtrl.SetLog(commcode, eActionType.DataInsert, this.HttpContext, commcode.kor_nm);
                }
                else
                {
                    resultInt = Mapper.Instance().Update("Common.udtCommCode", commcode);
                    LogCtrl.SetLog(commcode, eActionType.DataUpdate, this.HttpContext, commcode.kor_nm);
                }

                return(Json(resultInt));
            }
            catch (Exception ex)
            {
                logger.Error(string.Format("ERROR : 공통코드 저장"), ex);
                return(Json(new ResultJsonModel {
                    isError = true, resultMessage = ex.Message, resultDescription = ex.ToString()
                }));
            }
        }
Esempio n. 10
0
 private static void SetIp(string _ip)
 {
     ip = _ip;
     Properties.Settings.Default.matrixIp = ip;
     Properties.Settings.Default.Save();
     LogCtrl.Status("Set Matrix IP: " + ip);
 }
Esempio n. 11
0
        public JsonResult SetVender(VendModel argModel)
        {
            try
            {
                int resultInt = 0;

                if (argModel.vend_idx == null)
                {
                    argModel.create_us = Convert.ToInt32(Session["USER_IDX"]);

                    resultInt         = (int)Mapper.Instance().Insert("User.insVender", argModel);
                    argModel.vend_idx = resultInt;
                    LogCtrl.SetLog(argModel, eActionType.DataInsert, this.HttpContext, argModel.vend_nm);
                }
                else
                {
                    resultInt = Mapper.Instance().Update("User.udtVender", argModel);
                    LogCtrl.SetLog(argModel, eActionType.DataUpdate, this.HttpContext, argModel.vend_nm);
                }

                return(Json(resultInt));
            }
            catch (Exception ex)
            {
                logger.Error(string.Format("ERROR : 협력사 저장"), ex);
                return(Json(new ResultJsonModel {
                    isError = true, resultMessage = ex.Message, resultDescription = ex.ToString()
                }));
            }
        }
Esempio n. 12
0
        public JsonResult SetDepartment(DeptModel SearchDept)
        {
            try
            {
                int resultInt = 0;

                if (SearchDept.dept_idx == null)
                {
                    SearchDept.create_us = Convert.ToInt32(Session["USER_IDX"]);
                    resultInt            = (int)Mapper.Instance().Insert("User.insDepartment", SearchDept);
                    SearchDept.dept_idx  = resultInt;
                    LogCtrl.SetLog(SearchDept, eActionType.DataInsert, this.HttpContext, SearchDept.dept_nm);
                }
                else
                {
                    resultInt = Mapper.Instance().Update("User.udtDepartment", SearchDept);
                    LogCtrl.SetLog(SearchDept, eActionType.DataUpdate, this.HttpContext, SearchDept.dept_nm);
                }

                return(Json(resultInt));
            }
            catch (Exception ex)
            {
                logger.Error(string.Format("ERROR : 부서저장"), ex);
                return(Json(new ResultJsonModel {
                    isError = true, resultMessage = ex.Message, resultDescription = ex.ToString()
                }));
            }
        }
 public void ReadFinish()
 {
     if (!EventExtension.InvokeGracefully(callBack))
     {
         LogCtrl.Error(" callBack Is Null ");
     }
 }
Esempio n. 14
0
        public ActionResult PdfViewer(int?link_file_idx, string is_itf)
        {
            string fileOrgName  = string.Empty;
            string fileConvName = string.Empty;
            string filePath     = string.Empty;

            if (is_itf == "N")
            {
                DistTempFileModel fileInfo = Mapper.Instance().QueryForObject <DistTempFileModel>("DIST.selDistTempFile", new DistTempFileModel {
                    temp_file_idx = link_file_idx
                });

                if (fileInfo == null)
                {
                    throw new Exception(Resources.Resource.res0320);//잘못된 파일을 호출하셨습니다.
                }

                fileOrgName  = fileInfo.file_org_nm;
                fileConvName = fileInfo.file_conv_nm;

                filePath = System.Configuration.ConfigurationManager.AppSettings["LocalFilePath"].ToString() + "\\" + fileInfo.dist_idx;

                LogCtrl.SetLog(fileInfo, eActionType.FileView, this.HttpContext, fileInfo.file_org_nm);
            }
            else
            {
                ItfFileInfo fileInfo = Mapper.Instance().QueryForObject <ItfFileInfo>("ITF.selItfFIleInfo", new ItfFileInfo {
                    file_idx = link_file_idx
                });

                if (fileInfo == null)
                {
                    throw new Exception(Resources.Resource.res0320);//잘못된 파일을 호출하셨습니다.
                }

                fileOrgName  = fileInfo.file_org_nm;
                fileConvName = fileInfo.file_conv_nm;

                filePath = System.Configuration.ConfigurationManager.AppSettings["EoFilePath"].ToString() + "\\" + fileInfo.part_no;

                LogCtrl.SetLog(fileInfo, eActionType.FileView, this.HttpContext, fileInfo.file_org_nm);
            }

            if (!CommonUtil.IsFile(filePath, fileConvName))
            {
                ViewBag.Massage = @Resources.Resource.res0366; // 파일이 없습니다.
                return(View());
            }

            PdfWatermark watermark     = new PdfWatermark();
            string       watermarkFile = watermark.SetWaterMarkPdf(filePath, fileConvName, Convert.ToInt32(Session["USER_IDX"]), CommonUtil.GetRemoteIP(this.Request));

            string fPath = System.Configuration.ConfigurationManager.AppSettings["ViewTempFileUrl"].ToString() + "/" + Path.GetFileName(watermarkFile);

            ViewBag.Massage  = null;
            ViewBag.FileName = fPath;
            return(View());
            //return View("PdfFileViewer" + (System.Web.HttpUtility.UrlEncode(fPath, System.Text.Encoding.GetEncoding("utf-8"))).Replace("+", "%20"));
        }
Esempio n. 15
0
        public JsonResult SetDistEoInfo(DistEoModel distEo)
        {
            try
            {
                bool isNew = distEo.dist_idx == null ? true : false;
                Mapper.Instance().BeginTransaction();
                // 신규
                if (isNew)
                {
                    distEo.dist_idx = SetDistMaster(new DistMasterModel()
                    {
                        eo_fl = "Y", dist_st = "CR", create_us = Convert.ToInt32(Session["USER_IDX"])
                    });
                    Mapper.Instance().Insert("DIST.insDistEo", distEo);
                }
                else
                {
                    DistEoModel compareEo = Mapper.Instance().QueryForObject <DistEoModel>("DIST.selDistEo", new DistEoModel()
                    {
                        dist_idx = distEo.dist_idx
                    });

                    // 기존 EO에 속한 파일이 있을 경우 지워버린다.
                    if (compareEo != null)
                    {
                        Mapper.Instance().Delete("DIST.delDistRecvEoFile", new DistRecvFileModel {
                            dist_idx = distEo.dist_idx, eo_idx = compareEo.eo_idx
                        });
                        Mapper.Instance().Update("DIST.udtDistEo", distEo);
                    }
                    else
                    {
                        Mapper.Instance().Insert("DIST.insDistEo", distEo);
                    }

                    SetUdtDistMaster(new DistMasterModel {
                        dist_idx = distEo.dist_idx
                    });
                }

                SetRecieverLinkFile(distEo.dist_idx);

                DistMasterModel dist = Mapper.Instance().QueryForObject <DistMasterModel>("DIST.selDistMaster", new DistMasterModel()
                {
                    dist_idx = distEo.dist_idx
                });

                LogCtrl.SetLog(distEo, eActionType.DistEoSave, this.HttpContext, dist.dist_title);
                Mapper.Instance().CommitTransaction();
                return(Json(distEo.dist_idx));
            }
            catch (Exception ex)
            {
                Mapper.Instance().RollBackTransaction();
                return(Json(new ResultJsonModel {
                    isError = true, resultMessage = ex.Message, resultDescription = ex.ToString()
                }));
            }
        }
 private void CheckIsFinish()
 {
     LogCtrl.Log("  读取配置表,剩余表数量  " + listTableInfos.Count);
     if (listTableInfos.Count == 0)
     {
         ReadFinish();
     }
 }
Esempio n. 17
0
 public override void EnterState(GameState preState, object param)
 {
     LogCtrl.Log("  进入 更新配置 状态 。。");
     ReadPrototypeManager.Instance.InitialPrototype(() =>
     {
         GameStateManager.Instance.SetActiveState(GameStateManager.STATE_START);
     });
 }
Esempio n. 18
0
 public static void Connect(string ip, int domain)
 {
     Auto.UnInitialize();
     Auto.InitializeTCP(ip, domain, true);
     LogCtrl.Status("Connecting to PB: " + ip + " (Domain " + domain + ")");
     Properties.Settings.Default.masterIp = ip;
     Properties.Settings.Default.domain   = domain;
     Properties.Settings.Default.Save();
 }
Esempio n. 19
0
        /// <summary>
        /// Загрузить настройки.
        /// </summary>
        /// <param name="storage">Хранилище настроек.</param>
        public void Load(SettingsStorage storage)
        {
            var settings = storage.GetValue <SettingsStorage>("LogControl");

            if (settings != null)
            {
                LogCtrl.Load(settings);
            }
        }
Esempio n. 20
0
        public int SetDistMaster(DistMasterModel distMaster)
        {
            int distIDX = (int)Mapper.Instance().Insert("DIST.insDistMaster", distMaster);

            LogCtrl.SetLog(new DistMasterModel {
                dist_idx = distIDX
            }, eActionType.DistInsert, this.HttpContext, distMaster.dist_title);
            return(distIDX);
        }
Esempio n. 21
0
 public void InitialTask(int type, int maxCount = 6)
 {
     if (mapTasks.ContainsKey(type))
     {
         LogCtrl.Error("Call GetFreeType Function  GetType. Error : " + type);
         return;
     }
     mapTasks.Add(type, CreateTaskData(type, maxCount));
 }
Esempio n. 22
0
 public void Addition(IEnumeratorTask task)
 {
     if (mlistTask.Contains(task))
     {
         LogCtrl.Warn("AddTask  Contains   Type : " + TaskType);
         return;
     }
     mlistTask.Add(task);
     TryExcuteNextTask();
 }
Esempio n. 23
0
        public static void procesaFacturacion(string pathFacturas, string pathAvon)
        {
            ExcelInterop oEI = new ExcelInterop();

            Worksheet xlWorkSheet;
            Workbook  xlWorkBook;

            lstTransTarifa = readTransporteTarifa();
            lstManioTarifa = readManiobraTarifa();
            LogCtrl.writeLog("Termina lectura de tarifas...");
            xlWorkBook = oEI.openBook(pathFacturas);
            LogCtrl.writeLog("Comienza lectura de facturas...");
            List <factura> lst = new List <factura>();

            for (int i = 1; i <= xlWorkBook.Worksheets.Count; i++)
            {
                try
                {
                    xlWorkSheet = (Worksheet)xlWorkBook.Worksheets.get_Item(i);
                    lst.Add(procesaHoja(xlWorkSheet));
                    xlWorkSheet = null;
                }
                catch (Exception e) {
                    LogCtrl.writeLog(e.Message);
                }
            }

            oEI.closeBook(xlWorkBook);
            Console.WriteLine("Lectura de facturas completa");


            #region Crea xls Avon

            xlWorkBook  = oEI.openBook(getPathFile("PlantillaAvon.xlsx"));
            xlWorkSheet = (Worksheet)xlWorkBook.Worksheets.get_Item(1);
            insertaParcialesColumnas(xlWorkSheet);//Inserta tantas columnas como el máximo número de parciales que se hayan registrado

            int fila = 2;
            foreach (factura item in lst)
            {
                try
                {
                    insertaFila(xlWorkSheet, fila, item);
                    fila++;
                }
                catch { }
            }
            Console.WriteLine("Escritura de facturas en la plantilla completa");

            oEI.saveXls(xlWorkBook, xlWorkSheet, pathAvon.Replace("/", @"\"));

            #endregion

            //Console.Read();
        }
Esempio n. 24
0
 public static void Shutter(int id, bool open)
 {
     foreach (BeamerCtrl b in beamers)
     {
         if (b.id == id)
         {
             b.Shutter(open);
             return;
         }
     }
     LogCtrl.Error("Beamer " + id + " doesn't exist.");
 }
Esempio n. 25
0
 private static void SetBackup()
 {
     isMain = false;
     if (!server.Init())
     {
         LogCtrl.Error("Can't set to Backup.");
     }
     else
     {
         server.Start();
         LogCtrl.Status("Set to Backup Mode.");
     }
 }
Esempio n. 26
0
 public void StartLoadRes(int count)
 {
     mRequest      = Resources.LoadAsync(AssetName);
     dateTimeOut   = DateTime.UtcNow.AddSeconds(TimeOut);
     curRetryCount = count;
     if (count == 0)
     {
         LogCtrl.Log(" 开始加载 资源 " + AssetName);
     }
     else
     {
         LogCtrl.Log(" 超时重试 加载 资源 " + AssetName + "  当前次数 " + count);
     }
 }
Esempio n. 27
0
        public ActionResult DistPdfViewer(int?dist_file_idx)
        {
            string fileOrgName  = string.Empty;
            string fileConvName = string.Empty;
            string filePath     = string.Empty;


            DistRecvFileModel distFile = Mapper.Instance().QueryForObject <DistRecvFileModel>("DIST.selDistRecvFile", new DistRecvFileModel {
                dist_file_idx = dist_file_idx, recv_us = Convert.ToInt32(Session["USER_IDX"])
            });

            if (distFile == null)
            {
                throw new Exception(Resources.Resource.res0320);//잘못된 파일을 호출하셨습니다.
            }

            if (distFile.recv_dist_st == "DF")
            {
                throw new Exception(Resources.Resource.res0297);//배포가 만료된 파일입니다.
            }

            fileOrgName  = distFile.file_org_nm;
            fileConvName = distFile.file_conv_nm;

            if (distFile.is_itf == "N")
            {
                filePath = System.Configuration.ConfigurationManager.AppSettings["LocalFilePath"].ToString() + "\\" + distFile.dist_idx;
            }
            else
            {
                filePath = System.Configuration.ConfigurationManager.AppSettings["EoFilePath"].ToString() + "\\" + distFile.part_no;
            }

            if (!CommonUtil.IsFile(filePath, fileConvName))
            {
                ViewBag.Massage = Resources.Resource.res0366; //파일이 없습니다.
                return(View());
            }

            PdfWatermark watermark     = new PdfWatermark();
            string       watermarkFile = watermark.SetWaterMarkPdf(filePath, fileConvName, Convert.ToInt32(Session["USER_IDX"]), CommonUtil.GetRemoteIP(this.Request));

            LogCtrl.SetLog(distFile, eActionType.FileView, this.HttpContext, distFile.file_org_nm);

            string fPath = System.Configuration.ConfigurationManager.AppSettings["ViewTempFileUrl"].ToString() + "/" + Path.GetFileName(watermarkFile);

            ViewBag.Massage  = null;
            ViewBag.FileName = fPath;
            return(View("PdfViewer"));
        }
Esempio n. 28
0
        public ActionResult BbsFileDownload(int?bbs_file_idx) //11
        {
            System.IO.Stream fStream      = null;
            string           fileOrgName  = string.Empty;
            string           fileConvName = string.Empty;
            string           filePath     = string.Empty;


            BbsFileModel bbsfile = Mapper.Instance().QueryForObject <BbsFileModel>("Bbs.selBbsFile", new BbsFileModel {
                bbs_file_idx = bbs_file_idx
            });

            if (bbsfile == null)
            {
                throw new Exception(Resources.Resource.res0320);//잘못된 파일을 호출하셨습니다.
            }
            //foreach () { }
            fileOrgName  = bbsfile.file_org_nm;
            fileConvName = bbsfile.file_conv_nm;
            filePath     = System.Configuration.ConfigurationManager.AppSettings["BbsFilePath"].ToString() + "\\" + bbsfile.bbs_idx;


            if (!CommonUtil.IsFile(filePath, fileConvName))
            {
                ViewBag.Massage = Resources.Resource.res0366; // 파일이 없습니다.
                return(View());
            }

            if (fileConvName.ToLower().Contains(".pdf"))
            {
                PdfWatermark watermark     = new PdfWatermark();
                string       watermarkFile = watermark.SetWaterMarkPdf(filePath, fileConvName, Convert.ToInt32(Session["USER_IDX"]), CommonUtil.GetRemoteIP(this.Request));
                fStream = CommonUtil.FileStream(watermarkFile);
            }
            else
            {
                fStream = CommonUtil.FileStream(filePath, fileConvName);
            }

            LogCtrl.SetLog(bbsfile, eActionType.FileDown, this.HttpContext, bbsfile.file_org_nm);

            if (Request.Browser.Browser == "IE" || Request.Browser.Browser == "InternetExplorer")
            {
                return(File(fStream, MediaTypeNames.Application.Octet, HttpUtility.UrlEncode(fileOrgName, System.Text.Encoding.UTF8)));
            }
            else
            {
                return(File(fStream, MediaTypeNames.Application.Octet, fileOrgName));
            }
        }
Esempio n. 29
0
 public void Start()
 {
     try
     {
         udpThread = new Thread(StartReceive);
         udpThread.Start();
     }
     catch (Exception e)
     {
         LogCtrl.Error("Couldn't start Go Listener thread!");
         LogCtrl.Error(e.Message);
         udpThread.Abort();
     }
 }
Esempio n. 30
0
        private void StartReceive()
        {
            try
            {
                while (!_shouldStop)
                {
                    data = client.Receive(ref sender);
                    string[] message = Encoding.ASCII.GetString(data, 0, data.Length).Split(' ');
                    if (message.Length == 2)
                    {
                        int cueNr;
                        if (int.TryParse(message[1], out cueNr))
                        {
                            switch (message[0])
                            {
                            case "GO":
                                Application.Current.Dispatcher.Invoke(new Action(() =>
                                {
                                    GoCtrl.Go(cueNr);
                                }));
                                break;

                            case "BACK":
                                Application.Current.Dispatcher.Invoke(new Action(() =>
                                {
                                    GoCtrl.GoBack();
                                }));
                                break;
                            }
                        }
                    }
                }
            }
            catch (SocketException se)
            {
                if (se.SocketErrorCode == SocketError.TimedOut)
                {
                    Start();
                }
                else
                {
                    Application.Current.Dispatcher.Invoke(new Action(() =>
                    {
                        LogCtrl.Error("Backup listener thread crashed!");
                        LogCtrl.Error(se.Message);
                    }));
                }
            }
        }