Beispiel #1
0
        public void ProjectViewerTest()
        {
            DockingService_Accessor target   = new DockingService_Accessor(); // TODO: Initialize to an appropriate value
            ProjectViewer           expected = null;                          // TODO: Initialize to an appropriate value
            ProjectViewer           actual;

            target.ProjectViewer = expected;
            actual = target.ProjectViewer;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Beispiel #2
0
        private void AddProjectBtn_Click(object sender, EventArgs e)
        {
            try
            {
                var viewer = new ProjectViewer();
                viewer.Initialize(employees);
                viewer.Operation = OperaionType.Add;
                viewer.ShowDialog();

                HomeWindow_Load(null, null);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        public void InitPanels(WabbitcodeStatusBar statusBar)
        {
            StatusBar = new WabbitcodeStatusBarService(this, statusBar);

            //Init Normal Panels
            LabelList = new LabelList();
            LabelList.Show(DockManager, AnchorStyle.Right);

            ProjectViewer = new ProjectViewer();
            ProjectViewer.Show(DockManager, AnchorStyle.Left);

            OutputWindow = new OutputWindow();
            OutputWindow.Show(DockManager, AnchorStyle.Bottom);

            ErrorList = new ErrorList();
            ErrorList.Show(DockManager, AnchorStyle.Bottom);

            if (File.Exists(pathsService.DockConfig))
            {
                try
                {
                    DockManager.RestoreLayout(pathsService.DockConfig);
                } catch (Exception) { }
            }
            IDocumentService documentService = ServiceFactory.Instance.GetServiceInstance <DocumentService>();

            try
            {
                DocumentContent[] docs = new DocumentContent[Documents.Count];
                Documents.CopyTo(docs, 0);
                foreach (Editor doc in docs)
                {
                    documentService.OpenDocument(doc);
                }
            }
            catch (Exception ex)
            {
                ShowError("Error restoring documents", ex);
            }
        }
Beispiel #4
0
        private void EditProjectBtn_Click(object sender, EventArgs e)
        {
            try
            {
                var selectedItem = (ProjectModel)ProjectsList.SelectedItem;
                if (selectedItem == null)
                {
                    return;
                }

                var projectViewer = new ProjectViewer();
                projectViewer.Initialize(employees);
                projectViewer.Fill(selectedItem);
                projectViewer.Operation = OperaionType.Edit;
                projectViewer.ShowDialog();

                HomeWindow_Load(null, null);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #5
0
        private void ProjectSelectionPage_SelectedProjectChanged(object sender, RoutedEventArgs e)
        {
            try
            {
                if (e.OriginalSource != null)
                {
                    ClosableTabItem addWorkarea       = null;
                    string          Header            = string.Empty;
                    Guid            SelectedProjectId = Guid.Empty;

                    if (e.OriginalSource is ProjectListViewModel)
                    {
                        ProjectListViewModel model = (ProjectListViewModel)e.OriginalSource;
                        Header            = string.Format("專案:{0}-{1}", model.Code, model.ShortName);
                        SelectedProjectId = model.Id;
                    }

                    if (e.OriginalSource is ProjectsViewModel)
                    {
                        ProjectsViewModel model = (ProjectsViewModel)e.OriginalSource;
                        Header            = string.Format("專案:{0}-{1}", model.Code, model.ShortName);
                        SelectedProjectId = model.Id;
                    }


                    bool isExisted = false;

                    foreach (ClosableTabItem item in Workspaces.Items.OfType <ClosableTabItem>())
                    {
                        if (item.Header.Equals(Header))
                        {
                            isExisted   = true;
                            addWorkarea = item;
                            break;
                        }
                    }

                    if (!isExisted)
                    {
                        addWorkarea            = new ClosableTabItem();
                        addWorkarea.Header     = Header;
                        addWorkarea.IsSelected = true;

                        Workspaces.Items.Add(addWorkarea);
                        Workspaces.SelectedItem  = addWorkarea;
                        Workspaces.SelectedIndex = Workspaces.Items.IndexOf(addWorkarea);

                        var vm = new ProjectViewer()
                        {
                            Margin = new Thickness(0)
                        };

                        ProjectsViewModel source = new ProjectsViewModel();

                        //source.Id = SelectedProjectId;
                        source.Query(SelectedProjectId);
                        vm.DataContext = source;
                        vm.Mode        = DocumentLifeCircle.Read;

                        Binding bindinglogineduser = new Binding();
                        bindinglogineduser.Source = ((MainViewModel)DataContext).LoginedUser;

                        vm.SetBinding(ProjectViewer.LoginedUserProperty, bindinglogineduser);

                        addWorkarea.Content = vm;
                        addWorkarea.Margin  = new Thickness(0);
                    }

                    addWorkarea.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "錯誤", MessageBoxButton.OK, MessageBoxImage.Error);
                Workspaces.Items.Remove(Workspaces.SelectedItem);
            }
        }
Beispiel #6
0
        private void existingFileMenuItem_Click(object sender, EventArgs e)
        {
            ProjectViewer projectViewer = _dockingService.GetDockingWindow <ProjectViewer>();

            AbstractUiAction.RunCommand(new AddExistingFileAction(projectViewer));
        }
 public AddExistingFileAction(ProjectViewer projectViewer)
 {
     _projectViewer = projectViewer;
 }
 public AddNewFileAction(ProjectViewer projectViewer)
 {
     _projectViewer = projectViewer;
 }