コード例 #1
0
 public OpenProject(IMainWindow main)
 {
     Instance       = this;
     FilteredSource = ((System.Windows.Data.ListCollectionView)System.Windows.Data.CollectionViewSource.GetDefaultView(Projects));
     Log.FunctionIndent("OpenProject", "OpenProject");
     try
     {
         InitializeComponent();
         if (RobotInstance.instance.Window is AgentWindow)
         {
             EditXAMLPanel.Visibility = Visibility.Hidden;
         }
         if (RobotInstance.instance.Window is AgentWindow)
         {
             PackageManagerPanel.Visibility = Visibility.Hidden;
         }
         this.main   = main;
         DataContext = this;
         RobotInstance.instance.PropertyChanged += Instance_PropertyChanged;
         UpdateProjectsList(true, true);
     }
     catch (Exception ex)
     {
         Log.Error(ex.ToString());
     }
     Log.FunctionOutdent("OpenProject", "OpenProject");
 }
コード例 #2
0
        public OpenProject(IMainWindow main)
        {
            Cultures = System.Globalization.CultureInfo.GetCultures(System.Globalization.CultureTypes.InstalledWin32Cultures).ToList();
            Instance = this;
            Log.FunctionIndent("OpenProject", "OpenProject");
            try
            {
                InitializeComponent();
                // https://stackoverflow.com/questions/50922465/how-to-sort-the-child-nodes-of-treeview
                listWorkflows.Items.SortDescriptions.Add(new SortDescription("name", ListSortDirection.Ascending));

                if (RobotInstance.instance.Window is AgentWindow)
                {
                    EditXAMLPanel.Visibility = Visibility.Hidden;
                }
                if (RobotInstance.instance.Window is AgentWindow)
                {
                    PackageManagerPanel.Visibility = Visibility.Hidden;
                }
                this.main   = main;
                DataContext = this;
            }
            catch (Exception ex)
            {
                Log.Error(ex.ToString());
            }
            Log.FunctionOutdent("OpenProject", "OpenProject");
        }
コード例 #3
0
        public void OnOpen(object _item)
        {
            AutomationHelper.syncContext.Post(o =>
            {
                try
                {
                    var ld = DManager.Layout.Descendents().OfType <LayoutDocument>().ToList();
                    foreach (var document in ld)
                    {
                        if (document.Content is Views.OpenProject op)
                        {
                            document.IsSelected = true; return;
                        }
                    }
                    var view             = new Views.OpenProject(this);
                    view.onOpenWorkflow += OnOpenWorkflow;

                    LayoutDocument layoutDocument = new LayoutDocument {
                        Title = "Open project"
                    };
                    layoutDocument.ContentId = "openproject";
                    layoutDocument.CanClose  = false;
                    layoutDocument.Content   = view;
                    MainTabControl.Children.Add(layoutDocument);
                    layoutDocument.IsSelected = true;
                    // layoutDocument.Closing += LayoutDocument_Closing;
                    RobotInstance.instance.NotifyPropertyChanged("Projects");
                }
                catch (Exception ex)
                {
                    Log.Error(ex.ToString());
                    MessageBox.Show(ex.Message);
                }
            }, null);
        }
コード例 #4
0
 private void onOpen(object item)
 {
     AutomationHelper.syncContext.Post(o =>
     {
         foreach (TabItem tab in mainTabControl.Items)
         {
             if (tab.Content is Views.OpenProject)
             {
                 tab.IsSelected = true;
                 return;
             }
         }
         var view                     = new Views.OpenProject(this);
         view.onOpenProject          += onOpenProject;
         view.onOpenWorkflow         += onOpenWorkflow;
         Views.ClosableTab newTabItem = new Views.ClosableTab
         {
             Title   = "Open project",
             Name    = "openproject",
             Content = view
         };
         newTabItem.OnClose += NewTabItem_OnClose;
         mainTabControl.Items.Add(newTabItem);
         newTabItem.IsSelected = true;
     }, null);
 }
コード例 #5
0
ファイル: DetectorsView.xaml.cs プロジェクト: vantk85/openrpa
        public async void LayoutDocument_IsSelectedChanged(object sender, EventArgs e)
        {
            // lidtDetectors.SelectedIndex = -1;
            var tab = sender as Xceed.Wpf.AvalonDock.Layout.LayoutContent;

            if (tab != null && !tab.IsSelected)
            {
                try
                {
                    if (updateUIList)
                    {
                        OpenProject.UpdateProjectsList(false, true);
                        updateUIList = false;
                    }
                    foreach (var d in detectorPlugins)
                    {
                        var Entity = d.Entity as Detector;
                        if (Entity != null && Entity.isDirty)
                        {
                            try
                            {
                                await Entity.Save();
                            }
                            catch (Exception ex)
                            {
                                Log.Error(ex.ToString());
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Log.Error(ex.ToString());
                }
            }
        }