Ejemplo n.º 1
0
        private void Send() //Send 버튼을 눌렀을 때 thrsend 쓰레드 안에서 돌아갈 함수
        {
            try
            {
                while (ConnectedToServer)      //서버에 연결되어 있을 때
                {
                    buttonstream.Position = 0; //파일의 인덱스를 맨앞으로 이동시키고

                    FileInfo fi = new FileInfo(openFileDialog.FileName);

                    Fp = new FilePacket();

                    Fp.FileName = fi.Name;                                                         //파일의 경로를 생각한 짧은 경로를 얻어오기위해 FileInfo 사용
                    Fp.FileSize = fi.Length;                                                       //파일의 길이를 FileSize로 입력

                    Invoke(new MethodInvoker(delegate()                                            //Control을 건드리는 부분 --> Invoke 사용
                    {
                        ProgressBar.Minimum = 0;                                                   // 초기값 0
                        ProgressBar.Maximum = (int)(buttonstream.Length / Fp.FileData.Length) + 1; //보내야 하는 횟수
                        ProgressBar.Value   = 0;                                                   // 현재 값 0
                    }
                                             ));
                    for (int i = 0; i < (int)(buttonstream.Length / Fp.FileData.Length) + 1; i++)
                    {                                                          //파일의 크기를 버퍼의 크기로 나누고 나머지부분 전송을 위해 + 1번만큼 더 전송함
                        buttonstream.Read(Fp.FileData, 0, Fp.FileData.Length); //파일을 버퍼에 읽어와서
                        Fp.Type = 0;                                           //보통의 파일 전송 타입
                        Packet.Serialize(Fp).CopyTo(this.SendBuffer, 0);       //SendBuffer로 Serialize
                        NetStream.Write(SendBuffer, 0, SendBuffer.Length);     //네트워크 스트림에 쓴다
                        NetStream.Flush();                                     //보낸다

                        ClearBuffer(SendBuffer);                               //SendBuffer의 모든 index를 0으로 초기화

                        Invoke(new MethodInvoker(delegate()                    //Control을 건드리는 부분
                        {
                            ProgressBar.Value++;                               //Value를 증가시킴(Progressbar 수치 증가)
                        }
                                                 ));
                    }
                    //파일 전송 끝

                    buttonstream.Dispose();
                    buttonstream.Close();               //
                    FileTextBox.Clear();                //파일스트림을 닫아주고, 파일경로 텍스트박스 초기화

                    Invoke(new MethodInvoker(delegate() //컨트롤을 건드리는 부분
                    {
                        ListViewItem item = new ListViewItem(new string[] { fi.Name, fi.Length.ToString() });
                        listView.Items.Add(item);           //전송을 완료하면 서버의 경로에 이 파일도 저장되므로
                    }
                                             ));

                    threader = new Thread(new ThreadStart(Receive)); //Abort되었던 쓰레드를 다시 생성해줌
                    threader.Start();                                //시작
                    thrsender.Abort();                               //전송 쓰레드 Abort
                }
            }
            catch
            {//쓰레드가 중단되었습니다. 같은 무시할 수 있는 오류를 깔끔히 처리하기 위해서 비워둠
            }
        }
Ejemplo n.º 2
0
 private void TextureEditor_FormClosed(object sender, FormClosedEventArgs e)
 {
     TexturesListBox.Items.Clear();
     MagFilterComboBox.Items.Clear();
     MinFilterComboBox.Items.Clear();
     FileTextBox.Clear();
 }
Ejemplo n.º 3
0
        public static void UpdateAnimationChainUi(IAnimationChainAnimatable selectedObject,
                                                  ComboBox currentChainNameComboBox, FileTextBox animationChainFileTextBox)
        {
            #region Update mCurrentChainComboBox items

            if (selectedObject != null && selectedObject.AnimationChains.Count != 0)
            {
                for (int i = 0; i < selectedObject.AnimationChains.Count; i++)
                {
                    if (currentChainNameComboBox.Count <= i || currentChainNameComboBox[i].Text != selectedObject.AnimationChains[i].Name)
                    {
                        currentChainNameComboBox.InsertItem(i, selectedObject.AnimationChains[i].Name, selectedObject.AnimationChains[i]);
                    }
                }

                while (currentChainNameComboBox.Count > selectedObject.AnimationChains.Count)
                {
                    currentChainNameComboBox.RemoveAt(currentChainNameComboBox.Count - 1);
                }
            }
            #endregion

            #region Update the Animation File UI
            if (selectedObject != null && selectedObject.AnimationChains != null && selectedObject.AnimationChains.Name != null)
            {
                if (!animationChainFileTextBox.IsWindowOrChildrenReceivingInput)
                {
                    animationChainFileTextBox.Text = selectedObject.AnimationChains.Name;
                }
            }

            #endregion
        }
        private void CreateBindings()
        {
            FileTextBox.SetBinding(TextBox.TextProperty, new Binding("File")
            {
                Source = _model,
                Mode   = BindingMode.OneWay
            });

            ItemComboBox.SetBinding(ItemsControl.ItemsSourceProperty, new Binding("Items")
            {
                Source = _model,
                Mode   = BindingMode.OneWay
            });
            ItemComboBox.SetBinding(Selector.SelectedItemProperty, new Binding("Item")
            {
                Source = _model,
                Mode   = BindingMode.TwoWay
            });
            _model.ItemChanged += SelectedItemChanged;

            SaveButton.SetBinding(IsEnabledProperty, new Binding("SaveButtonEnabled")
            {
                Source = _model,
                Mode   = BindingMode.OneWay
            });
        }
        void LoadSkeleton(Window callingWindow)
        {
#if !FRB_MDX
            FileTextBox fileTextBox = callingWindow as FileTextBox;

            string sourceFile      = fileTextBox.Text;
            string destinationFile = "";

            string extension = FileManager.GetExtension(sourceFile);

            BuildToolAssociation toolForExtension = GetToolForExtension(extension);

            if (toolForExtension != null)
            {
                destinationFile =
                    FileManager.UserApplicationDataForThisApplication +
                    FileManager.RemovePath(FileManager.RemoveExtension(sourceFile)) + "." + toolForExtension.DestinationFileType;

                toolForExtension.PerformBuildOn(sourceFile, destinationFile, null, null, null);
            }
            else
            {
                destinationFile = sourceFile;
            }
#endif
        }
Ejemplo n.º 6
0
        public void SetToFileString()
        {
            if (mTextBox != null)
            {
                RemoveWindow(mTextBox);
                mTextBox = null;
            }


            mFileTextBox        = new FileTextBox(mCursor);
            mFileTextBox.ScaleX = 15;
            this.AddWindow(mFileTextBox);
            mFileTextBox.Text         = SelectedObject;
            mFileTextBox.LosingFocus += ChangeString;
            mFileTextBox.FileSelect  += ChangeString;
        }
Ejemplo n.º 7
0
        public SpritePropertyGrid(Cursor cursor)
            : base(cursor)
        {
            MakeVisibleOnSpriteSet = true;

            InitialExcludeIncludeMembers();

            #region Category Cleanup

            RemoveCategory("Uncategorized");

            SelectCategory("Basic");

            #endregion

            #region UI Replacement

            #region Replace the CurrentChainName UI element

            mCurrentChainNameComboBox        = new ComboBox(this.mCursor);
            mCurrentChainNameComboBox.ScaleX = 5;
            ReplaceMemberUIElement("CurrentChainName", mCurrentChainNameComboBox);

            #endregion

            mAnimationChainFileTextBox                     = new FileTextBox(this.mCursor);
            mAnimationChainFileTextBox.ScaleX              = 8;
            mAnimationChainFileTextBox.TextBox.CursorOver += ShowAnimationPopup;
            this.AddWindow(mAnimationChainFileTextBox, "Animation");
            mAnimationChainFileTextBox.SetFileType("achx");
            this.SetLabelForWindow(mAnimationChainFileTextBox, "Animation File");

            mAnimationChainFileTextBox.FileSelect += SetAnimationChainOnSprite;

            #endregion

            this.MinimumScaleY = 10;

            SetMemberDisplayName("CursorSelectable", "Active");
        }
        public SpriteFramePropertyGrid(Cursor cursor)
            : base(cursor)
        {
            ExcludeAllMembers();

            #region Include Basic Members

            IncludeMember("X", "Basic");
            IncludeMember("Y", "Basic");
            IncludeMember("Z", "Basic");

            IncludeMember("RotationX", "Basic");
            IncludeMember("RotationY", "Basic");
            IncludeMember("RotationZ", "Basic");

            IncludeMember("Visible", "Basic");
            IncludeMember("CursorSelectable", "Basic");

            IncludeMember("Name", "Basic");

            mOrderingMode = new ComboBox(mCursor);
            mOrderingMode.AddItem("Distance from Camera", OrderingMode.DistanceFromCamera);
            mOrderingMode.AddItem("ZBuffered", OrderingMode.ZBuffered);
            mOrderingMode.ScaleX = 6.5f;
            AddWindow(mOrderingMode, "Basic");
            SetLabelForWindow(mOrderingMode, "OrderingMode");
            mOrderingMode.ItemClick += SetOrderingMode;

            #endregion

            #region Scale Members

            IncludeMember("ScaleX", "Scale");
            IncludeMember("ScaleY", "Scale");

            Button setPixelPerfectScale = new Button(mCursor);
            setPixelPerfectScale.ScaleX = 5;
            setPixelPerfectScale.ScaleY = 2;

            setPixelPerfectScale.Text = "Set Pixel\nPerfect";

            setPixelPerfectScale.Click += SetPixelPerfectClick;

            AddWindow(setPixelPerfectScale, "Scale");

            #endregion

            IncludeMember("Texture", "Texture");
            SetMemberChangeEvent("Texture", OnTextureChange);

            #region Animation members

            IncludeMember("AnimationChains", "Animation");
            IncludeMember("CurrentChainName", "Animation");
            IncludeMember("Animate", "Animation");
            IncludeMember("AnimationSpeed", "Animation");

            #endregion

            #region Include Color Members

            IncludeMember("ColorOperation", "Color");

#if !FRB_XNA
            ComboBox colorOperationComboBox = GetUIElementForMember("ColorOperation") as ComboBox;

            for (int i = colorOperationComboBox.Count - 1; i > -1; i--)
            {
                TextureOperation textureOperation =
                    ((TextureOperation)colorOperationComboBox[i].ReferenceObject);

                if (!FlatRedBall.Graphics.GraphicalEnumerations.IsTextureOperationSupportedInFrbXna(
                        textureOperation))
                {
                    colorOperationComboBox.RemoveAt(i);
                }
            }
#endif

            IncludeMember("Red", "Color");
            IncludeMember("Green", "Color");
            IncludeMember("Blue", "Color");

            #endregion

            #region Include Blend Members

            IncludeMember("BlendOperation", "Blend");
            IncludeMember("Alpha", "Blend");

            #endregion

            #region Include Border Members

            IncludeMember("TextureBorderWidth", "Border");
            IncludeMember("SpriteBorderWidth", "Border");
            IncludeMember("Borders", "Border");
            IncludeMember("PixelSize", "Border");

            #endregion

            #region Customize "Borders"

            SetMemberChangeEvent("Borders", OnBordersChanged);

            #endregion

            #region Customize TextureBorderWidth

            UpDown upDown = GetUIElementForMember("TextureBorderWidth") as UpDown;
            upDown.MinValue = 0;
            upDown.MaxValue = .5f;

            mTextureBorderWidthInPixels               = new UpDown(mCursor);
            mTextureBorderWidthInPixels.ScaleX        = 6;
            mTextureBorderWidthInPixels.ValueChanged += ChangeTextureBorderWidthInPixels;
            mTextureBorderWidthInPixels.RoundTo       = 1;
            AddWindow(mTextureBorderWidthInPixels, "Border");


            #endregion


            #region Replace the CurrentChainName UI element

            mCurrentChainNameComboBox        = new ComboBox(this.mCursor);
            mCurrentChainNameComboBox.ScaleX = 5;
            ReplaceMemberUIElement("CurrentChainName", mCurrentChainNameComboBox);

            #endregion

            mAnimationChainFileTextBox                     = new FileTextBox(this.mCursor);
            mAnimationChainFileTextBox.ScaleX              = 8;
            mAnimationChainFileTextBox.TextBox.CursorOver += ShowAnimationPopup;
            this.AddWindow(mAnimationChainFileTextBox, "Animation");
            mAnimationChainFileTextBox.SetFileType("achx");
            this.SetLabelForWindow(mAnimationChainFileTextBox, "Animation File");

            mAnimationChainFileTextBox.FileSelect += SetAnimationChainOnSprite;


            AfterUpdateDisplayedProperties += new GuiMessage(UpdateTextureBorderWidthUI);

            RemoveCategory("Uncategorized");

            SelectCategory("Basic");
        }
Ejemplo n.º 9
0
        private void MaterialTabs_SelectedIndexChanged(object sender, EventArgs e)
        {
            #region Disable controls
            NameTextBox.Enabled         = false;
            MagFilterComboBox.Enabled   = false;
            MinFilterComboBox.Enabled   = false;
            EngineCheckBox.Enabled      = false;
            ApplyButton.Enabled         = false;
            FileButton.Enabled          = false;
            FileTextBox.Enabled         = false;
            CubeMapFileButton1.Enabled  = false;
            CubeMapFileTextBox1.Enabled = false;
            CubeMapFileButton2.Enabled  = false;
            CubeMapFileTextBox2.Enabled = false;
            CubeMapFileButton3.Enabled  = false;
            CubeMapFileTextBox3.Enabled = false;
            CubeMapFileButton4.Enabled  = false;
            CubeMapFileTextBox4.Enabled = false;
            CubeMapFileButton5.Enabled  = false;
            CubeMapFileTextBox5.Enabled = false;
            CubeMapFileButton6.Enabled  = false;
            CubeMapFileTextBox6.Enabled = false;

            #endregion
            EngineCheckBox.Checked = false;
            NameTextBox.Clear();
            this.MinimumSize = new System.Drawing.Size(0, 0);
            if (MaterialTabs.SelectedTab == MaterialTabs.TabPages[0])
            {
                this.Size        = new System.Drawing.Size(798, 482);
                this.MinimumSize = new System.Drawing.Size(798, 482);

                TextureFilePanel.Show();
                CubemapTexturePanel.Hide();
                TexturesListBox.Items.Clear();
                MagFilterComboBox.SelectedIndex = -1;
                MinFilterComboBox.SelectedIndex = -1;
                FileTextBox.Clear();
                pictureBox1.Hide();
                foreach (Texture element in Textures.TexturesList)
                {
                    if (element.TextureTarget == Pencil.Gaming.Graphics.TextureTarget.Texture2D)
                    {
                        TexturesListBox.Items.Add(element.Name);
                    }
                }
            }
            if (MaterialTabs.SelectedTab == MaterialTabs.TabPages[1])
            {
                this.Size        = new System.Drawing.Size(798, 604);
                this.MinimumSize = new System.Drawing.Size(798, 604);

                TexturesListIndexCounter = TexturesListBox.Items.Count;
                TextureFilePanel.Hide();
                CubemapTexturePanel.Show();
                TexturesListBox.Items.Clear();
                MagFilterComboBox.SelectedIndex = -1;
                MinFilterComboBox.SelectedIndex = -1;
                FileTextBox.Clear();
                pictureBox1.Hide();
                foreach (Texture element in Textures.TexturesList)
                {
                    if (element.TextureTarget == Pencil.Gaming.Graphics.TextureTarget.TextureCubeMap)
                    {
                        TexturesListBox.Items.Add(element.Name);
                    }
                }
            }
        }
        public PositionedModelPropertyGrid(Cursor cursor)
            : base(cursor)
        {
            ExcludeAllMembers();

            #region Include Basic Members

            IncludeMember("X", "Basic");
            IncludeMember("Y", "Basic");
            IncludeMember("Z", "Basic");



            IncludeMember("RotationX", "Basic");
            IncludeMember("RotationY", "Basic");
            IncludeMember("RotationZ", "Basic");

//            IncludeMember("Visible", "Basic");
            IncludeMember("CursorSelectable", "Basic");

            IncludeMember("Name", "Basic");

            IncludeMember("IsAutomaticallyUpdated", "Basic");

            IncludeMember("Visible", "Basic");

            #endregion

            #region Include "Scale" members

            IncludeMember("ScaleX", "Scale");
            IncludeMember("ScaleY", "Scale");
            IncludeMember("ScaleZ", "Scale");

#if !FRB_MDX
            IncludeMember("FlipX", "Scale");
            IncludeMember("FlipY", "Scale");
            IncludeMember("FlipZ", "Scale");
#endif

            #endregion

            #region Include "Rendering" members

            IncludeMember("FaceCullMode", "Rendering");

            #endregion

            #region Include Relative Members

            IncludeMember("RelativeX", "Relative");
            IncludeMember("RelativeY", "Relative");
            IncludeMember("RelativeZ", "Relative");

            IncludeMember("RelativeRotationX", "Relative");
            IncludeMember("RelativeRotationY", "Relative");
            IncludeMember("RelativeRotationZ", "Relative");

            #endregion

            #region Include Animation Members

#if FRB_XNA
            //IncludeMember("HasAnimation", "Animation");
            //IncludeMember("Animate", "Animation");
            //IncludeMember("CurrentAnimation", "Animation");

            //mCurrentAnimationComboBox = new ComboBox(GuiManager.Cursor);
            //mCurrentAnimationComboBox.ScaleX = 6;
            //ReplaceMemberUIElement("CurrentAnimation", mCurrentAnimationComboBox);

            mHierarchyFileTextBox        = new FileTextBox(GuiManager.Cursor);
            mHierarchyFileTextBox.ScaleY = 1.5f;
            mHierarchyFileTextBox.ScaleX = 15;
            List <string> fileTypes = new List <string>();
            fileTypes.Add("wbi");
            fileTypes.Add("whe");
            mHierarchyFileTextBox.SetFileType(fileTypes);
            this.AddWindow(mHierarchyFileTextBox, "Animation");
            mHierarchyFileTextBox.FileSelect += new GuiMessage(LoadSkeleton);



            mAnimationListDisplayWindow        = new ListDisplayWindow(cursor);
            mAnimationListDisplayWindow.ScaleX = 15;
            mAnimationListDisplayWindow.ScaleY = 15;
            mAnimationListDisplayWindow.ListBox.StrongSelect += new GuiMessage(StrongSelectAnimation);
            mAnimationListDisplayWindow.ListBox.Highlight    += new GuiMessage(ShowAnimationPropertyGrid);
            this.AddWindow(mAnimationListDisplayWindow, "Animation");



            mAddAnimationButton        = new Button(GuiManager.Cursor);
            mAddAnimationButton.Text   = "Add Animation";
            mAddAnimationButton.ScaleX = 8.5f;
            mAddAnimationButton.ScaleY = 1.5f;
            this.AddWindow(mAddAnimationButton, "Animation");
            mAddAnimationButton.Click += new GuiMessage(AddAnimationClick);

            mRemoveAllAnimationDataButton        = new Button(cursor);
            mRemoveAllAnimationDataButton.Text   = "Remove All Anim Data";
            mRemoveAllAnimationDataButton.ScaleX = 8.5f;
            mRemoveAllAnimationDataButton.ScaleY = 1.5f;
            this.AddWindow(mRemoveAllAnimationDataButton, "Animation");
            mRemoveAllAnimationDataButton.Click += new GuiMessage(RemoveAllAnimationButtonClick);


            mAnimationListDisplayWindow.EnableRemovingFromList();
#endif
            #endregion



            #region Remove Uncategorized and set default category
            RemoveCategory("Uncategorized");

            SelectCategory("Basic");
            #endregion

#if FRB_XNA
            PropertyGrid.SetPropertyGridTypeAssociation(typeof(Animation3DInstance), typeof(Animation3DInstancePropertyGrid));
#endif

            ShowIColorableProperties();

            this.X = this.ScaleX;
            this.Y = this.ScaleY + Window.MoveBarHeight + 3;
        }