Soru & Cevap

System.InvalidOperationException: 'DragDrop kaydı yapıl ...

19.06.2020 - 03:36

Bu Benim Program.cs Dosyasındaki kodum:

using MarkePro;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using Dropbox.Api;

namespace MarkePro_V3._0
{
    static class Program
    {
       
        /// <summary>
        /// Uygulamanın ana girdi noktası.
        /// </summary>
        [STAThread]
        static public void Gunc()
        {
            var task = Task.Run((Func<Task>)Program.Run);
            task.Wait();
        }
        static void Main()
        {
            
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);


            
            Application.Run(new anaMenu());
  
        }
        static string token = "EpeVFHrn7hAAAAAAAAAAJnkhf4_nShizUPOu-6X-DGz3KM8dfdRYQ4jLh5qcLdNv";
        
        static async Task Run()
        {
            using ( var dbx = new DropboxClient(token))
            {
                string folder = "";
                string file = "guncellemenot.xml";
                using (var response = await dbx.Files.DownloadAsync(folder + "/" + file)) 
                {
                    var d = response.GetContentAsByteArrayAsync();
                    d.Wait();
                    var s = d.Result;
                    File.WriteAllBytes(file, s);
                }
            }
        }
    }
}

Hata Kodun 32. Satırında Çıkıyor. Tam Hata Kodu:

https://hizliresim.com/PRIiyp

System.InvalidOperationException
  HResult=0x80131509
  İleti=DragDrop kaydı yapılamadı.
  Kaynak=System.Windows.Forms
  StackTrace:
   konum System.Windows.Forms.Control.SetAcceptDrops(Boolean accept)
   konum System.Windows.Forms.Control.OnHandleCreated(EventArgs e)
   konum System.Windows.Forms.Control.WmCreate(Message& m)
   konum System.Windows.Forms.Control.WndProc(Message& m)
   konum System.Windows.Forms.MdiClient.WndProc(Message& m)
   konum System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   konum System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   konum System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

İçteki Özel Durum 1:
ThreadStateException: OLE çağrıları yapılmadan önce geçerli iş parçacığının tek iş parçacığı apartmanı (STA) moduna ayarlanması gerekir. Main işlevinizin STAThreadAttribute özniteliğinin işaretli olduğundan emin olun.

Yardımcı Olursanız Sevinirim.

381 Görüntülenme

1 Cevap

Sitedeki sorulara cevap verebilmek için giriş yapın ya da üye olun.

picture-285433-1598048484.png
cezeri
22.08.2020 - 01:38

Linki inceleyebilirsin iyi çalışmalar.

https://stackoverflow.com/questions/135803/dragdrop-registration-did-not-succeed