Example #1
0
        public void CopyToClipboard()
        {
            var items   = (SelectedItems?.Any() ?? false) ? SelectedItems : Items;
            var logText = string.Join(Environment.NewLine, items ?? new List <string>());

            try
            {
                var dataPackage = new DataPackage();
                dataPackage.RequestedOperation = DataPackageOperation.Copy;
                dataPackage.SetText(logText);

                Clipboard.SetContent(dataPackage);
                Clipboard.Flush();
            }
            catch (Exception e)
            {
                Logger.Current.Error(e);
            }
        }
        private void FileStatusListView_MouseDown(object sender, MouseEventArgs e)
        {
            // SELECT
            if (e.Button == MouseButtons.Right)
            {
                var hover = FileStatusListView.HitTest(e.Location);

                if (hover.Item != null && !hover.Item.Selected)
                {
                    ClearSelected();

                    hover.Item.Selected = true;
                }
            }

            // DRAG
            if (e.Button == MouseButtons.Left)
            {
                if (SelectedItems.Any())
                {
                    // Remember the point where the mouse down occurred.
                    // The DragSize indicates the size that the mouse can move
                    // before a drag event should be started.
                    Size dragSize = SystemInformation.DragSize;

                    // Create a rectangle using the DragSize, with the mouse position being
                    // at the center of the rectangle.
                    _dragBoxFromMouseDown = new Rectangle(new Point(e.X - (dragSize.Width / 2),
                                                                    e.Y - (dragSize.Height / 2)),
                                                          dragSize);
                }
                else
                {
                    // Reset the rectangle if the mouse is not over an item in the ListView.
                    _dragBoxFromMouseDown = Rectangle.Empty;
                }
            }
        }
Example #3
0
 bool CanRemoveUserRole()
 {
     return(SelectedItems.Any());
 }
Example #4
0
 private bool CopyCommandCanExecute(object obj)
 {
     return(SelectedItems.Any());
 }
Example #5
0
 private bool CanExecuteAlignmentMethod()
 {
     return(SelectedItems.Any());
 }
Example #6
0
 /// <summary>
 /// Method to check whether the DecreaseLightSize command can be executed.
 /// </summary>
 /// <returns><c>true</c> if the command can be executed; otherwise <c>false</c></returns>
 private bool CanDecreaseLightSize()
 {
     return(SelectedItems.Any());
 }
Example #7
0
 private bool HasItems(object o)
 {
     return(SelectedItems.Any());
 }
Example #8
0
 private bool HasSelectedAudios()
 {
     return(SelectedItems.Count > 0 && SelectedItems.Any(o => o is Audio));
 }
Example #9
0
        private bool CanDelete()
        {
            var result = !WaitIndicatorVisible && SelectedItems != null && SelectedItems.Count > 0 && !SelectedItems.Any(p => !p.IsNew && p.IsDirty);

            if (result)
            {
                OnBeforeSave();
            }
            return(result);
        }
 private bool GetCheckedState(SelectedItem item) => SelectedItems.Any(i => i.Value == item.Value);
Example #11
0
 private bool CanSave(object obj)
 {
     return(SelectedItems.Any() && SelectedTags.Any());
 }
Example #12
0
 /// <summary>
 /// Method to check whether the ReverseSelected command can be executed.
 /// </summary>
 /// <returns><c>true</c> if the command can be executed; otherwise <c>false</c></returns>
 private bool CanReverseSelected()
 {
     return(SelectedItems.Any());
 }
Example #13
0
 private bool CanImport()
 {
     return(SelectedItems.Any());
 }
Example #14
0
 private bool CanDeleteSelected()
 {
     return(SelectedItems.Count > 0 && SelectedItems.Any(o => o is Audio || o is Video || o is Doc));
 }
Example #15
0
 bool CanEditUserRole()
 {
     return(SelectedItems.Any());
 }
Example #16
0
 /// <summary>
 /// Method to check whether the Copy command can be executed.
 /// </summary>
 /// <returns><c>true</c> if the command can be executed; otherwise <c>false</c></returns>
 private bool CanCopy()
 {
     return(SelectedItems.Any() && CanGroup());
 }
        protected override void InitSpecialCommands()
        {
            CopyAttachmentsCommand = new DelegateLogCommand(
                () =>
            {
                IEventServiceClient eventServiceClient = Container.Resolve <IEventServiceClient>();
                IMessageService messageService         = Container.Resolve <IMessageService>();

                if (SelectedItems != null && SelectedItems.Any())
                {
                    var selectedProjects = SelectedItems.ToList();
                    var managers         = selectedProjects.Select(project => project.Manager).Distinct().ToList();
                    var managersOffline  = new List <User>();
                    foreach (var manager in managers)
                    {
                        if (eventServiceClient.UserConnected(manager.Id) == false)
                        {
                            managersOffline.Add(manager);
                        }
                    }

                    if (managersOffline.Any())
                    {
                        var dr = messageService.ShowYesNoMessageDialog("Некоторые менеджеры не подключены", $"{managersOffline.ToStringEnum()} не подключены. Продолжаем?");
                        if (dr != MessageDialogResult.Yes)
                        {
                            return;
                        }
                    }

                    managersOffline.ForEach(user => managers.Remove(user));
                    if (managers.Any())
                    {
                        using (var fdb = new FolderBrowserDialog())
                        {
                            var dialogResult = fdb.ShowDialog();
                            if (dialogResult == DialogResult.OK && !string.IsNullOrWhiteSpace(fdb.SelectedPath))
                            {
                                var selectedDirectoryPath = fdb.SelectedPath;

                                foreach (var selectedProject in selectedProjects)
                                {
                                    if (!managers.Contains(selectedProject.Manager))
                                    {
                                        continue;
                                    }

                                    var targetDirectoryPath = Path.Combine(selectedDirectoryPath, selectedProject.Id.ToString().Replace("-", string.Empty));
                                    this.Container.Resolve <IFileManagerService>().CreateDirectoryPathIfNotExists(targetDirectoryPath);
                                    eventServiceClient.CopyProjectAttachmentsRequest(selectedProject.Manager.Id, selectedProject.Id, targetDirectoryPath);
                                }

                                messageService.ShowOkMessageDialog("Info", $"Started copy proccess to: {selectedDirectoryPath}");
                            }
                        }
                    }
                }
            },
                () => SelectedItem != null);

            this.SelectedLookupChanged += lookup => CopyAttachmentsCommand.RaiseCanExecuteChanged();
        }
Example #18
0
 private bool CanExecuteDownloadSelectedCommand()
 {
     return(SelectedItems.Count > 0 && SelectedItems.Any(o => o is Audio || o is Doc));
 }