コード例 #1
0
        private void Pulsar_DragDrop(object sender, DragEventArgs e)
        {
            bool handled = false;
            PulsarDropFileHandler handler;

            if (e.Data.GetDataPresent(DataFormats.FileDrop))
            {
                string[] strArray = (string[])e.Data.GetData(DataFormats.FileDrop);
                if (strArray == null)
                {
                    return;
                }

                if (strArray.Length < 1)
                {
                    return;
                }

                for (int i = 0; i < strArray.Length; i++)
                {
                    string str2     = FileOperations.RemoveURI(strArray[i]);
                    string fullName = FileOperations.StripFileName(str2);
                    string fileExt  = Path.GetExtension(fullName).ToLower(CultureInfo.InvariantCulture);

                    if (dropFileHandlers.ContainsKey(fileExt))
                    {
                        handler = dropFileHandlers[fileExt];
                    }
                    else
                    {
                        handler = null;
                    }

                    if (handler != null)
                    {
                        PulsarEventArgs arg = new PulsarEventArgs(fullName);
                        try
                        {
                            handler(arg);
                            handled = arg.Handled;
                        }
                        catch
                        {
                            handled = false;
                        }
                        arg.Dispose();
                    }
                    if (!handled)
                    {
                        InstallKrentoPart(fullName);
                    }
                }
            }
        }
コード例 #2
0
        private void MyPicturesHandler(PulsarEventArgs e)
        {
            string shortName = Path.GetFileName(e.FileName);

            File.Copy(e.FileName, FileOperations.IncludeTrailingPathDelimiter(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures)) + shortName, true);
            if (GlobalSettings.ShowPopupAlerts)
            {
                notifier.Caption = SR.KrentoNotification;
                notifier.Text    = SR.CopyPicture(shortName);
                notifier.Url     = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
                notifier.Show();
            }
        }