Esempio n. 1
0
        private async void SaveHeaderAsync()
        {
            EditorBox.IsReadOnly = true;
            using (MemoryStream ms = new MemoryStream())
            {
                EditorBox.Save(ms, FormatType.Html);
                ms.Flush();
                ms.Position = 0;

                StreamReader reader  = new StreamReader(ms);
                String       content = reader.ReadToEnd();

                CommentSettings.CurrentHeaderParagraph.SetHtml(content);
            }

            HttpWebResponse response = await CurrentSection.SaveCommentHeaderAsync(CommentSettings.CurrentHeaderParagraph.HtmlContent);

            String message = "";

            switch (response.StatusCode)
            {
            case HttpStatusCode.OK: message = "Successfully Saved to Webhost."; break;

            default: message = String.Format("Something went wrong...{0}{1}", Environment.NewLine, response.StatusDescription); break;
            }

            EditorBox.IsReadOnly = false;
        }
        public void reload(EventX e = null)
        {
            RemoveAllChildren();
            ProjectPrefabSearchList item;

            dataProvider = PrefabVODB.Reload();

            tabNav.removeAllChildren();
            foreach (string key in dataProvider.Keys)
            {
                item = new ProjectPrefabSearchList();;
                item.itemEventHandle = itemEventHandle;
                item.dataProvider    = dataProvider[key];
                tabNav.addItem(key, item);
            }
            this.addChild(tabNav);
            this.addChild(new EditorFlexibleSpace());

            tabNav.autoSelected();

            EditorButton btn;

            EditorBox box = new EditorBox(false);

            btn = new EditorButton("reload");
            btn.addEventListener(EventX.ITEM_CLICK, reload);
            box.addChild(btn);

            this.addChild(box);
        }
Esempio n. 3
0
        partial void Connection_Click(NSObject sender)
        {
            ToggleConnect();
            var statement = EditorBox.GetSelectedOrAllText();

            ResultTextBox.SetText(statement);
        }
Esempio n. 4
0
 private void EditorBox_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.F5)
     {
         _viewModel.Input = EditorBox.GetSelectedOrAllText();
         _viewModel.ExecuteCommand.Execute(sender);
     }
 }
Esempio n. 5
0
 public override void KeyUp(NSEvent e)
 {
     if (e.KeyCode == 96)
     {
         var command = EditorBox.GetSelectedOrAllText();
         Model.StatusText = command;
         _communicator.StartExecute(command, QueryFinished);
     }
 }
Esempio n. 6
0
        /// <summary>
        /// Selected a class.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            SectionButton button = (SectionButton)sender;

            ClassNameBox.Text = (String)button.Content;
            StudentSelectPanel.Children.Clear();
            CurrentSection = button.Info;

            foreach (var item in ClassSelectPanel.Children)
            {
                if (item is SectionButton)
                {
                    ((SectionButton)item).IsEnabled = true;
                }
            }

            foreach (StudentInfo info in button.Info.Students.OrderBy(inf => inf.LastName).ThenBy(inf => inf.FirstName).ToList())
            {
                StudentButton studentButton = new StudentButton(info);
                studentButton.Click += StudentButton_Click;
                StudentSelectPanel.Children.Add(studentButton);
            }

            try
            {
                CommentSettings.CurrentHeaderParagraph = await button.Info.CurrentCommentHeaderAsync();
            }
            // If something goes wrong alert the user.
            catch (WebException ex)
            {
                String responseBody;
                using (StreamReader sr = new StreamReader(ex.Response.GetResponseStream()))
                {
                    responseBody = sr.ReadToEnd();
                }

                Windows.UI.Popups.MessageDialog dialog = new Windows.UI.Popups.MessageDialog(responseBody);
                await dialog.ShowAsync();
            }

            using (MemoryStream ms = new MemoryStream())
            {
                StreamWriter writer = new StreamWriter(ms);
                writer.Write(CommentSettings.CurrentHeaderParagraph.Html);
                writer.Flush();
                ms.Position = 0;

                EditorBox.Load(ms, FormatType.Html);
            }


            button.IsEnabled = false;
            CurrentState     = State.LoadedHeader;
            StateChanged(this, new EventArgs());
        }
Esempio n. 7
0
        public async static Task SelectChanged(int NewID)
        {
            int OldID = DialogueBox.SelectedIndex;

            CurrentDialogue           = DialogueBox.Items[NewID].Value;
            DialogueBox.SelectedIndex = NewID;
            DialogueBox.Refresh(NewID);
            DialogueBox.Refresh(OldID);
            EditorBox.Refresh();

            await DoEvents();

            await DialogueBox.EnsureItemVisible(NewID);
        }
Esempio n. 8
0
        private async void SaveStudentCommentAsync()
        {
            EditorBox.IsReadOnly = true;
            using (MemoryStream ms = new MemoryStream())
            {
                EditorBox.Save(ms, FormatType.Html);
                ms.Flush();
                ms.Position = 0;

                StreamReader reader  = new StreamReader(ms);
                String       content = reader.ReadToEnd();

                CommentSettings.CurrentStudentComment.HtmlContent = content;
            }

            HttpWebResponse response = await CurrentStudent.SaveCommentAsync(CommentSettings.CurrentStudentComment.HtmlContent);
        }
Esempio n. 9
0
        private async void StudentButton_Click(object sender, RoutedEventArgs e)
        {
            StudentButton btn = (StudentButton)sender;

            StudentNameBox.Text = (String)btn.Content;
            CurrentStudent      = btn.Info;

            foreach (var item in StudentSelectPanel.Children)
            {
                if (item is StudentButton)
                {
                    ((StudentButton)item).IsEnabled = true;
                }
            }

            try
            {
                CommentSettings.CurrentStudentComment = await CurrentStudent.CurrentCommentAsync();
            }
            // If something goes wrong alert the user.
            catch (WebException ex)
            {
                String responseBody;
                using (StreamReader sr = new StreamReader(ex.Response.GetResponseStream()))
                {
                    responseBody = sr.ReadToEnd();
                }

                Windows.UI.Popups.MessageDialog dialog = new Windows.UI.Popups.MessageDialog(responseBody);
                await dialog.ShowAsync();
            }

            using (MemoryStream ms = new MemoryStream())
            {
                StreamWriter writer = new StreamWriter(ms);
                writer.Write(CommentSettings.CurrentStudentComment.HtmlContent);
                writer.Flush();
                ms.Position = 0;

                EditorBox.Load(ms, FormatType.Html);
            }

            btn.IsEnabled = false;
            CurrentState  = State.LoadedStudent;
            StateChanged(this, new EventArgs());
        }
Esempio n. 10
0
        public void reload(EventX e = null)
        {
            string v = EditorConfigUtils.GetProjectResource("fbx/");

            if (string.IsNullOrEmpty(v))
            {
                DirectoryInfo directoryInfo = new DirectoryInfo("ReleaseResource/fbx/");
                if (directoryInfo.Exists == false)
                {
                    ShowNotification(new GUIContent("没本配置路径"));
                    return;
                }
                v = directoryInfo.FullName;
            }
            if (Directory.Exists(v) == false)
            {
                ShowNotification(new GUIContent("配置路径不存在:" + v));
                return;
            }

            fbxProjectDirectory = v;

            if (dataProvider == null)
            {
                dataProvider = new Dictionary <string, List <FBXInfo> >();
            }
            else
            {
                dataProvider.Clear();
            }

            ModelImporterAnimationType animationType        = ModelImporterAnimationType.Legacy;
            ModelImporterAnimationType foldersAnimationType = ModelImporterAnimationType.Legacy;

            string type = EditorConfigUtils.AnimationType;

            if (type == "Generic")
            {
                animationType = ModelImporterAnimationType.Generic;
            }
            string[] humanoidFolders     = EditorConfigUtils.HumanoidFolders;
            string[] parentDirectoryList = Directory.GetDirectories(v);

            foreach (string parentDirectory in parentDirectoryList)
            {
                DirectoryInfo parentDirectoryInfo = new DirectoryInfo(parentDirectory);
                string[]      directoryList       = Directory.GetDirectories(parentDirectory);
                string        parentDirectoryName = parentDirectoryInfo.Name;

                if (humanoidFolders.Contains(parentDirectoryName))
                {
                    foldersAnimationType = ModelImporterAnimationType.Human;
                }
                else
                {
                    foldersAnimationType = animationType;
                }

                List <FBXInfo> list     = new List <FBXInfo>();
                FBXInfo        fbxInfo  = null;
                bool           isSingle = false;
                foreach (string directory in directoryList)
                {
                    DirectoryInfo   directoryInfo = new DirectoryInfo(directory);
                    FileInfo[]      fileInfos     = directoryInfo.GetFiles();
                    List <FileInfo> fbxFileInfos  = new List <FileInfo>();
                    isSingle = false;
                    foreach (FileInfo fileInfo in fileInfos)
                    {
                        if (fileInfo.Extension.ToUpper() != ".FBX")
                        {
                            continue;
                        }
                        fbxFileInfos.Add(fileInfo);
                        if (Path.GetFileNameWithoutExtension(fileInfo.Name) == directoryInfo.Name)
                        {
                            isSingle = true;
                            fbxFileInfos.Clear();
                            fbxFileInfos.Add(fileInfo);
                            break;
                        }
                    }

                    foreach (FileInfo fileInfo in fbxFileInfos)
                    {
                        if (fileInfo.Extension.ToUpper() != ".FBX")
                        {
                            continue;
                        }
                        fbxInfo              = new FBXInfo();
                        fbxInfo.keys         = fileInfo.Directory.Name;
                        fbxInfo.fileName     = Path.GetFileNameWithoutExtension(fileInfo.Name);
                        fbxInfo.rawFolder    = directory + "/";
                        fbxInfo.fbxFolder    = "Assets/Fbxs/" + parentDirectoryName + "/" + directoryInfo.Name + "/";
                        fbxInfo.prefabFolder = "Assets/Prefabs/" + parentDirectoryName + "/" + fileInfo.Directory.Name + "/";

                        if (isSingle)
                        {
                            fbxInfo.animationType = foldersAnimationType;
                            fbxInfo.type          = FBXType.ANIM;
                        }
                        else
                        {
                            fbxInfo.animationType = ModelImporterAnimationType.None;
                            fbxInfo.type          = FBXType.MODEL;
                        }
                        list.Add(fbxInfo);
                    }
                }
                dataProvider.Add(parentDirectoryName, list);
            }

            RemoveAllChildren();
            ModelSearchList item;

            tabNav.removeAllChildren();
            foreach (string key in dataProvider.Keys)
            {
                item = new ModelSearchList();
                item.itemEventHandle = itemEventHandle;
                item.dataProvider    = dataProvider[key];
                tabNav.addItem(key, item);
            }
            this.addChild(tabNav);
            this.addChild(new EditorFlexibleSpace());

            tabNav.selectedIndex = EditorPrefs.GetInt(SaveTabKey);

            EditorButton btn;

            EditorBox box = new EditorBox(false);

            btn = new EditorButton("reload");
            btn.addEventListener(EventX.ITEM_CLICK, reload);
            box.addChild(btn);

            btn = new EditorButton("commitSVN");
            btn.addEventListener(EventX.ITEM_CLICK, commitSVN);
            box.addChild(btn);

            btn = new EditorButton("updateSVN");
            btn.addEventListener(EventX.ITEM_CLICK, updateSVN);
            box.addChild(btn);


            this.addChild(box);

            btn = new EditorButton("打包Assetbundle");
            btn.addEventListener(EventX.ITEM_CLICK, assetbundleClickHandle);
            this.addChild(btn);
        }
Esempio n. 11
0
        private void OnImageClick(object sender, MouseEventArgs e)
        {
            if (sender == null)
            {
                return;
            }

            if (pBox.Image == null)
            {
                return;
            }

            EditorImage t = (EditorImage)treeView1.SelectedNode.Tag;

            if (t == null)
            {
                return;
            }

            if (e.Button == MouseButtons.Left)
            {
                /* Box su cui si è cliccato null altrimenti */
                EditorBox clickedBox = t.GetBox(e.X, e.Y);

                /* Se la zona su cui si è cliccato non ha una box */
                if (clickedBox == EditorBox.None)
                {
                    t.Boxes.FindAll(b => b.IsSelected).ForEach(b => b.ChangeState(t));
                    return;
                }

                if (renderedSelectedBox != clickedBox)
                {
                    if (renderedSelectedBox != EditorBox.None)
                    {
                        renderedSelectedBox?.ChangeState(t);
                    }
                }

                renderedSelectedBox = clickedBox;

                Image rendered = renderedSelectedBox?.ChangeState(t); //365ms

                if (rendered == null)
                {
                    return;
                }

                /* Se è stata selezionata una box imposta l'editor dati */
                SetEditorData(rendered);                              // 1270ms

                pBox.Image.Dispose();
                pBox.Image        = rendered;
                boxEditor.Enabled = true;

                return;
            }

            if (e.Button == MouseButtons.Right)
            {
                FilterOptions fOpts   = new FilterOptions();
                Bitmap        bmpMask = new Bitmap(t.File);

                EditorImage dImg = (EditorImage)treeView1.SelectedNode.Tag;

                bmpMask = new Bitmap(t.File);

                FillRegionDetector det = new FillRegionDetector(e.Location);

                bmpMask = new ContrastFilter(0.8f).Apply(bmpMask);
                det.Apply(bmpMask);

                Rectangle area = det.Detected;

                if (area.Width <= 0 || area.Height <= 0)
                {
                    MessageBox.Show(@"No valid box detected!", @"No box detected", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    bmpMask.Dispose();
                    return;
                }

                dImg.AddBox(new EditorBox(new DataBox
                {
                    Top    = area.Top,
                    Left   = area.Left,
                    Height = area.Height,
                    Width  = area.Width,
                    Label  = "new box"
                }));


                bmpMask.Dispose();
                pBox.Image.Dispose();
                pBox.Image = dImg.Render();

                return;
            }
        }