private void DeleteTaskListLocationButton_Click(object sender, RoutedEventArgs e)
        {
            TaskListLocation taskListLocation = (TaskListLocation)TaskListLocationListBox.SelectedItem;

            Configuration.WorkflowConfiguration.TaskListLocations.Remove(taskListLocation);
            RefreshTaskListLocationsListBox();
        }
        private void SelectLocationButton_Click(object sender, RoutedEventArgs e)
        {
            TaskListLocation workflowLocation = (TaskListLocation)this.Tag;

            SiteSetting siteSetting = (SiteSetting)SiteSettingComboBox.SelectedItem;
            Folder      rootFolder  = null;


            SiteContentSelections siteContentSelections = new SiteContentSelections();

            rootFolder = new SPWeb(siteSetting.Url, siteSetting.Url, siteSetting.ID, String.Empty, siteSetting.Url, siteSetting.Url);
            rootFolder.PublicFolder = true;
            siteContentSelections.InitializeForm(siteSetting, rootFolder, true, new int[] { 107 });

            if (siteContentSelections.ShowDialog(this.ParentWindow, "Site Content Selections") == true)
            {
                workflowLocation.Folder = siteContentSelections.SelectedFolder;
                workflowLocation.BasicFolderDefinition = workflowLocation.Folder.GetBasicFolderDefinition();
                SelectedFolderLabel.Content            = workflowLocation.Folder.GetUrl();
            }
            //    if (workflowLocation.Folder == null)
            //    {
            //    }
            //else
            //{
            //    rootFolder = workflowLocation.Folder;
            //    siteContentSelections.InitializeForm(siteSetting, rootFolder, true, new int[] { 107 });
            //    if (siteContentSelections.ShowDialog(this.ParentWindow, "Site Content Selections") == true)
            //    {
            //        workflowLocation.Folder = siteContentSelections.SelectedFolder;
            //        workflowLocation.BasicFolderDefinition = workflowLocation.Folder.GetBasicFolderDefinition();
            //        SelectedFolderLabel.Content = workflowLocation.Folder.GetUrl();
            //    }
            //}
        }
        protected void ParentWindow_OKButtonSelected(object sender, EventArgs e)
        {
            TaskListLocation workflowLocation = (TaskListLocation)this.Tag;

            workflowLocation.SiteSettingID = (Guid)SiteSettingComboBox.SelectedValue;
            workflowLocation.Name          = TaskListNameTextBox.Text;

            workflowLocation.ApplicationTypes = new List <ApplicationTypes>();
            if (GeneralATCheckBox.IsChecked == true)
            {
                workflowLocation.ApplicationTypes.Add(ApplicationTypes.General);
            }
            if (WordATCheckBox.IsChecked == true)
            {
                workflowLocation.ApplicationTypes.Add(ApplicationTypes.Word);
            }
            if (ExcelATCheckBox.IsChecked == true)
            {
                workflowLocation.ApplicationTypes.Add(ApplicationTypes.Excel);
            }
            if (OutlookATCheckBox.IsChecked == true)
            {
                workflowLocation.ApplicationTypes.Add(ApplicationTypes.Outlook);
            }

            if (workflowLocation.ShowAll == true)
            {
                SiteSetting siteSetting = (SiteSetting)SiteSettingComboBox.SelectedItem;
                workflowLocation.Folder = new SPWeb(siteSetting.Url, siteSetting.Url, siteSetting.ID, String.Empty, siteSetting.Url, siteSetting.Url);
                workflowLocation.BasicFolderDefinition = workflowLocation.Folder.GetBasicFolderDefinition();
                workflowLocation.Folder.Selected       = true;
            }
        }
        protected override void OnLoad()
        {
            base.OnLoad();
            LoadSiteSettings();

            TaskListLocation workflowLocation = this.Tag as TaskListLocation;

            this.SelectedSiteSettingID = workflowLocation.SiteSettingID;

            if (workflowLocation.ApplicationTypes.Contains(ApplicationTypes.General) == true)
            {
                GeneralATCheckBox.IsChecked = true;
            }

            if (workflowLocation.ApplicationTypes.Contains(ApplicationTypes.Excel) == true)
            {
                ExcelATCheckBox.IsChecked = true;
            }

            if (workflowLocation.ApplicationTypes.Contains(ApplicationTypes.Outlook) == true)
            {
                OutlookATCheckBox.IsChecked = true;
            }

            if (workflowLocation.ApplicationTypes.Contains(ApplicationTypes.Word) == true)
            {
                WordATCheckBox.IsChecked = true;
            }

            if (SelectedSiteSettingID != null && SelectedSiteSettingID != Guid.Empty)
            {
                SiteSettingComboBox.SelectedValue = SelectedSiteSettingID;
            }
            else
            {
                if (SiteSettingComboBox.Items.Count > 0)
                {
                    SiteSettingComboBox.SelectedIndex = 0;
                }
            }

            if (workflowLocation.Folder != null)
            {
                SelectedFolderLabel.Content = workflowLocation.Folder.GetUrl();
            }

            TaskListNameTextBox.Text = workflowLocation.Name;
        }
        private void TaskListLocationListBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (TaskListLocationListBox.SelectedItem == null)
            {
                return;
            }
            TaskListLocation     taskListLocation     = (TaskListLocation)TaskListLocationListBox.SelectedItem;
            TaskListLocationForm taskListLocationForm = new TaskListLocationForm();

            taskListLocationForm.Initialize(Configuration.SiteSettings);
            taskListLocationForm.BindControls(taskListLocation);
            if (taskListLocationForm.ShowDialog(null, "Edit Task List Location") == true)
            {
                RefreshTaskListLocationsListBox();
            }
        }
        private void AddTaskListLocationButton_Click(object sender, RoutedEventArgs e)
        {
            TaskListLocation taskListLocation = new TaskListLocation();

            taskListLocation.ID = Guid.NewGuid();
            taskListLocation.ApplicationTypes.Add(ApplicationTypes.Excel);
            taskListLocation.ApplicationTypes.Add(ApplicationTypes.General);
            taskListLocation.ApplicationTypes.Add(ApplicationTypes.Outlook);
            taskListLocation.ApplicationTypes.Add(ApplicationTypes.Word);

            TaskListLocationForm taskListLocationForm = new TaskListLocationForm();

            taskListLocationForm.Initialize(Configuration.SiteSettings);
            taskListLocationForm.BindControls(taskListLocation);
            if (taskListLocationForm.ShowDialog(null, "New Task List Location") == true)
            {
                Configuration.WorkflowConfiguration.TaskListLocations.Add(taskListLocation);
                RefreshTaskListLocationsListBox();
            }
        }
Ejemplo n.º 7
0
        private void LoadTasks_Callback(object _item, DateTime dateTime)
        {
            object[]         args             = ((object[])_item);
            SiteSetting      siteSetting      = (SiteSetting)args[0];
            TaskListLocation taskListLocation = (TaskListLocation)args[1];
            ListView         tasksListView    = (ListView)args[2];
            List <string>    assignedTos      = (List <string>)args[3];
            List <string>    statuses         = (List <string>)args[4];
            List <string>    priorities       = (List <string>)args[5];
            Image            loadingImage     = (Image)args[6];
            Image            refreshImage     = (Image)args[7];

            List <Task> tasks = new List <Task>();

            CamlFilters customFilters = new CamlFilters();

            customFilters.IsOr = false;
            if (assignedTos.Count == 0)
            {
                customFilters.Add(new CamlFilter("AssignedTo", FieldTypes.Number, CamlFilterTypes.Equals, "[Me]"));
            }
            foreach (string filterValue in statuses)
            {
                customFilters.Add(new CamlFilter("Status", FieldTypes.Choice, CamlFilterTypes.NotEqual, filterValue));
            }
            foreach (string filterValue in priorities)
            {
                customFilters.Add(new CamlFilter("Priority", FieldTypes.Choice, CamlFilterTypes.NotEqual, filterValue));
            }

            int    itemCount;
            string listItemCollectionPositionNext = String.Empty;

            List <IItem> items = ServiceManagerFactory.GetServiceManager(siteSetting.SiteSettingType).GetListItems(siteSetting, taskListLocation.Folder, null, string.Empty, true, 0, string.Empty, customFilters, false, out listItemCollectionPositionNext, out itemCount);

            if (items.Count == 0)
            {
                Task emptyTask = new Task();
                emptyTask.Title = Languages.Translate("No items to display");
                tasks.Add(emptyTask);
            }
            foreach (IItem item in items)
            {
                Task task = new Task();
                task.SiteSettingID = siteSetting.ID;
                task.ID            = item.GetID();
                task.Title         = item.Title;
                if (item.Properties.ContainsKey("ows_Priority") == true)
                {
                    task.Priority = item.Properties["ows_Priority"];
                }
                if (item.Properties.ContainsKey("ows_Status") == true)
                {
                    task.Status = item.Properties["ows_Status"];
                }
                if (item.Properties.ContainsKey("ows_AssignedTo") == true)
                {
                    string assignedTo = item.Properties["ows_AssignedTo"];
                    if (string.IsNullOrEmpty(assignedTo) == false)
                    {
                        string[] assignedToArray = assignedTo.Split(new string[] { ";#" }, StringSplitOptions.None);
                        task.AssignedToID = int.Parse(assignedToArray[0]);
                        task.AssignedTo   = assignedToArray[1];
                    }
                }

                if (item.Properties.ContainsKey("ows_WorkflowLink") == true)
                {
                    string workflowLink = item.Properties["ows_WorkflowLink"];
                    if (string.IsNullOrEmpty(workflowLink) == false)
                    {
                        int titleStartIndex = workflowLink.IndexOf(",");
                        task.RelatedContentUrl   = workflowLink.Substring(0, titleStartIndex);
                        task.RelatedContentTitle = workflowLink.Substring(titleStartIndex + 1);
                    }
                }


                task.ListUrl = taskListLocation.Folder.GetUrl();
                tasks.Add(task);
            }

            this.TasksListView.Dispatcher.Invoke(DispatcherPriority.Input, new ThreadStart(() =>
            {
                CollectionViewSource cvs = new CollectionViewSource();
                cvs.Source = tasks;
                cvs.GroupDescriptions.Add(new PropertyGroupDescription("ListUrl"));

                this.TasksListView.ItemsSource = cvs.View;

                refreshImage.Visibility = System.Windows.Visibility.Visible;
                loadingImage.Visibility = System.Windows.Visibility.Collapsed;
            }));

            this.IsDataLoaded = true;
        }
Ejemplo n.º 8
0
 public void Initialize(SiteSetting siteSetting, TaskListLocation taskListLocation)
 {
     this.IsDataLoaded     = false;
     this.SiteSetting      = siteSetting;
     this.TaskListLocation = taskListLocation;
 }