Exemplo n.º 1
0
        private static void SetupFolderSelectionColumns(DataGridView dataGridView, IOptionTasks optionTasks, params OlItemType[] allowedFolderType)
        {
            var folderColumn = new DataGridViewTextBoxColumn();

            folderColumn.HeaderText   = "Selected Outlook Folder";
            folderColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            dataGridView.Columns.Add(folderColumn);

            var selectFolderColumn = new DataGridViewButtonColumn();

            selectFolderColumn.UseColumnTextForButtonValue = true;
            selectFolderColumn.Text         = "...";
            selectFolderColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dataGridView.Columns.Add(selectFolderColumn);

            var removeFolderColumn = new DataGridViewButtonColumn();

            removeFolderColumn.UseColumnTextForButtonValue = true;
            removeFolderColumn.Text         = "x";
            removeFolderColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dataGridView.Columns.Add(removeFolderColumn);

            dataGridView.CellContentClick += (sender, e) =>
            {
                var column     = dataGridView.Columns[e.ColumnIndex];
                var row        = dataGridView.Rows[e.RowIndex];
                var viewModel  = (ResourceDataViewModelBase)row.DataBoundItem;
                var folderCell = row.Cells[folderColumn.Index];

                if (column == selectFolderColumn)
                {
                    var folder = optionTasks.PickFolderOrNull();
                    if (folder != null)
                    {
                        if (Array.IndexOf(allowedFolderType, folder.DefaultItemType) == -1)
                        {
                            MessageBox.Show($"Folder has to have item type '{String.Join (", ", allowedFolderType)}'.", "Select folder", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }

                        folderCell.Value         = folder.Name;
                        viewModel.SelectedFolder = new FolderDescriptor(folder.EntryId, folder.StoreId);
                    }
                }
                else if (column == removeFolderColumn)
                {
                    viewModel.SelectedFolder = null;
                    folderCell.Value         = null;
                }
            };
        }
Exemplo n.º 2
0
        private void SelectFolder()
        {
            var folder = _optionTasks.PickFolderOrNull();

            if (folder != null)
            {
                if (!_model.SetFolder(folder))
                {
                    string wrongFolderMessage = Strings.Get($"Wrong ItemType in folder '{folder.Name}'. It should be a calendar, task or contact folder.");
                    MessageBox.Show(wrongFolderMessage, Strings.Get($"Configuration Error"));
                    return;
                }
            }
        }
        private void SelectFolder()
        {
            var folder = _optionTasks.PickFolderOrNull();

            if (folder != null && folder.DefaultItemType == OlItemType.olAppointmentItem)
            {
                _selectedFolder    = folder;
                SelectedFolderName = folder.Name;
            }
            else
            {
                MessageBox.Show(
                    "You need to choose a calendar folder to merge the EasyProject resources!",
                    ComponentContainer.MessageBoxTitle,
                    MessageBoxButton.OK,
                    MessageBoxImage.Error);
            }
        }
        private void SelectFolder()
        {
            var folder = _optionTasks.PickFolderOrNull();

            if (folder != null)
            {
                UpdateFolder(folder);
                UpdateFolderAccountName();
            }

            _faultFinder.FixTimeRangeUsage(OutlookFolderType);

            if (OutlookFolderType == OlItemType.olContactItem)
            {
                MessageBox.Show(
                    "The contact synchronization is still in development and doesn't support contact groups/distribution lists at the moment!",
                    ComponentContainer.MessageBoxTitle,
                    MessageBoxButton.OK,
                    MessageBoxImage.Warning);
            }
        }
Exemplo n.º 5
0
        private void SelectFolder()
        {
            var folder = _optionTasks.PickFolderOrNull();

            if (folder != null)
            {
                if (!_model.SetFolder(folder))
                {
                    string wrongFolderMessage = string.Format("Wrong ItemType in folder '{0}'. It should be a calendar, task or contact folder.", folder.Name);
                    MessageBox.Show(wrongFolderMessage, "Configuration Error");
                    return;
                }

                if (folder.DefaultItemType == OlItemType.olContactItem)
                {
                    MessageBox.Show(
                        "Synchronization of Outlook distribution lists is only supported for SOGo at the moment!",
                        ComponentContainer.MessageBoxTitle,
                        MessageBoxButton.OK,
                        MessageBoxImage.Warning);
                }
            }
        }
    private static void SetupFolderSelectionColumns (DataGridView dataGridView, IOptionTasks optionTasks, params OlItemType[] allowedFolderType)
    {
      var folderColumn = new DataGridViewTextBoxColumn();
      folderColumn.HeaderText = "Selected Outlook Folder";
      folderColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
      dataGridView.Columns.Add (folderColumn);

      var selectFolderColumn = new DataGridViewButtonColumn();
      selectFolderColumn.UseColumnTextForButtonValue = true;
      selectFolderColumn.Text = "...";
      selectFolderColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
      dataGridView.Columns.Add (selectFolderColumn);

      var removeFolderColumn = new DataGridViewButtonColumn();
      removeFolderColumn.UseColumnTextForButtonValue = true;
      removeFolderColumn.Text = "x";
      removeFolderColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
      dataGridView.Columns.Add (removeFolderColumn);

      dataGridView.CellContentClick += (sender, e) =>
      {
        var column = dataGridView.Columns[e.ColumnIndex];
        var row = dataGridView.Rows[e.RowIndex];
        var viewModel = (ResourceDataViewModelBase) row.DataBoundItem;
        var folderCell = row.Cells[folderColumn.Index];

        if (column == selectFolderColumn)
        {
          var folder = optionTasks.PickFolderOrNull();
          if (folder != null)
          {
            if (Array.IndexOf (allowedFolderType, folder.DefaultItemType) == -1)
            {
              MessageBox.Show ($"Folder has to have item type '{String.Join (", ", allowedFolderType)}'.", "Select folder", MessageBoxButtons.OK, MessageBoxIcon.Error);
              return;
            }

            folderCell.Value = folder.Name;
            viewModel.SelectedFolder = new FolderDescriptor (folder.EntryId, folder.StoreId);
          }
        }
        else if (column == removeFolderColumn)
        {
          viewModel.SelectedFolder = null;
          folderCell.Value = null;
        }
      };
    }