예제 #1
0
        public void ShowSearchDialog(SearchParameters lastSearchParams, Action <bool, SearchParameters> dialogCompleteCallback)
        {
            if (lastSearchParams == null)
            {
                throw new ArgumentNullException(nameof(lastSearchParams));
            }

            if (dialogCompleteCallback == null)
            {
                throw new ArgumentNullException(nameof(dialogCompleteCallback));
            }

            SearchWindowVM vm = this.kernel.Get <SearchWindowVM>();

            vm.Username  = lastSearchParams.Username;
            vm.VideoType = lastSearchParams.VideoType;
            vm.LoadLimit = lastSearchParams.LoadLimit;

            SearchWindow window = this.kernel.Get <SearchWindow>();

            window.DataContext = vm;

            bool?result = window.ShowDialog();

            SearchParameters resultObject = vm.ResultObject;

            dialogCompleteCallback(result != true, resultObject);
        }
예제 #2
0
        public SearchWindow()
        {
            try
            {
                InitializeComponent();

                SearchVM    = new SearchWindowVM();
                DataContext = SearchVM;

                if (SearchVM.CloseAction == null)
                {
                    SearchVM.CloseAction = new Action(this.Close);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
                throw ex;
            }
        }