コード例 #1
0
ファイル: FileCopy.cs プロジェクト: stompkins111/fad2
        private void WorkerListFilesProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            var worker = (BackgroundWorker)sender;

            Progress.Maximum = 100;
            Progress.Value   = e.ProgressPercentage;
            if (e.UserState == null)
            {
                return;
            }
            if (e.UserState is string)
            {
                CurrentAction.Text = (string)e.UserState;
            }
            else if (e.UserState is MetroTile)
            {
                var tile = (MetroTile)e.UserState;
                FileTooltip.SetToolTip(tile, tile.Text);
                tile.Click += LeftTile_Click;
                LeftPanel.Controls.Add(tile);
                tile.Refresh();
            }
            else if (e.UserState is MetroMessageBoxProperties)
            {
                var props = (MetroMessageBoxProperties)e.UserState;
                try
                {
                    if (MetroMessageBox.Show(this, props.Message, props.Title, props.Buttons, props.Icon) == DialogResult.Cancel)
                    {
                        worker.CancelAsync();
                    }
                }
                catch (Exception ex)
                {
                    _log.Error(ex);
                    worker.CancelAsync();
                }
            }
        }
コード例 #2
0
ファイル: ListBoxItems.cs プロジェクト: deadtrickster/wpfklip
        public FileDropsLBI(string[] files)
            : base(CapturedItemsListController.Instance)
        {
            this.files = files;

            this.Title = CreateTitleString(files);
            this.Tag = files;
            this.MinHeight = 25;

            MouseLeave += new MouseEventHandler(FileDropsLBI_MouseLeave);
            MouseEnter += new MouseEventHandler(FileDropsLBI_MouseEnter);
            tooltip = new FileTooltip(files);
            //tooltip.Topmost = true;
            //tooltip.Background = new  LinearGradientBrush(Colors.White, Colors.Gray,90);

            close_timer.Elapsed += new System.Timers.ElapsedEventHandler(close_timer_Elapsed);
            close_timer.Interval = 200;

            open_timer.Elapsed += new System.Timers.ElapsedEventHandler(open_timer_Elapsed);
            open_timer.Interval = 300;
            //var tooltip = new FileDropFormatToolTip(files);
            //this.ToolTip = tooltip;
            //this.ToolTipClosing += new ToolTipEventHandler(FileDropsLBI_ToolTipClosing);
            //this.ToolTipOpening += new ToolTipEventHandler(FileDropsLBI_ToolTipOpening);
        }
コード例 #3
0
ファイル: FileCopy.cs プロジェクト: stompkins111/fad2
        private void LoadLocalContents(string localPath)
        {
            DisablePanels();
            try
            {
                CurrentAction.Text    = Resources.ReadLocalDir;
                ProgressPanel.Visible = true;

                var currentDirectory = new DirectoryInfo(localPath);
                var files            = currentDirectory.GetFiles();
                var folders          = currentDirectory.GetDirectories();

                RightTiles.Controls.Clear();

                if (Directory.Exists(localPath))
                {
                    LocalPath.Text = localPath;
                    if (localPath.Length > 2)
                    {
                        // parent Tile
                        var parentDirectory = localPath.LastIndexOf("\\") == 0 ? "\\" : localPath.Substring(0, localPath.LastIndexOf("\\"));
                        var tile            = new MetroTile
                        {
                            Text   = "..",
                            Width  = _metroTileSize,
                            Height = _metroTileSize,
                            Tag    = parentDirectory,
                            Style  = MetroColorStyle.Green
                        };
                        tile.Click += RightTile_Click;
                        RightTiles.Controls.Add(tile);
                    }


                    Progress.Maximum = folders.Length;
                    var counter = 0;
                    foreach (var folder in folders.OrderBy(fld => fld.Name))
                    {
                        var tile = new MetroTile
                        {
                            Text = folder.Name, Width = _metroTileSize, Height = _metroTileSize, Style = MetroColorStyle.Yellow,
                            Tag  = folder
                        };
                        tile.Click += RightTile_Click;
                        FileTooltip.SetToolTip(tile, folder.Name);
                        RightTiles.Controls.Add(tile);
                        Progress.Value = counter;
                        counter++;
                        Application.DoEvents();
                    }
                    Progress.Maximum = folders.Length;
                    counter          = 0;
                    foreach (var fileInfo in files.OrderBy(fld => fld.Name))
                    {
                        if (!fileInfo.Name.Contains('.') && _connection.Settings.FileTypesToCopy != (int)ProgramSettings.FileTypes.AllFiles)
                        {
                            continue;
                        }

                        var tile = new MetroTile
                        {
                            Text = fileInfo.Name, Width = _metroTileSize, Height = _metroTileSize,
                            Tag  = fileInfo
                        };
                        tile.Click += RightTile_Click;
                        FileTooltip.SetToolTip(tile, fileInfo.Name);
                        TryGetThumb(tile, fileInfo);
                        RightTiles.Controls.Add(tile);
                        Progress.Value = counter;
                        counter++;
                        Application.DoEvents();
                    }
                }
                ResizeTiles(RightTiles);
                ProgressPanel.Visible = false;
            }
            catch (Exception ex)
            {
                _log.Error(ex);
                MetroMessageBox.Show(this, "That path seems to be terribly wrong.");
            }
            EnablePanels();
        }