コード例 #1
0
        /// <summary>
        /// Validate that minimal inputs are received when this Window Opens, otherwise turn off all editing options and only allow user to Close it.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            collectionMonitor = ((App)Application.Current)._peopleCollection.collectionMonitor;
            collectionMonitor.Subscribe(this);
            AddNewAgentButton.Visibility = Visibility.Hidden;
            AddNewAgentButton.IsEnabled  = false;
            AddNewBuyerButton.Visibility = Visibility.Hidden;
            AddNewBuyerButton.IsEnabled  = false;
            LoadBuyersCombobox();
            LoadAgentsCombobox(true);

            if (UpdateHome != null && UpdateHome.HomeID > -1)
            {
                UpdateHomeSale.HomeID = UpdateHome.HomeID;
            }

            logger = new Logger();
            int count = 0;

            if (UpdateHome != null)
            {
                count++;
            }

            if (UpdateType.Count() > 3)
            {
                count++;
            }

            if (UpdatePerson != null)
            {
                count++;
            }

            if (UpdateHome != null)
            {
                count++;
            }

            if (UpdateReco != null)
            {
                count++;
            }

            if (UpdateHomeSale != null)
            {
                count++;
            }

            if (UpdateAgent != null)
            {
                count++;
            }

            if (UpdateBuyer != null)
            {
                count++;
            }

            if (UpdateOwner != null)
            {
                count++;
            }

            if (count > 2)  //  UpdateHome and UpdateType are absolutely required
            {
                LoadPanelsAndFields();
            }
            else
            {
                ShowCloseButtonOnly();
            }
        }