Exemple #1
0
        protected override void UserControlLoaded(object sender, RoutedEventArgs e)
        {
            Sponsor.ReasonConfirmation += SponsorReasonConfirmation;

            InitializePotentialMatchesGridGrouping();

            WPFHelpers.GridSort(gridForms, "Purchased", ListSortDirection.Descending);
            WPFHelpers.GridSort(gridRemarks, new[] { "Alert", "LastUpdate" }, new[] { ListSortDirection.Descending, ListSortDirection.Descending });

            Sponsor.Transactions.CollectionChanged += (s, a) => { if (a.NewItems != null)
                                                                  {
                                                                      TransactionsDataGrid.ScrollIntoView(a.NewItems[0]);
                                                                  }
            };                                                                                                                             //nugget: AutoScroll DataGrid
            rdoHideReturnedTaxForms.IsChecked = true;

            if (Sponsor.TaxFormsCountReturnedNotFiled > 0)
            {
                ReturnedNotFiledLabel.Background = ReturnedNotFiledLabel.Background.BeginBrushColorAnimation(Colors.Red);
            }

            if (Sponsor.Class1TaxFormsCountUnreturned > SettingsModel.MaxClass1FormsCount)
            {
                UnreturnedLabel.Background = UnreturnedLabel.Background.BeginBrushColorAnimation(Colors.Red);
            }

            Sponsor.PropertyChanged += SponsorPropertyChanged;

            gridMembers.ItemContainerGenerator.ContainerFromIndex(0).FindChild <TextBox>(c => c.Name == "txtSSN1").Focus();
        }
Exemple #2
0
        private void PluginInit()
        {
            var types = TypeLocator.FindTypes("*plugin*.dll", typeof(PanelBase));

            foreach (Type type in types)
            {
                PluginInfo             info = new PluginInfo();
                PanelMetadataAttribute atty = type.GetAttribute <PanelMetadataAttribute>();
                info.PluginType = type;
                if (atty != null && !string.IsNullOrWhiteSpace(atty.DisplayName))
                {
                    info.Name = atty.DisplayName;
                }
                else
                {
                    info.Name = PascalCaseSplitter.Split(type.Name);
                }
                if (atty != null && !string.IsNullOrWhiteSpace(atty.IconPath))
                {
                    info.Icon = WPFHelpers.GetImage(atty.IconPath, info.PluginType.Assembly);
                }
                if (info.Icon == null)
                {
                    info.Icon = WPFHelpers.GetImage("images/puzzle-piece.png");
                }
                this.Invoke(() => Plugins.Add(info));
            }
            this.BeginInvoke(() => { if (SelectedPanel == null)
                                     {
                                         SelectedPanel = Plugins[0];
                                     }
                             });
        }
        protected override void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            base.UserControl_Loaded(sender, e);

            //nugget: see here: http://social.msdn.microsoft.com/forums/en-US/wpf/thread/63974f4f-d9ee-45af-8499-42f29cbc22ae?prof=required
            //nugget: unfortunately any kind of code driven or user driven sorting blows away custom DataGridColumn.GetCellContent() modifications like my initial hyperlinking approach... i'll have to come back to this
            //gridRemarks_HyperLinkOrderNumbers();

            WPFHelpers.GridSort(gridForms, "Purchased", System.ComponentModel.ListSortDirection.Descending);
            WPFHelpers.GridSort(gridRemarks, new string[] { "Alert", "LastUpdate" }, new ListSortDirection[] { ListSortDirection.Descending, ListSortDirection.Descending });

            SponsorBO.Transactions.CollectionChanged += (s, a) => { if (a.NewItems != null)
                                                                    {
                                                                        TransactionsDataGrid.ScrollIntoView(a.NewItems[0]);
                                                                    }
            };                                                                                                                               //nugget: AutoScroll DataGrid
            rdoHideReturnedTaxForms.IsChecked = true;

            if (SponsorBO.TaxForms_CountReturnedNotFiled > 0)
            {
                ReturnedNotFiledLabel.Background = ReturnedNotFiledLabel.Background.BeginBrushColorAnimation(Colors.Red);
            }

            //btnSuspend_Checked(null, null); //just to jiggle the
        }
        public Returns()
        {
            InitializeComponent();

            iTRAACHelpers.WpfDataGridStandardBehavior(gridReturns);
            WPFHelpers.FocusOnVisible(txtSequenceNumber);
        }
 private void buttonInsertCode_Click(object sender, EventArgs e)
 {
     if (_textBox != null)
     {
         WPFHelpers.InsertCodePlaceholderIntoTextBox(_textBox);
         _textBox.Focus();
     }
 }
        public tabCustomer()
        {
            InitializeComponent();

            WPFHelpers.WPFDataGrid_Standard_Behavior(gridDependents);
            WPFHelpers.WPFDataGrid_Standard_Behavior(gridForms);
            gridDependents.AutoGeneratingColumn += new System.EventHandler <DataGridAutoGeneratingColumnEventArgs>(iTRAACHelpers.CommonGridColumns);
            gridForms.Loaded += new RoutedEventHandler(gridForms_Loaded);
        }
 private void MergeNewMatches(DataTable NewMatches)
 {
     PotentialMatches.Merge(NewMatches);
     splitterMatches.Visibility = groupMatches.Visibility = (PotentialMatches.Rows.Count > 0) ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed;
     if (PotentialMatches.Rows.Count > 0 && MatchesColumn.ActualWidth == 0.0) //just for aesthetics, don't muck with the matches window width if it's already been opened for displaying previous matches
     {
         WPFHelpers.GridSplitterOpeningBounce(MatchesColumn, 300, true);
     }
 }
 private object GetFirstVisibleItem(ListBox listBox)
 {
     foreach (var item in listBox.Items)
     {
         var itemContainer = (ListBoxItem)listBox.ItemContainerGenerator.ContainerFromItem(item);
         if (WPFHelpers.IsObjectVisibleInContainer(itemContainer, listBox) == ControlVisibility.Full)
         {
             return(item);
         }
     }
     return(null);
 }
Exemple #9
0
        public CustomerSearch()
        {
            InitializeComponent();

            txtSSN1.PreviewTextInput += WPFHelpers.IntegerOnlyTextBoxPreviewTextInput;
            txtSSN2.PreviewTextInput += WPFHelpers.IntegerOnlyTextBoxPreviewTextInput;
            txtSSN3.PreviewTextInput += WPFHelpers.IntegerOnlyTextBoxPreviewTextInput;

            txtDoDId.PreviewTextInput += WPFHelpers.IntegerOnlyTextBoxPreviewTextInput;

            iTRAACHelpers.WpfDataGridStandardBehavior(gridCustomerSearch);

            WPFHelpers.FocusOnVisible(txtCCode);
        }
Exemple #10
0
        /// <summary>
        /// Init MenuListBoxSampleData (get all items in .View namespace) and move currentItem to startview res!
        /// </summary>
        private void InitializeMenuListBoxSampleData()
        {
            Type[] types = WPFHelpers.GetTypesInNamespace(Assembly.GetExecutingAssembly(), Assembly.GetExecutingAssembly().GetName().Name + ".View");

            viewsSource = new ObservableCollection <ViewViewModel>();

            foreach (var t in types)
            {
                viewsSource.Add(new ViewViewModel()
                {
                    Name = t.Name
                });
            }

            Views = CollectionViewSource.GetDefaultView(viewsSource);
            Views.MoveCurrentTo(viewsSource.First(v => v.Name.Equals(Application.Current.FindResource("StartView") as string)));
        }
Exemple #11
0
        static void TabItemLoaded(object sender, RoutedEventArgs e)
        {
            var tabItem = sender as TabItem;

            Debug.Assert(tabItem != null, "tabItem != null");

            ContentPresenter contentPresenter = null;

            for (var i = 0; i < 4; i++)
            {
                if (tabItem.TryFindChild(out contentPresenter))
                {
                    break;                                     //nugget: get reference to control in DataTemplate by name - from here: http://social.msdn.microsoft.com/Forums/en/wpf/thread/c121b7e5-cd65-415d-8bef-53a293006c37
                }
                WPFHelpers.DoEvents();
            }
            Debug.Assert(contentPresenter != null, "contentPresenter != null");
            var txtTabHeader = tabItem.HeaderTemplate.FindName("txtTabHeader", contentPresenter) as TextBlock;

            Debug.Assert(txtTabHeader != null, "txtTabHeader != null");

            txtTabHeader.SetBinding(TextBlock.TextProperty, ((ModelBase)tabItem.DataContext).TitleBinding);
        }
Exemple #12
0
        protected override void OnConnect(ISubscription source)
        {
            try
            {
                var infos = Channel.GetComponents();


                var startIcon   = WPFHelpers.GetImage("images/media-play.png");
                var stopIcon    = WPFHelpers.GetImage("images/media-stop.png");
                var restartIcon = WPFHelpers.GetImage("images/reload.png");
                var disableIcon = WPFHelpers.GetImage("images/ban.png");

                foreach (var info in infos)
                {
                    this.BeginInvoke(() =>
                    {
                        ComponentMetadataModel model = new ComponentMetadataModel();
                        model.UpdateFrom(info);
                        model.StopCommand.ParameterizedExecuteCallback    += ExecuteStopCommand;
                        model.StartCommand.ParameterizedExecuteCallback   += ExecuteStartCommand;
                        model.RestartCommand.ParameterizedExecuteCallback += ExecuteRestartCommand;
                        model.DisableCommand.ParameterizedExecuteCallback += ExecuteDisableCommand;
                        model.StartIcon   = startIcon;
                        model.StopIcon    = stopIcon;
                        model.RestartIcon = restartIcon;
                        model.DisableIcon = disableIcon;
                        Components.Add(model);
                    });
                }
            }
            catch
            {
                //nom nom nom
            }

            base.OnConnect(source);
        }
        private void QueryBuilder()
        {
            //Title

            string actorFirst = ActorBox.Text.ToString().Split(' ').FirstOrDefault().Trim();
            string actorLast  = ActorBox.Text.ToString().Split(' ').LastOrDefault().Trim();

            string genre = (GenreDropDown.SelectedIndex == -1) ? string.Empty : GenreDropDown.SelectedValue.ToString();

            string director = (DirectorDropDown.SelectedIndex == -1) ? string.Empty : DirectorDropDown.SelectedValue.ToString();

            string directorFirst = (DirectorDropDown.SelectedIndex == -1) ? string.Empty : DirectorDropDown.SelectedValue.ToString().Split(' ').FirstOrDefault().Trim();
            string directorLast  = (DirectorDropDown.SelectedIndex == -1) ? string.Empty : DirectorDropDown.SelectedValue.ToString().Split(' ').LastOrDefault().Trim();

            Tuple <int, int> length = (LengthDropDown.SelectedIndex == -1)
                                                ? new Tuple <int, int>(0, MovieAppHelpers.GetMaxMovieLength())
                                                : (Tuple <int, int>)LengthDropDown.SelectedValue;

            List <Film> results = SearchHelpers.RunSearch(paramActorFirst: actorFirst, paramActorLast: actorLast, paramGenre: genre,
                                                          paramMin: length.Item1, paramMax: length.Item2,
                                                          paramDirectorFirst: directorFirst, paramDirectorLast: directorLast);

            WPFHelpers.SwitchToNewWindow <Results>(new object[] { results });
        }
Exemple #14
0
 private void TxtSSNTextChanged(object sender, TextChangedEventArgs e)
 {
     WPFHelpers.AutoTabTextBoxTextChanged(sender, e);
     CustomerSearchCriteriaChanged(sender, e);
 }
Exemple #15
0
 protected override void UserControlLoaded(object sender, RoutedEventArgs e)
 {
     WPFHelpers.GridSort(gridRemarks, new[] { "Alert", "LastUpdate" }, new[] { ListSortDirection.Descending, ListSortDirection.Descending });
     UsedDate.Focus();
 }
Exemple #16
0
        private void ActivityStartEndDateChanged(object sender, SelectionChangedEventArgs e)
        {
            if (WPFHelpers.DesignMode)
            {
                return;                  //there was an annoying exception that would close down all of VS2010
            }
            if (dateActivityStart == null || dateActivityStart.SelectedDate == null || dateActivityEnd == null || dateActivityEnd.SelectedDate == null)
            {
                return;
            }

            long minticks = Math.Min(dateActivityStart.SelectedDate.Value.Ticks, dateActivityEnd.SelectedDate.Value.Ticks);

            if (minticks < dateRangeActivity.Minimum.Ticks)
            {
                dateRangeActivity.Minimum = new DateTime(minticks);                                       //expand the slider's minimum allowed if we're trying to go further back in time with the date boxes
            }
            if (_queryThread != null)
            {
                _queryThread.Abort();
            }
            _queryThread = new Thread(delegate(object state)
            {
                Thread.Sleep(1500); //slight delay to smooth out reacting to the slider while it's still being drug around

                var parms = state as DateRange;
                Debug.Assert(parms != null, "parms != null");
                var daysspanned = (parms.End - parms.Start).Days;
                if (daysspanned > 30)
                {
                    if (MessageBoxResult.Cancel == MessageBox.Show(
                            String.Format("That's a {0} day span.\rIt will make the database really smoke, are you sure?", daysspanned),
                            "Warning", MessageBoxButton.OKCancel, MessageBoxImage.Warning))
                    {
                        return;                                                     //nugget: aint that nice that MessageBox goes switches to the UI thread for us
                    }
                }
// ReSharper disable InconsistentNaming
                using (Proc DailyActivity_s = new iTRAACProc("DailyActivity_s"))
// ReSharper restore InconsistentNaming
                {
                    DailyActivity_s["@ActivityType"] = parms.ActivityType;
                    DailyActivity_s["@StartDate"]    = parms.Start;
                    DailyActivity_s["@EndDate"]      = parms.End;
                    var t = DailyActivity_s.ExecuteDataSet().Table0;
                    parms.Me.Dispatcher.Invoke((Action) delegate
                    {
                        var dv = (parms.Me.gridDailyActivity.ItemsSource as DataView);
                        if (dv != null)
                        {
                            dv.Table.Dispose();
                        }
                        parms.Me.gridDailyActivity.ItemsSource = t.DefaultView;
                        WPFHelpers.GridSort(parms.Me.gridDailyActivity, "Purchased", System.ComponentModel.ListSortDirection.Descending);
                    });
                }
            });
            _queryThread.Start(new DateRange(this, (string)cbxActivityType.SelectedValue, dateActivityStart.SelectedDate.Value, dateActivityEnd.SelectedDate.Value));

            if (_skipCbxActivityDateSelectionChanged)
            {
                return;
            }
            cbxActivityDate.SelectedValue = "CUSTOM";
        }
 private void NumericOnly_PreviewTextInput(object sender, TextCompositionEventArgs e)
 {
     //can't assign *static* event handlers in XAML so make that little hop here
     WPFHelpers.IntegerOnlyTextBox_PreviewTextInput(sender, e);
 }
 private void btnCart_IsCheckedChanged(object sender, RoutedEventArgs e)
 {
     WPFHelpers.GridSplitterOpeningBounce(ShoppingCartColumn, 275, btnCart.IsChecked);
 }
 void gridForms_Loaded(object sender, RoutedEventArgs e)
 {
     WPFHelpers.GridSort(gridForms, "Purchased", System.ComponentModel.ListSortDirection.Descending);
 }