private int DoImport(ImportBackend imp)
    {
        if (collection == null)
        {
            return(0);
        }

        this.importer = imp;
        AllowFinish   = false;

        total = importer.Prepare();

        if (total > 0)
        {
            UpdateProgressBar(1, total);
        }

        collection.Clear();
        collection.Capacity = total;

        while (total > 0 && this.Step())
        {
            System.DateTime start_time = System.DateTime.Now;
            System.TimeSpan span       = start_time - start_time;

            while (Application.EventsPending() && span.TotalMilliseconds < 100)
            {
                span = System.DateTime.Now - start_time;
                Application.RunIteration();
            }
        }

        return(total);
    }
Exemplo n.º 2
0
    public bool Start()
    {
        if (Dialog != null)
        {
            Dialog.Sensitive = true;
        }

        if (import_path == null)
        {
            return(false);
        }

        string [] pathimport = { ImportPath };
        //this.Dialog.Destroy();

        if (copy_check != null)
        {
            copy = copy_check.Active;
        }

        bool recurse = true;

        if (recurse_check != null)
        {
            recurse = recurse_check.Active;
        }

        bool detect_duplicates = false;

        if (duplicate_check != null)
        {
            detect_duplicates = duplicate_check.Active;
        }

//		importer = new FileImportBackend (store, pathimport, copy, recurse, null);
        importer    = new FileImportBackend(store, pathimport, copy, recurse, detect_duplicates, null, Dialog);
        AllowFinish = false;

        total = importer.Prepare();

        if (total > 0)
        {
            UpdateProgressBar(1, total);
        }

        collection.Clear();
        collection.Capacity = total;

        if (total > 0)
        {
            step.Start();
        }

        return(false);
    }
	public bool Start ()
	{
		if (Dialog != null)
			Dialog.Sensitive = true;

		if (import_path == null)
			return false;

		string [] pathimport =  {ImportPath};
		//this.Dialog.Destroy();
		
		if (copy_check != null)
			copy = copy_check.Active;
		
		bool recurse = true;
		if (recurse_check != null)
			recurse = recurse_check.Active;
		
//		importer = new FileImportBackend (store, pathimport, copy, recurse, null);
		importer = new FileImportBackend (store, pathimport, copy, recurse, null, Dialog);
		AllowFinish = false;
		
		total = importer.Prepare ();
		
		if (total > 0)
			UpdateProgressBar (1, total);
		
		collection.Clear ();
		collection.Capacity = total;

		if (total > 0)
			step.Start ();
	       
		return false;
	}
	private int DoImport (ImportBackend imp)
	{
		if (collection == null)
			return 0;

		this.importer = imp;
		AllowFinish = false;
		
		total = importer.Prepare ();

		if (total > 0)
			UpdateProgressBar (1, total);
		
		collection.Clear ();
		collection.Capacity = total;

		while (total > 0 && this.Step ()) {
			System.DateTime start_time = System.DateTime.Now;
			System.TimeSpan span = start_time - start_time;

			while (Application.EventsPending () && span.TotalMilliseconds < 100) {
				span = System.DateTime.Now - start_time;
				Application.RunIteration ();
			}
		}

		return total;
	}