Esempio n. 1
0
        private TabItem AddTabItem(string tab_Name, string filepath)
        {
            project_name = ctrVM.current_projectName;
            fileName_cnt++;

            // create new tab item
            TabItem tab = new TabItem();

            tab.Header = tab_Name;
            tab.Name = tab_Name;
            tab.HeaderTemplate = tabDynamic.FindResource("TabHeader") as DataTemplate;
            tab.MouseDoubleClick += new MouseButtonEventHandler(tab_MouseDoubleClick);

            Grid dynamicGrid = new Grid();
            ColumnDefinition previewGrid = new ColumnDefinition();
            ColumnDefinition uiCanvasGrid = new ColumnDefinition();
            ColumnDefinition fucntionCanvasGrid = new ColumnDefinition();
            previewGrid.MaxWidth = 130;
            previewGrid.MinWidth = 50;
            uiCanvasGrid.MinWidth = 100;
            fucntionCanvasGrid.MinWidth = 200;

            dynamicGrid.ColumnDefinitions.Add(previewGrid);
            //    previewGrid.Width = new GridLength(100);
            dynamicGrid.ColumnDefinitions.Add(uiCanvasGrid);
            dynamicGrid.ColumnDefinitions.Add(fucntionCanvasGrid);

            file_path = filepath;
            uiCanvasV = new UICanvasView();
            Canvas _ca = uiCanvasV.MyCanvas;
            previewCanvasV = new PreviewCanvasView(file_path, _ca);
            scriptV = new ScriptView();
            //20150228 start
            tab.DataContext = scriptV;
            //20150228 end
            GridSplitter PandUISpli = new GridSplitter();
            PandUISpli.Background = new SolidColorBrush(Color.FromArgb(255, 45, 45, 48));
            PandUISpli.Width = 3;
            GridSplitter UIandFUNCTIONSpli = new GridSplitter();
            UIandFUNCTIONSpli.Background = new SolidColorBrush(Color.FromArgb(255, 45, 45, 48));
            UIandFUNCTIONSpli.Width = 10;

            Grid.SetColumn(previewCanvasV, 0);
            Grid.SetColumn(PandUISpli, 0);
            Grid.SetColumn(uiCanvasV, 1);
            Grid.SetColumn(UIandFUNCTIONSpli, 1);
            Grid.SetColumn(scriptV, 2);

            dynamicGrid.Children.Add(previewCanvasV);
            dynamicGrid.Children.Add(PandUISpli);
            dynamicGrid.Children.Add(uiCanvasV);
            dynamicGrid.Children.Add(UIandFUNCTIONSpli);
            dynamicGrid.Children.Add(scriptV);
            tab.Content = dynamicGrid;

            // insert tab item right before the last (+) tab item
            _tabItems.Insert(_tabItems.Count - 1, tab);

            return tab;
        }
Esempio n. 2
0
        private TabItem AddTabItem()
        {
            fileName_cnt++;
            string name = string.Format("Scene{0}", fileName_cnt);
            //string name = System.IO.Path.GetRandomFileName().Replace(" ","").Replace(".","");
            string path = Environment.GetEnvironmentVariable("USERPROFILE") + "\\" + Miseng.Properties.Resources.My_WorkSpace_Name;
            System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(path);
            if (System.IO.Directory.GetDirectories(path).Length < 2) return null;

            //20150228 start
            if (string.IsNullOrEmpty(ctrVM.current_projectName))
                project_name = System.IO.Directory.GetDirectories(path)[2].Split(new string[] { "\\" }, StringSplitOptions.RemoveEmptyEntries).Last();
            else
                project_name = ctrVM.current_projectName;
            //20150228 end

            string new_file_path = path + "\\" + project_name + "\\Tizen\\" + project_name;
            while (System.IO.File.Exists(new_file_path + "\\" + name + ".html"))
            {
                fileName_cnt++;
                name = string.Format("Scene{0}", fileName_cnt);
            }
            ctrVM.current_Scene = name;
            ctrVM.projectAndfileName = project_name + "_" + name;
            ctrVM.current_projectName = project_name;

            Grid.SetZIndex(ctrVM._intro, 0);
            Grid.SetZIndex(ctrVM.fileTabV, 1);

            System.IO.File.Create(new_file_path + "\\" + name + ".html").Close();
            System.IO.File.WriteAllText(new_file_path + "\\" + name + ".html", Miseng.Properties.Resources.basicHtml);
            file_path = new_file_path + "\\" + name + ".html";
            //myViewModel.Update_ExplorerViewModel();
            //System.IO.File.cr
            // create new tab item
            TabItem tab = new TabItem();

            tab.Header = name;
            tab.Name = name;
            tab.HeaderTemplate = tabDynamic.FindResource("TabHeader") as DataTemplate;
            tab.MouseDoubleClick += new MouseButtonEventHandler(tab_MouseDoubleClick);

            Grid dynamicGrid = new Grid();
            ColumnDefinition previewGrid = new ColumnDefinition();
            ColumnDefinition uiCanvasGrid = new ColumnDefinition();
            ColumnDefinition fucntionCanvasGrid = new ColumnDefinition();
            previewGrid.MaxWidth = 130;
            previewGrid.MinWidth = 50;
            uiCanvasGrid.MinWidth = 100;
            fucntionCanvasGrid.MinWidth = 200;


            dynamicGrid.ColumnDefinitions.Add(previewGrid);
            //     previewGrid.Width = new GridLength(100);
            dynamicGrid.ColumnDefinitions.Add(uiCanvasGrid);
            dynamicGrid.ColumnDefinitions.Add(fucntionCanvasGrid);


            //+버튼을 눌렀을때 file을 생성하고 path를 추가하는 부분을 구현해야함.

            uiCanvasV = new UICanvasView();
            Canvas ca = uiCanvasV.MyCanvas;
            previewCanvasV = new PreviewCanvasView(file_path, ca);
            scriptV = new ScriptView();
            //20150228 start
            tab.DataContext = scriptV;
            //20150228 end
            GridSplitter PandUISpli = new GridSplitter();
            PandUISpli.Background = new SolidColorBrush(Color.FromArgb(255, 45, 45, 48));
            PandUISpli.Width = 3;
            GridSplitter UIandFUNCTIONSpli = new GridSplitter();
            UIandFUNCTIONSpli.Background = new SolidColorBrush(Color.FromArgb(255, 45, 45, 48));
            UIandFUNCTIONSpli.Width = 10;

            Grid.SetColumn(previewCanvasV, 0);
            Grid.SetColumn(PandUISpli, 0);
            Grid.SetColumn(uiCanvasV, 1);
            Grid.SetColumn(UIandFUNCTIONSpli, 1);
            Grid.SetColumn(scriptV, 2);

            dynamicGrid.Children.Add(previewCanvasV);
            dynamicGrid.Children.Add(PandUISpli);
            dynamicGrid.Children.Add(uiCanvasV);
            dynamicGrid.Children.Add(UIandFUNCTIONSpli);
            dynamicGrid.Children.Add(scriptV);
            tab.Content = dynamicGrid;

            // insert tab item right before the last (+) tab item
            _tabItems.Insert(_tabItems.Count - 1, tab);
            ctrVM.FileTreeVM.UpDateFileExplorerViewModel();
            return tab;
        }