locked
Async API for simple things is too complicated

    General discussion

  • I think, for example, the code required to show an open file dialog is insanely large:

     

    auto l_fop = ref new Windows::Storage::Pickers::FileOpenPicker();
    	l_fop->CommitButtonText = "Select a file!";
    
    	l_fop->FileTypeFilter->Append ( ".jpg" );
    	auto res = l_fop->PickSingleFileAsync();
    	res->Completed = ref new AsyncOperationCompletedHandler<StorageFile^>([this](IAsyncOperation<StorageFile^>^ operation) {
    		if ( AsyncStatus::Completed==operation->Status ) 
            { 
    			Windows::Storage::StorageFile ^l_file = operation->GetResults();
    			if ( l_file!=nullptr )
    			{
    				String ^str = l_file->Path;
    			}
    		}
    		else
    		{
    			// emit error
    		}
    	});
    
    	res->Start();
    }
    


    I ** REALLY** think you should make that much easier. We use WinRT/.NET to SIMPLIFY things, not to complicate them.... for that I can continue using MFC.

     

    Do you really think we really want this for a super-simple task like opening a file dialog, omg?

     




    Friday, February 03, 2012 6:58 AM

All replies