コード例 #1
0
ファイル: SideBar.cs プロジェクト: ideadreamDefy/Defy
        public void Initailize(SideBarMode mode, Messager messager)
        {
            sideBarMode = mode;
            this.messager = messager;

            HideParts(mode);
            UpdateChatBoxHeight();
        }
コード例 #2
0
 static void createClient(Messager<SessionData3> messager)
 {
     Console.WriteLine("createClient");
     messager.Connect(new Ceeji.Network.IPEndPoint(IPAddress.Loopback, 8080), (sender, session, ex) => {
         if (session != null) {
             sendAddOrClose(session);
         }
     });
 }
コード例 #3
0
        static void messager1_DataReceived(Messager<SessionData3> sender, Session<SessionData3> e, ArraySegment<byte> dataSegment)
        {
            var data = Encoding.Default.GetString(dataSegment.Array, dataSegment.Offset, dataSegment.Count);
            Console.WriteLine("[messager1_DataReceived], " + data);

            var num = data.Split(',').Select(x => int.Parse(x)).ToArray();
            Console.WriteLine("[messager1_DataSend], " + (num[0] + num[1]).ToString());
            e.Send((num[0] + num[1]).ToString());
        }
コード例 #4
0
 private void LoginExecute()
 {
     UserProfile loginProfile = _securityService.Login(UserName, Password);
     if (loginProfile !=null)
     {
         MessengerInstance.Send<UserProfile>(loginProfile);
     }
     else
     {
         LoginMessage = new Messager("Failed to Login", MessageState.Error);
     }
 }
コード例 #5
0
        static void messager_DataReceived(Messager<SessionData> sender, Session<SessionData> e, ArraySegment<byte> dataSegment)
        {
            var sr = new StreamReader(new MemoryStream(dataSegment.Array, dataSegment.Offset, dataSegment.Count));
            var data = sr.ReadToEnd();
            var binary = Encoding.UTF8.GetBytes(data.Replace("Host: 127.0.0.1:8080", "Host: ceeji.net"));
            dataSegment = new ArraySegment<byte>(binary, 0, binary.Length);

            lock (e.Data) {
                if (e.Data.Buffer == null) {
                    e.Data.Buffer = new byte[dataSegment.Count];
                    Array.Copy(dataSegment.Array, dataSegment.Offset, e.Data.Buffer, 0, dataSegment.Count);
                }
                else {
                    var newBuf = new byte[e.Data.Buffer.Length + dataSegment.Count];
                    e.Data.Buffer.CopyTo(newBuf, 0);
                    Array.Copy(dataSegment.Array, dataSegment.Offset, newBuf, e.Data.Buffer.Length, dataSegment.Count);
                    e.Data.Buffer = newBuf;
                }
            }

            /*var ret = @"HTTP/1.1 200 OK
            Server: nginx/1.8.0
            Date: Fri, 26 Jun 2015 07:34:02 GMT
            Content-Type: text/html; charset=utf-8
            Content-Length: 40
            Connection: keep-alive
            Cache-Control: private

            <!DOCTYPE html><html>hello, world</html>";

            e.Send(Encoding.Default.GetBytes(ret));

            return;*/
            Action sendAction = () => {
                e.Data.Messager.Send(e.Data.Connection, new ArraySegment<byte>(e.Data.Buffer, 0, e.Data.Buffer.Length));
                e.Data.Buffer = null;
            };

            if (e.Data.Messager == null || e.Data.Messager.Status != MessagerStatus.Connected) {
                // 还没有初始化完成,先缓冲

                Console.WriteLine("!!");
            }
            else {
                sendAction();
            }
        }
コード例 #6
0
ファイル: MainForm.cs プロジェクト: sakpung/webstudy
        /// <summary>
        /// Save the current image with stamp
        /// </summary>
        private void _miFileSaveWithStamp_Click(object sender, System.EventArgs e)
        {
            try
            {
                // take the destination JPEG file name
                SaveFileDialog sfd = new SaveFileDialog();
                // the destination image format should be JPEG.
                sfd.Filter = "JPEG(*.jpg;*.jpeg)|*.jpg;*.jpeg";
                if (sfd.ShowDialog(this) == DialogResult.OK)
                {
                    // Enable saving with stamp
                    _codecs.Options.Jpeg.Save.SaveWithStamp     = true;
                    _codecs.Options.Jpeg.Save.StampBitsPerPixel = 24;

                    // Calculate the stamp size (fit it in a 128 by 128 pixels)
                    LeadRect rc = RasterImage.CalculatePaintModeRectangle(
                        _viewerImage.Image.ImageWidth,
                        _viewerImage.Image.ImageHeight,
                        new LeadRect(0, 0, 128, 128),
                        RasterPaintSizeMode.Fit,
                        RasterPaintAlignMode.Near,
                        RasterPaintAlignMode.Near);

                    _codecs.Options.Jpeg.Save.StampWidth  = rc.Width;
                    _codecs.Options.Jpeg.Save.StampHeight = rc.Height;

                    // save the image as JPEG with stamp with the closest bits per pixel
                    _codecs.Save(_viewerImage.Image, sfd.FileName, RasterImageFormat.Jpeg, 0);
                }
            }
            catch (Exception ex)
            {
                Messager.ShowError(this, ex);
            }
            finally
            {
                UpdateMyControls();
            }
        }
コード例 #7
0
ファイル: MainForm.cs プロジェクト: sakpung/webstudy
        private void startToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (!_server.IsRunning)
                {
                    //EventLogger_EventLog
                    Leadtools.Jpip.Logging.EventLogger.EventLog += new EventHandler <Leadtools.Jpip.Logging.EventLogEntry>(EventLogger_EventLog);
                    _server.RequestReceived += new EventHandler <RequestReceivedEventArgs> (_server_RequestReceived);
                    _server.ResponseSending += new EventHandler <ResponseSendingEventArgs> (_server_ResponseSending);
                    _server.Start( );

                    if (_server.Configuration.IPAddress != _service.IpAddress.ToString( ))
                    {
                        if (_service.Running)
                        {
                            _service.Stop( );
                        }

                        _service.IpAddress = System.Net.IPAddress.Parse(_server.Configuration.IPAddress);
                    }

                    if (!_service.Running)
                    {
                        _service.Start( );
                    }
                }

                UpdateUIMenuStsate( );
            }
            catch (Exception exception)
            {
                Leadtools.Jpip.Logging.EventLogger.EventLog -= new EventHandler <Leadtools.Jpip.Logging.EventLogEntry>(EventLogger_EventLog);
                _server.RequestReceived -= new EventHandler <RequestReceivedEventArgs> (_server_RequestReceived);
                _server.ResponseSending -= new EventHandler <ResponseSendingEventArgs> (_server_ResponseSending);

                Messager.ShowError(this, exception);
            }
        }
コード例 #8
0
        private Dictionary <string, MoveServer> LoadMoveFailures(string failureDirectory)
        {
            Dictionary <string, MoveServer> failures = new Dictionary <string, MoveServer>();
            IEnumerable <FileInfo>          files    = FileSearcher.GetFiles(new DirectoryInfo(failureDirectory), "move*.fail", SearchOption.TopDirectoryOnly);

            foreach (FileInfo file in files.OrderBy(f => f.CreationTime))
            {
                try
                {
                    MoveServer server = Utils.LoadFromXml <MoveServer>(file.FullName);

                    server.FileName = file.FullName;
                    failures.Add(file.FullName, server);
                }
                catch (Exception e)
                {
                    Messager.ShowError(_View as Form, e);
                }
            }

            return(failures);
        }
コード例 #9
0
 private void SaveImage()
 {
     if (_imageViewer.Image != null)
     {
         try
         {
             SaveFileDialog dlg = new SaveFileDialog();
             dlg.Filter = "PNG | *.png";
             if (dlg.ShowDialog() == DialogResult.OK)
             {
                 using (RasterCodecs codecs = new RasterCodecs())
                 {
                     codecs.Save(_imageViewer.Image, dlg.FileName, RasterImageFormat.Png, 0);
                 }
             }
         }
         catch (Exception ex)
         {
             Messager.ShowError(this, ex);
         }
     }
 }
        void browseDbButton_Click(object sender, EventArgs e)
        {
            FileDialog databaseFileDlg;


            if (Mode == DbConfigurationMode.Configure)
            {
                databaseFileDlg = openFileDialog1;

                //openFileDialog1.CheckFileExists = true ;
                //openFileDialog1.CheckPathExists = true ;
            }
            else
            {
                databaseFileDlg = saveFileDialog1;
                //openFileDialog1.CheckFileExists = false ;
                //openFileDialog1.CheckPathExists = false ;
            }

            databaseFileDlg.FileName = databaseTextBox.Text;

            if (databaseTextBox.Text.Length > 0)
            {
                databaseFileDlg.InitialDirectory = Path.GetDirectoryName(databaseTextBox.Text);
            }


            if (databaseFileDlg.ShowDialog( ) == DialogResult.OK)
            {
                if (IsUncPath(databaseFileDlg.FileName))
                {
                    Messager.ShowError(this, "You can't connect to SQL Server CE database located on remote machine. Use a local machine database or choose another database source option.");

                    return;
                }

                databaseTextBox.Text = databaseFileDlg.FileName;
            }
        }
コード例 #11
0
ファイル: MainForm.cs プロジェクト: sakpung/webstudy
        private void LoadImage(string fileName)
        {
            RasterImage newImage = null;

            // Try to load the new image
            if (fileName != null)
            {
                try
                {
                    using (RasterCodecs codecs = new RasterCodecs())
                    {
                        using (WaitCursor wait = new WaitCursor())
                        {
                            newImage = codecs.Load(fileName, 0, CodecsLoadByteOrder.BgrOrGray, 1, 1);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Messager.ShowFileOpenError(this, fileName, ex);
                    return;
                }
            }

            _overlayRect       = LeadRect.Empty;
            _imageViewer.Image = newImage;

            if (fileName != null)
            {
                Text = string.Format("{0} - {1}", Messager.Caption, fileName);
            }
            else
            {
                Text = Messager.Caption;
            }

            UpdateImageInfo();
            UpdateUIState();
        }
コード例 #12
0
 void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
 {
     try
     {
         if (e.Node.Tag is Control)
         {
             SelectNodeControl(e.Node);
             Control c = e.Node.Tag as Control;
             if (validLicense == false)
             {
                 if (!(c is GeneralSettingsView))
                 {
                     c.Enabled = false;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Messager.ShowError(this, ex);
     }
 }
コード例 #13
0
        private void OpenImageFile()
        {
            // Open an image file from disk and put it in the viewer
            ImageFileLoader loader = new ImageFileLoader();

            loader.OpenDialogInitialPath = _openInitialPath;

            try
            {
                loader.ShowLoadPagesDialog = true;

                if (loader.Load(this, _codecs, true) > 0)
                {
                    _openInitialPath = Path.GetDirectoryName(loader.FileName);
                    SetViewerImage(loader.FileName, loader.Image, Path.GetFileName(loader.FileName));
                }
            }
            catch (Exception ex)
            {
                Messager.ShowFileOpenError(this, loader.FileName, ex);
            }
        }
コード例 #14
0
        public static bool Login(string info, bool relogin)
        {
            try
            {
                IOptionsDataAccessAgent optionsAgent    = DataAccessServices.GetDataAccessService <IOptionsDataAccessAgent>();
                PasswordOptions         passwordOptions = optionsAgent.Get <PasswordOptions>("PasswordOptions", new PasswordOptions());

                LoginDialog dlgLogin = new LoginDialog(passwordOptions.LoginType);
                Process     process  = Process.GetCurrentProcess();
                string      lastUser = optionsAgent.Get <string>("LastUser", string.Empty);
                bool        lastLoginUseCardReader = optionsAgent.Get <bool>("LastLoginUseCardReader", false);

                dlgLogin.Text            = Shell.storageServerName + " Login";
                dlgLogin.Info            = info;
                dlgLogin.RegularUsername = lastUser;

                if (passwordOptions.LoginType == LoginType.Both)
                {
                    dlgLogin.UseCardReaderCheckBox = lastLoginUseCardReader;
                }
                dlgLogin.CanSetUserName    = !relogin;
                dlgLogin.AuthenticateUser += new EventHandler <AuthenticateUserEventArgs>(dlgLogin_AuthenticateUser);
                if (dlgLogin.ShowDialog(new WindowWrapper(process.MainWindowHandle)) == DialogResult.OK)
                {
                    UserManager.User = new ManagerUser(dlgLogin.GetUserName(), dlgLogin.GetFriendlyName(), UserManager.GetUserPermissions(dlgLogin.GetUserName()));

                    optionsAgent.Set <bool>("LastLoginUseCardReader", dlgLogin.UseCardReaderCheckBox);

                    LoadSplash();
                    return(true);
                }
                return(false);
            }
            catch (Exception ex)
            {
                Messager.ShowError(null, ex);
                return(false);
            }
        }
コード例 #15
0
        private void comboBoxRight_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (comboBoxConfigs.SelectedIndex < 0 || comboBoxRight.SelectedIndex < 0)
                {
                    return;
                }

                OrientationAxis  orientation = (OrientationAxis)comboBoxRight.SelectedItem;
                PlaneOrientation po          = comboBoxConfigs.SelectedItem as PlaneOrientation;

                labelLeft.Text = GetOppositeOrientation(orientation).ToString();
                po.Right       = orientation;
                CheckTop(orientation);
                _OldRightOrientation = orientation;
            }
            catch (Exception exception)
            {
                Messager.ShowError(this, exception);
            }
        }
コード例 #16
0
ファイル: MainForm.cs プロジェクト: sakpung/webstudy
        private void LoadPDFFile(string fileName)
        {
            try
            {
                using (RasterCodecs codecs = new RasterCodecs())
                {
                    codecs.Options.RasterizeDocument.Load.XResolution = 300;
                    codecs.Options.RasterizeDocument.Load.YResolution = 300;
                    codecs.Options.Pdf.Load.HideFormFields            = true;

                    if (_pdfDocument != null)
                    {
                        _pdfDocument.Dispose();
                        _pdfDocument = null;
                    }

                    _pdfDocument = new PDFDocument(fileName);

                    PDFParseDocumentStructureOptions _parseDocumentStructOptions = PDFParseDocumentStructureOptions.InternalLinks | PDFParseDocumentStructureOptions.Bookmarks;

                    _pdfDocument.ParseDocumentStructure(_parseDocumentStructOptions);

                    PDFDocumentHelper.LoadPDFDocument(codecs, _pdfDocument, _imageList);

                    // Reset current page index value.
                    _currentPageIndex = 0;

                    _imageList.Items[_currentPageIndex].IsSelected = true;
                }
            }
            catch (Exception ex)
            {
                Messager.ShowError(this, ex.Message);
            }
            finally
            {
                UpdateControls();
            }
        }
コード例 #17
0
        private void _btnOk_Click(object sender, System.EventArgs e)
        {
            if (_numLow.Value >= _numHigh.Value)
            {
                Messager.ShowWarning(this, _lblMsg.Text);
                DialogResult = DialogResult.None;
                return;
            }

            Low  = (int)_numLow.Value;
            High = (int)_numHigh.Value;

            ChannelType ct = (ChannelType)_cbChannel.SelectedItem;

            Channel = ct.Flags;

            _initialLow      = Low;
            _initialHigh     = High;
            _initialInColor  = InColor;
            _initialOutColor = OutColor;
            _initialChannel  = 0;
        }
コード例 #18
0
ファイル: MergeDialog.cs プロジェクト: sakpung/webstudy
        private void _btnOk_Click(object sender, EventArgs e)
        {
            _checkedImgsCount = 0;
            for (int i = 0; i < _cLbImages.Items.Count; i++)
            {
                if (_cLbImages.GetItemChecked(i))
                {
                    _checkedImgsCount++;
                }
            }

            if (_maxImgNum != _checkedImgsCount)
            {
                Messager.ShowWarning(this, string.Format("For this Merg type you must select {0} images exactly", _maxImgNum));
                DialogResult = DialogResult.None;
                return;;
            }

            if (_mergeImage != null)
            {
                _mergeImage.Dispose();
            }
            for (int i = 0; i < _cLbImages.Items.Count; i++)
            {
                if (_cLbImages.GetItemChecked(i))
                {
                    if (_mergeImage == null)
                    {
                        _mergeImage = _images[i].Image.Clone();
                    }
                    else
                    {
                        _mergeImage.AddPages(new RasterImage(_images[i].Image), 1, 1);
                    }
                }
            }

            DialogResult = DialogResult.OK;
        }
コード例 #19
0
    private void updateFever()
    {
        if (isFeverMode)
        {
            if (FeverTime > 0f) //피버 모드면 시간을 계속 감속시킵니다.
            {
                FeverTime -= Time.deltaTime;
            }
            else
            {
                //플레이어 속도를 원래대로 되돌립니다.
                Messager.Send("NormalSpeed");

                //음악의 속도 파라미터를 다시 0으로 되돌립니다.
                Get <AudioManager>().bgm.setParameterByName("Fast", 0);

                //피버모드 초기화
                FeverTime   = 0f;
                isFeverMode = false;
            }
        }
    }
コード例 #20
0
ファイル: BurnMediaView.cs プロジェクト: sakpung/webstudy
        public void UpdateSelectedDriveInformation( )
        {
            try
            {
                if (null != SelectedDrive && null != SelectedDrive.CurrentDiscType)
                {
                    DiscTypeLabel.Text = SelectedDrive.CurrentDiscType.Name;
                }
                else
                {
                    DiscTypeLabel.Text = string.Empty;
                }

                string sText = GetDiskCapacity( );

                DiskCapacityLabel.Text = sText;
            }
            catch (Exception exception)
            {
                Messager.ShowError(this, exception);
            }
        }
コード例 #21
0
        public void ClickSend()
        {
            if (massageText.text == "" || websocket.ReadyState != WebSocketState.Open)
            {
                return;
            }
            Messager messager = new Messager(saveName, massageText.text);

            string toJsonStr0 = JsonUtility.ToJson(messager);

            SocketEvent socketEvent = new SocketEvent("Msg", toJsonStr0);

            string toJsonStr = JsonUtility.ToJson(socketEvent);


            //saveDataText = massageText.text;

            websocket.Send(toJsonStr);
            Debug.Log(toJsonStr);
            lastMessageMeSend = massageText.text;
            massageText.text  = "";
        }
コード例 #22
0
ファイル: MainForm.cs プロジェクト: sakpung/webstudy
        // Options - Capture Area Options ...
        private void _miOptionsCaptureAreaOptions_Click(object sender, EventArgs e)
        {
            if (_captureType != CaptureType.None)
            {
                _captureType = CaptureType.None;
                _engine.StopCapture();
                UpdateMyControls();
                UpdateStatusBarText();
            }

            try
            {
                _areaOptions = _engine.ShowCaptureAreaOptionsDialog(this, ScreenCaptureDialogFlags.None, _areaOptions, false, null);
            }
            catch (Exception ex)
            {
                if (ex.Message != "UserAbort" && ex.Message != "User has aborted operation")
                {
                    Messager.ShowError(this, ex);
                }
            }
        }
コード例 #23
0
        private void _cmbSelectedForm_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                _cmbSelectedPage.Items.Clear();

                for (int i = 0; i < _filledForms[_cmbSelectedForm.SelectedIndex].Image.PageCount; i++)
                {
                    _cmbSelectedPage.Items.Add((i + 1).ToString());
                }

                _txtMasterForm.Text     = _filledForms[_cmbSelectedForm.SelectedIndex].Master.Properties.Name;
                _txtFormConficence.Text = _filledForms[_cmbSelectedForm.SelectedIndex].Result.Confidence.ToString() + "%";

                _cmbSelectedPage.SelectedIndex = 0;
                UpdateControls();
            }
            catch (Exception exp)
            {
                Messager.ShowError(this, exp);
            }
        }
コード例 #24
0
        void _viewer_MouseUp(object sender, MouseEventArgs e)
        {
            if (command != null && e.Button == MouseButtons.Left && _drawing && _mousedown)
            {
                double xFactor = _viewer.XScaleFactor;
                double yFactor = _viewer.YScaleFactor;

                int xOffset = _viewer.ViewBounds.Left;
                int yOffset = _viewer.ViewBounds.Top;

                LeadPoint pnt = new LeadPoint((int)((e.X - xOffset) * 1.0 / xFactor + 0.5), (int)((e.Y - yOffset) * 1.0 / yFactor + 0.5));

                _curntMousePoint = pnt;
                _radius          = Length(_center, _curntMousePoint);

                _drawing   = false;
                _mousedown = false;

                if (_radius <= 1)
                {
                    _viewer.Invalidate();
                    return;
                }

                command.Center = _center;
                command.Radius = Math.Min(_radius, Math.Max(_viewer.Image.Width, _viewer.Image.Height));

                try
                {
                    command.Flags  = (_isCircle) ? ShrinkWrapFlags.ShrinkCircle : ShrinkWrapFlags.ShrinkRect;
                    command.Flags |= (ShrinkWrapFlags)_cbCombine.SelectedIndex;
                    command.Run(_viewer.Image);
                }
                catch (System.Exception ex)
                {
                    Messager.ShowError(this, ex);
                }
            }
        }
        void burnMediaForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            BurnMediaPresenter burnPresenter;


            burnPresenter = (sender as Form).Tag as BurnMediaPresenter;

            if (null != burnPresenter)
            {
                if (burnPresenter.IsProcessing)
                {
                    Messager.ShowWarning(sender as Form,
                                         "A media operation is currently in progress. Wait for the operation to finish or cancel.");

                    e.Cancel = true;
                }
                else
                {
                    burnPresenter.TearDown( );
                }
            }
        }
コード例 #26
0
ファイル: ImageHelper.cs プロジェクト: rh101/SpriteVortex
        /// <summary>
        /// Check if image extension is allowed and image size is within max permitted size
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static bool CheckImage(string path)
        {
            if (IsImageFile(path))
            {
                try
                {
                    Size maxTextureSize = Application.Instance.RenderDisplayManager.MaxTextureSize;

                    Size imageSize = GetImageSizeFromMetaData(path);
                    if (imageSize.Width <= maxTextureSize.Width && imageSize.Height <= maxTextureSize.Height)
                    {
                        return(true);
                    }
                }
                catch (Exception ex)
                {
                    Messager.ShowMessage(Messager.Mode.Exception,
                                         string.Format("Error on loading image: {0}", ex.Message));
                }
            }
            return(false);
        }
コード例 #27
0
 public void Do(params object[] args)
 {
     Album     = args[0] as Album;
     Size      = (Size)args[1];
     Indices   = args[2] as int[];
     Images    = new Bitmap[0];
     Locations = new Point[0];
     Images    = new Bitmap[Indices.Length];
     Locations = new Point[Indices.Length];
     for (var i = 0; i < Indices.Length; i++)
     {
         if (Indices[i] > Album.List.Count - 1 || Indices[i] < 0)
         {
             continue;
         }
         var entity = Album.List[Indices[i]];
         Images[i]    = entity.Picture;
         Locations[i] = entity.Location;
         entity.CanvasImage(Size);
     }
     Messager.ShowOperate("CanvasImage");
 }
コード例 #28
0
ファイル: MainForm.cs プロジェクト: sakpung/webstudy
        private ImageInformation LoadImage()
        {
            PdfImageFileLoader loader = new PdfImageFileLoader();

            try
            {
                if (loader.Load(this, _codecs, true))
                {
                    if (loader.Image.HasRegion)
                    {
                        loader.Image.MakeRegionEmpty();
                    }
                    return(new ImageInformation(loader.Image, loader.FileName));
                }
            }
            catch (Exception ex)
            {
                Messager.ShowFileOpenError(this, loader.FileName, ex);
            }

            return(null);
        }
コード例 #29
0
    public void add4Player()
    {
        List <Zone> safeZones = modele.GetRandomSafeZone(4);

        String imageURL = "uselessParameter..."; //On Pourrait peut être modifier pour passer le prefabs si besoin
        Player p        = new Ingenieur(safeZones[0], imageURL, modele);

        modele.GetListPlayers().Add(p);
        addPlayerPrefabs(p);

        p = new Explorateur(safeZones[1], imageURL, modele);
        modele.GetListPlayers().Add(p);
        addPlayerPrefabs(p);

        p = new Plongeur(safeZones[2], imageURL, modele);
        modele.GetListPlayers().Add(p);
        addPlayerPrefabs(p);

        p = new Messager(safeZones[3], imageURL, modele);
        modele.GetListPlayers().Add(p);
        addPlayerPrefabs(p);
    }
コード例 #30
0
        private void LaunchParticipant()
        {
            string participantFileName = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "CSCCOWClientParticipationDemo_Original.exe");

            if (!File.Exists(participantFileName))
            {
                participantFileName = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "CSCCOWClientParticipationDemo.exe");
            }

            if (File.Exists(participantFileName))
            {
                Process process = new Process();

                process.StartInfo.FileName  = participantFileName;
                process.StartInfo.Arguments = _LaunchArgs;
                process.Start();
            }
            else
            {
                Messager.ShowError(null, "Could not find the CSCCOWClientParticipationDemo");
            }
        }
コード例 #31
0
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (_Context != null)
            {
                if (_Context.Joined)
                {
                    ProgressInfoDialog dlgProgress = new ProgressInfoDialog(this);

                    dlgProgress.Title       = "Leaving Common Context";
                    dlgProgress.Description = "Attempting to leave common context";
                    try
                    {
                        dlgProgress.ShowDialog(() => _Context.Leave());
                    }
                    catch (Exception ex)
                    {
                        Messager.ShowError(this, ex);
                        e.Cancel = true;
                    }
                }
            }
        }
コード例 #32
0
        private void prepareForUpload()
        {
            string batchConfigFile   = BatchPath + "\\batch.config";
            bool   foundHeaderFields = false;

            if (File.Exists(batchConfigFile) && BatchType == "PhoneBill")
            {
                string line;

                using (StreamReader sr = new StreamReader(batchConfigFile))
                {
                    while ((line = sr.ReadLine()) != null)
                    {
                        if (line.StartsWith("Acctno"))
                        {
                            foundHeaderFields = true;
                            break;
                        }
                    }
                }
            }

            if (foundHeaderFields == false)
            {
                Messager.ShowInformation(this, "QC is complete. Set the header field values in File -> Batch Properties, then select Upload.");
            }
            else
            {
                Upload upload = new Upload();
                upload.BatchName      = BatchName;
                upload.BatchType      = BatchType;
                upload.BatchPath      = BatchPath;
                upload.BatchTableName = BatchTableName;
                upload.mainForm       = mainForm;
                upload.PageTotal      = mainForm.images.Length;
                upload.ShowDialog(this);
                this.Close();
            }
        }
コード例 #33
0
        public SpriteSheetEditor(string id, int width, int height) : base(id, width, height)
        {
            _canvas = Game.Instance.Canvas;

            _tool_action_params = new ToolActionParams()
            {
                Blitter = Game.Instance.Canvas,
            };

            _tools = new Dictionary <int, Tool>
            {
                { (int)Tools.Pen, new PenTool() },
                { (int)Tools.Select, new SelectTool() },
                { (int)Tools.Fill, new FillTool() }
            };

            SetCurrentTool(Tools.Pen);
            SetBrushSize(CurrentTool.BrushSize);

            _sprite_source_rect = Rect.Empty;

            _overlay_surface = Assets.CreatePixmap(Width, Height);
            _select_surface  = Assets.CreatePixmap(Width, Height);

            _tool_action_params.Overlay = _overlay_surface;

            TypedMessager <Rect> .On(MessageCodes.SelectionRectResize, OnSelectRectChanged);

            TypedMessager <Rect> .On(MessageCodes.SelectionRectMoved, OnSelectionRectMoved);

            TypedMessager <Rect> .On(MessageCodes.SourceRectChanged, OnNavigatorSourceRectChanged);

            TypedMessager <byte> .On(MessageCodes.ColorSelected, SetPaintColor);

            TypedMessager <int> .On(MessageCodes.SpriteSheetEditorBrushSizeChanged, SetBrushSize);

            Messager.On(MessageCodes.SelectionStartedMoving, OnSelectionRectStartedMoving);
            _dashed_rect = new DashedRect();
        }
コード例 #34
0
ファイル: MainForm.cs プロジェクト: sakpung/webstudy
        public void GotoPage(int pageNumber, bool resetFindText)
        {
            if (_document == null || pageNumber <= 0)
            {
                return;
            }

            try
            {
                _viewerControl.HighlightSelectedImageObject = false;
                using (WaitCursor wait = new WaitCursor())
                {
                    DocumentAnnotations.SetRasterCodecsOptions(_document, _rasterCodecs, pageNumber);
                    RasterImage pageImage = _document.GetPageImage(_rasterCodecs, pageNumber);

                    _currentPageNumber = pageNumber;

                    _pagesControl.SetCurrentPageNumber(pageNumber);
                    _viewerControl.SetCurrentPageNumber(pageNumber, pageImage);
                    _documentAnnotations.SetCurrentPageNumber(pageNumber);
                    //set function will hide/show objects
                    _documentAnnotations.IsAnnotationsVisible = _documentAnnotations.IsAnnotationsVisible;
                }
            }
            catch (Exception ex)
            {
                Messager.ShowError(this, ex);
            }
            finally
            {
                if (resetFindText)
                {
                    _findTextHelper.Reset();
                }

                UpdateUIState();
            }
        }
コード例 #35
0
        private bool GetDocumentInformation()
        {
            // Get all the options
            if (!CollectAllOptions())
            {
                return(false);
            }

            // Get the new image information

            string documentPath = _documentPathControl.DocumentPath;

            try
            {
                CodecsImageInfo newImageInfo = null;

                using (WaitCursor wait = new WaitCursor())
                {
                    newImageInfo = _rasterCodecsInstance.GetInformation(documentPath, false);
                }

                // Use this information
                if (_imageInfo != null)
                {
                    _imageInfo.Dispose();
                }

                _imageInfo = newImageInfo;
                _documentInfoControl.SetData(_imageInfo, _rasterCodecsInstance);

                return(true);
            }
            catch (Exception ex)
            {
                Messager.ShowError(this, ex);
                return(false);
            }
        }
コード例 #36
0
ファイル: FourBull.cs プロジェクト: ideadreamDefy/Defy
		//获取管理器单例
		static FourBull()
		{
			mPublicLoader = new AssetHelper (PublicName);
			mPrivateLoader = new AssetHelper (ModuleName);
			mMessager = new Messager ();
			mViewManager = ViewManager.Instance;
			mAudioManager = AudioManager.Instance;
			mSceneManager = SceneManager.Instance;
			mClientManager = GameClientManager.Instance;
		}
コード例 #37
0
 static void Messager_SendError(Messager<SessionData2> sender, Session<SessionData2> e)
 {
     Console.WriteLine("Sending Error!");
 }
コード例 #38
0
        public void Start()
        {
            /* RESOURCE LIST CREATION */
            #if UNITY_EDITOR
            AssetDatabase.Refresh();
            FileServices.CreateResourcesList("Assets/Resources/resourceslist.txt");
            #endif
            FileServices.LoadResourcesList("resourceslist");

            #region LOAD RESOURCES
            // logger and ioc
            _logger = new Logger("info.log", false);
            _resolver = new IoCResolver(_logger);
            _resolver.RegisterItem(_logger);

            _config = new UserConfigurationManager(new UserConfigurationData
            {
                GameVolume = 1f,
                MusicVolume = 1f
            });
            _resolver.RegisterItem(_config);

            // messager
            _messager = new Messager();
            _resolver.RegisterItem(_messager);

            // unity reference master
            _unity = GetComponent<UnityReferenceMaster>();
            _unity.DebugModeActive = false;
            _resolver.RegisterItem(_unity);

            // player
            var player = new UserAccountManager();
            _resolver.RegisterItem(player);

            // material provider
            var materialProvider = new MaterialProvider(_logger);
            MaterialLoader.LoadMaterial(materialProvider,"Materials");
            _resolver.RegisterItem(materialProvider);

            // texture provider
            var textureProvider = new TextureProvider(_logger);
            var spriteProvider = new SpriteProvider(_logger);
            TextureLoader.LoadTextures(textureProvider, spriteProvider, "Textures");
            _resolver.RegisterItem(textureProvider);
            _resolver.RegisterItem(spriteProvider);

            // sound provider
            var soundProvider = new SoundProvider(_logger);
            SoundLoader.LoadSounds(_logger, soundProvider, "Sounds");
            _resolver.RegisterItem(soundProvider);

            // prefab provider
            var prefabProvider = new PrefabProvider(_logger);
            PrefabLoader.LoadPrefabs(prefabProvider);
            _resolver.RegisterItem(prefabProvider);

            // pooling
            var poolingObjectManager = new PoolingObjectManager(_logger, prefabProvider);
            _resolver.RegisterItem(poolingObjectManager);

            var soundPoolManager = new PoolingAudioPlayer(_logger, _config, _unity, prefabProvider.GetPrefab("audio_source_prefab"));
            _resolver.RegisterItem(soundPoolManager);

            _particles = new PoolingParticleManager(_resolver);
            _resolver.RegisterItem(_particles);

            // canvas provider
            var canvasProvider = new CanvasProvider(_logger);
            _unity.LoadCanvases(canvasProvider);
            _resolver.RegisterItem(canvasProvider);

            // data provider
            var gameDataProvider = new GameDataProvider(_logger);

            /* DATA GOES HERE */

            _resolver.RegisterItem(gameDataProvider);
            #endregion

            _uiManager = new UiManager();
            _resolver.RegisterItem(_uiManager);

            // lock the resolver (stop any new items being registered)
            _resolver.Lock();

            /* BEGIN STATE */
            _currentState = new MenuState(_resolver);
            _currentState.Initialize();

            /* SUBSCRIBE FOR GAME END */
            _onExit = _messager.Subscribe<ExitMessage>(OnExit);
        }
コード例 #39
0
        static void messager_IncomingConnectionEstablished(Messager<SessionData> sender, Session<SessionData> e)
        {
            Console.WriteLine("New Connection, Time = {0}, EndPoint = {1}", e.BeginTime, e.EndPoint);
            e.Data.Messager = new TcpMessager<SessionData2>();
            e.Data.Messager.DataReceived += (m, conn, data) => {
                sender.Send(e, data);
            };
            e.Data.Messager.SendError += Messager_SendError;
            e.Data.Messager.SessionEnded += (m, conn) => {
                Console.WriteLine("Connection Closed");
                e.Data.Messager = null;
                e.Close();
            };
            e.Data.Messager.Connect(new IPEndPoint(System.Net.IPAddress.Parse("121.201.7.41"), 80), (m, conn, ex) => {
                if (conn != null) {
                    e.Data.Connection = conn;

                    lock (e.Data) {
                        if (e.Data.Buffer != null) {
                            conn.Send(new ArraySegment<byte>(e.Data.Buffer, 0, e.Data.Buffer.Length));
                        }
                    }
                }
            });
        }