Esempio n. 1
0
 private void fillFields()
 {
     if (_activeSheet != null)
     {
         int insertAt = 0;
         foreach (var f in _activeSheet.SelectedItems)
         {
             CheckedListItem <PropertyItem> fitem = (from a in Fields where a.Item == f select a).FirstOrDefault();
             int index = Fields.IndexOf(fitem);
             if (index > insertAt)
             {
                 Fields.RemoveAt(index);
                 Fields.Insert(insertAt, fitem);
                 fitem.IsChecked = true;
             }
             else
             {
                 fitem.IsChecked = true;
             }
             insertAt++;
         }
         for (int i = insertAt; i < Fields.Count; i++)
         {
             Fields[i].IsChecked = false;
         }
     }
     else
     {
         for (int i = 0; i < Fields.Count; i++)
         {
             Fields[i].IsChecked = false;
         }
     }
 }
Esempio n. 2
0
 private void Groups_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     if (e.Action == NotifyCollectionChangedAction.Add)
     {
         foreach (Group group in e.NewItems)
         {
             this.TransactionGraphConfiguration.GroupFilter.Add(new CheckedListItem <Group>(group, true));
             this.BudgetGraphConfiguration.GroupFilter.Add(new CheckedListItem <Group>(group, true));
         }
     }
     else if (e.Action == NotifyCollectionChangedAction.Remove)
     {
         foreach (Group group in e.OldItems)
         {
             CheckedListItem <Group> item = this.TransactionGraphConfiguration.GroupFilter.FirstOrDefault(x => x.Item.Equals(group));
             if (item != null)
             {
                 this.TransactionGraphConfiguration.GroupFilter.Remove(item);
                 this.BudgetGraphConfiguration.GroupFilter.Remove(item);
             }
         }
     }
     else if (e.Action == NotifyCollectionChangedAction.Reset)
     {
         List <CheckedListItem <Group> > tempGroups = new List <CheckedListItem <Group> >();
         foreach (Group group in this.Session.Groups)
         {
             tempGroups.Add(new CheckedListItem <Group>(group, true));
         }
         this.TransactionGraphConfiguration.GroupFilter.InsertRange(tempGroups);
         this.BudgetGraphConfiguration.GroupFilter.InsertRange(tempGroups);
     }
     this.RefreshChart();
 }
        private void OnDataCollected(FdrManagerEventArgs e)
        {
            Ordinats.Clear();
            cb_Abscissa.Items.Clear();
            TableColumns.Clear();

            foreach (var title in m_DataProcessingHelper.GetCollectedMeasuresNames())
            {
                CheckedListItem <string> item = new CheckedListItem <string>()
                {
                    Item = title
                };
                item.PropertyChanged += onOrdinateChecked;
                Ordinats.Add(item);
                cb_Abscissa.Items.Add(title);

                item = new CheckedListItem <string>()
                {
                    Item = title
                };
                item.PropertyChanged += onTabColumnChecked;
                TableColumns.Add(item);
            }

            StatusLabelMain.Content = Properties.Resources.state_success;
            Started = false;
        }
Esempio n. 4
0
 private void Categories_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     if (e.Action == NotifyCollectionChangedAction.Add)
     {
         foreach (Category category in e.NewItems)
         {
             this.TransactionGraphConfiguration.CategoryFilter.Add(new CheckedListItem <Category>(category, true));
             this.BudgetGraphConfiguration.CategoryFilter.Add(new CheckedListItem <Category>(category, true));
         }
     }
     else if (e.Action == NotifyCollectionChangedAction.Remove)
     {
         foreach (Category category in e.OldItems)
         {
             CheckedListItem <Category> item = this.TransactionGraphConfiguration.CategoryFilter.FirstOrDefault(x => x.Item.Equals(category));
             if (item != null)
             {
                 this.TransactionGraphConfiguration.CategoryFilter.Remove(item);
                 this.BudgetGraphConfiguration.CategoryFilter.Remove(item);
             }
         }
     }
     else if (e.Action == NotifyCollectionChangedAction.Reset)
     {
         List <CheckedListItem <Category> > tempCategories = new List <CheckedListItem <Category> >();
         foreach (Category category in this.Session.Categories)
         {
             tempCategories.Add(new CheckedListItem <Category>(category, true));
         }
         this.TransactionGraphConfiguration.CategoryFilter.InsertRange(tempCategories);
         this.BudgetGraphConfiguration.CategoryFilter.InsertRange(tempCategories);
     }
     this.RefreshChart();
 }
Esempio n. 5
0
        public void RefreshEventTypes(List <EventTypeModel> allEventTypes)
        {
            var types = new List <CheckedListItem <EventTypeModel> >();

            foreach (var type in allEventTypes)
            {
                var isChecked = true;
                if (!string.IsNullOrEmpty(CalendarEventTypes.ToString()))
                {
                    var propEventType = CalendarEventTypes["EventType" + type.EventType.ID];
                    if (propEventType != null)
                    {
                        isChecked = Convert.ToBoolean(propEventType);
                    }
                }
                var item = new CheckedListItem <EventTypeModel>(type, isChecked);
                item.PropertyChanged += ItemOnPropertyChanged;

                types.Add(item);
            }
            CheckedEventTypes = new ObservableCollection <CheckedListItem <EventTypeModel> >(types);
            EnabledItems      = new ObservableCollection <string>();
            foreach (var item in CheckedEventTypes)
            {
                if (item.IsChecked)
                {
                    EnabledItems.Add(item.Item.EventType.Name);
                }
            }
        }
Esempio n. 6
0
        public WindowExportExcelSettings(UIControls.ActionBuilder.ActionExportExcel.ExportExcelSettings settings)
        {
            _activeSettings = settings;
            InitializeComponent();

            Sheets = new ObservableCollection <Sheet>();
            Fields = new ObservableCollection <CheckedListItem <PropertyItem> >();

            FileName = settings.FileName;
            foreach (var s in settings.Sheets)
            {
                var ns = new Excel.Sheet();
                ns.Name = s.Name;
                foreach (var item in s.SelectedItems)
                {
                    ns.SelectedItems.Add(item);
                }
                Sheets.Add(ns);
            }

            foreach (var fi in PropertyItem.PropertyItems.OrderBy(x => x.ToString()))
            {
                CheckedListItem <PropertyItem> cli = new CheckedListItem <PropertyItem>(fi, false);
                Fields.Add(cli);
                cli.PropertyChanged += cli_PropertyChanged;
            }

            FileName = settings.FileName;
            if (Sheets.Count > 0)
            {
                ActiveSheet = Sheets[0];
            }

            DataContext = this;
        }
        /// <summary>
        /// Check change in checked list on click OK button
        /// </summary>
        bool CheckChanges()
        {
            bool isChange = false;

            for (int i = 0; i < collectionOrder.Count; i++)
            {
                NavigateBarButton nvb = null;
                CheckedListItem   cli = (lstButtons.Items[i] as CheckedListItem);

                collectionOrder.TryGetValue(i, out nvb);
                if (nvb != null)
                {
                    // Liste içerisindeki sırası değişti mi ?
                    // Is change button order
                    if (cli.Index != i)
                    {
                        isChange = true;
                        break;
                    }
                    else
                    {
                        // Check durumu değişti mi?
                        // Is change checked state
                        if (nvb.IsDisplayed != cli.Checked)
                        {
                            isChange = true;
                            break;
                        }
                    }
                }
            }

            return(isChange || isReset);
        }
        public AddModifyCustomizedProduct(CustomizedProduct cP = null, List <Topping> listOfT = null, List <Product> listOfProducts = null)
        {
            InitializeComponent();
            CustomizedProduct cProduct = cP ?? new CustomizedProduct();
            List <CheckedListItem <Topping> > listOfToppings = new List <CheckedListItem <Topping> >();

            foreach (var item in listOfT)
            {
                var toAdd = new CheckedListItem <Topping>(item);
                if (cP != null && cP.Toppings.Any(c => c.ToppingId == toAdd.Item.ToppingId))
                {
                    toAdd.IsChecked = true;
                }
                listOfToppings.Add(toAdd);
            }

            ModifyCustomizeProducts = new ModifyCustomizeProduct
            {
                CustomizedProduct = cProduct,
                Toppings          = new ObservableCollection <CheckedListItem <Topping> >(listOfToppings),
                SelectedBP        = cProduct == null ? null : cProduct.BaseProduct,
                BaseProduct       = new ObservableCollection <Product>(listOfProducts)
            };
            DataContext = ModifyCustomizeProducts;
        }
 private bool FilterView_Filter <T>(CheckedListItem <T> item)
 {
     if (this.FilterSearchText == null || this.FilterSearchText.Equals(""))
     {
         return(true);
     }
     return(item.Item.ToString().ToLower().Contains(this.FilterSearchText.ToLower()));
 }
        public PackageEditForm(CheckedListItem subject)
        {
            InitializeComponent();
            var viewModel = new ViewModelPackageEditForm(subject);

            DataContext            = viewModel;
            viewModel.CloseWindow += (sender, e) => { Close(); };
        }
Esempio n. 11
0
 private bool ApplyFilter(CheckedListItem item)
 {
     if (string.IsNullOrEmpty(Filter))
     {
         return(true);
     }
     return((item as CheckedListItem).Name.ToUpper().Contains(Filter.ToUpper()));
 }
 public ViewModelPackageEditForm(CheckedListItem subject)
 {
     _subject              = subject;
     _nameField            = subject.Item.Name;
     _firstDimensionField  = subject.Item.FirstDimension.ToString();
     _secondDimensionField = subject.Item.SecondDimension.ToString();
     SubmitChangesCommand  = new RelayCommand(SubmitChanges, ValidateValues);
     CancelCommand         = new RelayCommand(Cancel);
 }
        private void onTabColumnChecked(object sender, PropertyChangedEventArgs args)
        {
            CheckedListItem <string> item = sender as CheckedListItem <string>;

            if (item.IsChecked)
            {
                m_DataProcessingHelper.ShowColumn(item.Item);
            }
            else
            {
                m_DataProcessingHelper.HideColumn(item.Item);
            }
        }
        private void onOrdinateChecked(object sender, PropertyChangedEventArgs args)
        {
            CheckedListItem <string> item = sender as CheckedListItem <string>;

            if (item.IsChecked)
            {
                m_DataProcessingHelper.AddOrdinate(item.Item);
            }
            else
            {
                m_DataProcessingHelper.RemoveOrdinate(item.Item);
            }
        }
Esempio n. 15
0
        private void OnOrdinateCheckChanged(object sender, PropertyChangedEventArgs args)
        {
            CheckedListItem <string> item = sender as CheckedListItem <string>;

            if (item.IsChecked)
            {
                AddOrdinate(item.Item);
            }
            else
            {
                RemoveOrdinate(item.Item);
            }
        }
Esempio n. 16
0
        private void RefreshProductEventTypes(ProductModel model)
        {
            var types = new List <CheckedListItem <EventTypeModel> >();

            foreach (var type in _allEventTypes)
            {
                var isChecked = Product.EventTypes.Select(x => x.EventType).Contains(type.EventType);
                var item      = new CheckedListItem <EventTypeModel>(type, isChecked);

                item.PropertyChanged += ItemOnPropertyChanged;
                types.Add(item);
            }

            CheckedEventTypes = new ObservableCollection <CheckedListItem <EventTypeModel> >(types);
        }
        /// <summary>
        /// CheckState değiştiğinde bunu nesneye aktar
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void CheckList_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            if (e.Index < 0)
            {
                return;
            }

            CheckedListItem cli = (lstButtons.Items[e.Index] as CheckedListItem);

            cli.Checked = (e.NewValue == CheckState.Checked ? true : false);

            if (cli.NavigateBarButton.IsAlwaysDisplayed) // Her zaman gösterilecekse gizlenemesin
            {
                cli.Checked = true;
                e.NewValue  = CheckState.Checked;
            }
        }
Esempio n. 18
0
 void cli_PropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (!_initializingSheet)
     {
         if (_activeSheet != null && sender is CheckedListItem <PropertyItem> )
         {
             CheckedListItem <PropertyItem> pi = sender as CheckedListItem <PropertyItem>;
             if (pi.IsChecked && !_activeSheet.SelectedItems.Contains(pi.Item))
             {
                 _activeSheet.SelectedItems.Add(pi.Item);
             }
             else if (!pi.IsChecked && _activeSheet.SelectedItems.Contains(pi.Item))
             {
                 _activeSheet.SelectedItems.Remove(pi.Item);
             }
         }
         fillFields();
         SelectedField = sender as CheckedListItem <PropertyItem>;
     }
 }
        /// <summary>
        /// Load checked list
        /// </summary>
        void LoadList()
        {
            int selectedIndex = lstButtons.SelectedIndex;

            // NavigateBar butonların ismini yüklerken orjinal isimleri yükle
            // Use caption text.

            lstButtons.Items.Clear();

            for (int i = 0; i < collectionOrder.Count; i++)
            {
                CheckedListItem cli = new CheckedListItem(collectionOrder[i]);
                cli.Index = i;
                lstButtons.Items.Add(cli, cli.NavigateBarButton.IsDisplayed);
            }

            lstButtons.SelectedIndex = -1;
            lstButtons.SelectedItem  = null;
            CheckList_SelectedIndexChanged(null, null);
        }
Esempio n. 20
0
 public ChooseTagsDialog(Festival selectedFest)
 {
     AvailableTags    = new List <CheckedListItem>();
     SelectedFestival = selectedFest;
     foreach (Tag t in _mainWindow.Tags)
     {
         CheckedListItem cli = new CheckedListItem(t, _mainWindow.Tags.IndexOf(t));
         if (selectedFest.Tags.Contains(t))
         {
             cli.IsChecked = true;
         }
         else
         {
             cli.IsChecked = false;
         }
         AvailableTags.Add(cli);
     }
     InitializeComponent();
     this.DataContext = this;
 }
Esempio n. 21
0
        public static void TestOption()
        {
            XMLUtility xml = new XMLUtility("./7zip.xml");
            string     app = xml.readNodeValue("AppPath");

            string[] associate    = xml.readNodeValue("Associate").Split(',');
            string[] nonassociate = xml.readNodeValue("NonAssociate").Split(',');
            Utility.AppLaunch(app);
            Utility.wait(2);
            MenuOp.MenuItemClick("7-Zip File Manager", "Tools", "Options");
            foreach (string s in associate)
            {
                CheckedListItem.CheckboxToggleOn("Options", s, false);
            }
            foreach (string s in nonassociate)
            {
                CheckedListItem.CheckboxToggleOff("Options", s, false);
            }

            ButtonOp.buttonClick("Options", "OK");
        }
Esempio n. 22
0
        private void RefreshEventTypes()
        {
            var types = new List <CheckedListItem <EventTypeModel> >();

            foreach (var type in _allEventTypes)
            {
                var propertyName  = "EventType" + type.EventType.ID;
                var isChecked     = false;
                var propEventType = CalendarEventTypes[propertyName];
                if (propEventType != null)
                {
                    isChecked = Convert.ToBoolean(propEventType);
                }

                var item = new CheckedListItem <EventTypeModel>(type, isChecked);
                item.PropertyChanged += ItemOnPropertyChanged;
                types.Add(item);
            }

            CheckedEventTypes = new ObservableCollection <CheckedListItem <EventTypeModel> >(types);
        }
        /// <summary>
        /// Click OK Button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOK_Click(object sender, EventArgs e)
        {
            // Değişikli var mı kontrol et
            // Is any change on list
            hasChange = CheckChanges();

            if (hasChange) // Varsa uygula
            {
                // Liste içerisinde
                // Check button in list
                for (int i = 0; i < lstButtons.Items.Count; i++)
                {
                    CheckedListItem cli = (lstButtons.Items[i] as CheckedListItem);
                    navigateBar.NavigateBarButtons[i]           = cli.NavigateBarButton;
                    navigateBar.NavigateBarButtons[i].IsChecked = cli.Checked;
                }
            }

            // Formu Kapat

            this.Close();
        }
        private void btn_Graph_Open_Click(object sender, RoutedEventArgs e)
        {
            var opened = Load();

            if (opened == null)
            {
                return;
            }
            cb_Abscissa.Items.Clear();
            Ordinats.Clear();
            TableColumns.Clear();

            m_DataProcessingHelper.loadState(opened.Data);
            foreach (var title in m_DataProcessingHelper.GetCollectedMeasuresNames())
            {
                CheckedListItem <string> item = new CheckedListItem <string>()
                {
                    Item = title
                };
                Ordinats.Add(item);
                cb_Abscissa.Items.Add(title);

                item = new CheckedListItem <string>()
                {
                    Item = title
                };
                item.PropertyChanged += onTabColumnChecked;
                TableColumns.Add(item);
            }

            cb_Abscissa.SelectionChanged -= cb_Abscissa_SelectionChanged;

            cb_Abscissa.SelectedItem = m_DataProcessingHelper.Graphs.First().XAxis;
            m_DataProcessingHelper.Graphs.Select(g => g.YAxis).ToList().ForEach(y => Ordinats.Where(o => o.Item.Equals(y)).First().IsChecked = true);
            opened.CheckedTables.ForEach(c => TableColumns.Where(t => t.Item.Equals(c)).First().IsChecked = true);

            cb_Abscissa.SelectionChanged += cb_Abscissa_SelectionChanged;
            Ordinats.ToList().ForEach(o => o.PropertyChanged += onOrdinateChecked);
        }
Esempio n. 25
0
        public AddModifyOrderDialog(Order order = null, List <CustomizedProduct> customizedProducts = null, List <Employee> allDeliveryman = null,
                                    List <Customer> listOfCustomers = null, List <Topping> lOT      = null, List <Product> lOP = null)
        {
            InitializeComponent();
            Order = order ?? new Order();
            List <CheckedListItem <CustomizedProduct> > listOfcustomizedProducts = new List <CheckedListItem <CustomizedProduct> >();
            List <CheckedListItem <Employee> >          listOfDeliverymans       = new List <CheckedListItem <Employee> >();

            ListOfToppings = new List <Topping>(lOT);
            ListOfProducts = new List <Product>(lOP);

            foreach (var item in allDeliveryman)
            {
                listOfDeliverymans.Add(new CheckedListItem <Employee>(item));
            }

            foreach (var item in customizedProducts)
            {
                var toAdd = new CheckedListItem <CustomizedProduct>(item);
                if (order != null && Order.OrderedProducts.Any(o => o.CustomizedProductId == toAdd.Item.CustomizedProductId))
                {
                    toAdd.IsChecked = true;
                }
                listOfcustomizedProducts.Add(toAdd);
            }

            ModifyOrders = new ModifyOrder
            {
                Order = Order,
                CustomizedProducts        = new ObservableCollection <CustomizedProduct>(customizedProducts),
                Deliveryman               = new ObservableCollection <Employee>(allDeliveryman),
                SelectedDeliveryman       = order == null ? null : order.Deliveryman,
                Customers                 = new ObservableCollection <Customer>(listOfCustomers),
                SelectedCustomer          = order == null ? null : order.Customer,
                ChangedCustomizedProducts = new List <CustomizedProduct>()
            };
            DataContext = ModifyOrders;
        }
        /// <summary>
        /// Load checked list
        /// </summary>
        void LoadList()
        {
            int selectedIndex = lstButtons.SelectedIndex;

            // NavigateBar butonların ismini yüklerken orjinal isimleri yükle
            // Use orjinalcaption text.

            lstButtons.Items.Clear();

            for (int i = 0; i < dicOrjinalButtons.Count; i++)
            {
                CheckedListItem cli = new CheckedListItem(dicOrjinalButtons[i]);
                cli.Index = i;
                lstButtons.Items.Add(cli, cli.NavigateBarButton.IsDisplayed);
            }

            lstButtons.SelectedIndex = -1;
            lstButtons.SelectedItem = null;
            CheckList_SelectedIndexChanged(null, null);
        }
Esempio n. 27
0
        private void RefreshProductEventTypes(ProductModel model)
        {
            var types = new List<CheckedListItem<EventTypeModel>>();

            foreach (var type in _allEventTypes)
            {
                var isChecked = Product.EventTypes.Select(x => x.EventType).Contains(type.EventType);
                var item = new CheckedListItem<EventTypeModel>(type, isChecked);

                item.PropertyChanged += ItemOnPropertyChanged;
                types.Add(item);
            }

            CheckedEventTypes = new ObservableCollection<CheckedListItem<EventTypeModel>>(types);
        }
Esempio n. 28
0
        private void RefreshEventTypes()
        {
            var types = new List<CheckedListItem<EventTypeModel>>();

            foreach (var type in _allEventTypes)
            {
                var propertyName = "EventType" + type.EventType.ID;
                var isChecked = false;
                var propEventType = CalendarEventTypes[propertyName];
                if (propEventType != null)
                {
                    isChecked = Convert.ToBoolean(propEventType);
                }

                var item = new CheckedListItem<EventTypeModel>(type, isChecked);
                item.PropertyChanged += ItemOnPropertyChanged;
                types.Add(item);
            }

            CheckedEventTypes = new ObservableCollection<CheckedListItem<EventTypeModel>>(types);

        }
        public void RefreshEventTypes(List<EventTypeModel> allEventTypes)
        {
            var types = new List<CheckedListItem<EventTypeModel>>();

            foreach (var type in allEventTypes)
            {
                var isChecked = true;
                if (!string.IsNullOrEmpty(CalendarEventTypes.ToString()))
                {
                    var propEventType = CalendarEventTypes["EventType" + type.EventType.ID];
                    if (propEventType != null)
                    {
                        isChecked = Convert.ToBoolean(propEventType);
                    }
                }
                var item = new CheckedListItem<EventTypeModel>(type, isChecked);
                item.PropertyChanged += ItemOnPropertyChanged;

                types.Add(item);
            }
            CheckedEventTypes = new ObservableCollection<CheckedListItem<EventTypeModel>>(types);
            EnabledItems = new ObservableCollection<string>();
            foreach (var item in CheckedEventTypes)
            {
                if (item.IsChecked)
                {
                    EnabledItems.Add(item.Item.EventType.Name);
                }
            }
        }
Esempio n. 30
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (_photoSession.Braketing.ExposureValues.Count == 0)
            {
                _photoSession.Braketing.ExposureValues = new AsyncObservableCollection <string> {
                    "-1", "0", "+1"
                }
            }
            ;
            foreach (string value in _device.ExposureCompensation.Values)
            {
                CheckedListItem item = new CheckedListItem()
                {
                    Name      = value,
                    IsChecked = _photoSession.Braketing.ExposureValues.Contains(value)
                };
                item.PropertyChanged += item_PropertyChanged;
                collection.Add(item);
            }
            listBox1.ItemsSource = collection;

            Dictionary <long, string> exposurevals = new Dictionary <long, string>();

            int s_index = _device.ShutterSpeed.Values.IndexOf(_device.ShutterSpeed.Value);
            int s_min   = s_index - 4;
            int s_max   = s_index + 4;

            //exposurevals.Add(s_index, "0");
            //long incre = _device.ShutterSpeed.NumericValues[s_index];
            //int step = 0;
            //for (int i = s_index; i < _device.ShutterSpeed.Values.Count; i++)
            //{
            //  if (_device.ShutterSpeed.NumericValues[i]%incre == 0)
            //  {
            //    exposurevals.Add(i, step.ToString());
            //    step++;
            //    incre = _device.ShutterSpeed.NumericValues[i];
            //  }
            //}

            //incre = _device.ShutterSpeed.NumericValues[s_index];
            //step = 0;

            //for (int i = s_index; i >0; i--)
            //{
            //  if (incre % _device.ShutterSpeed.NumericValues[i] == 0)
            //  {
            //    if (step != 0)
            //    {
            //      exposurevals.Add(i, (-step).ToString());
            //    }
            //    step++;
            //    incre = _device.ShutterSpeed.NumericValues[i];
            //  }
            //}

            if (s_min < 0)
            {
                s_min = 0;
            }
            if (s_max >= _device.ShutterSpeed.Values.Count)
            {
                s_max = _device.ShutterSpeed.Values.Count - 1;
            }
            for (int i = 0; i < _device.ShutterSpeed.Values.Count; i++)
            {
                if (_device.ShutterSpeed.Values[i] == "Bulb")
                {
                    continue;
                }
                CheckedListItem item = new CheckedListItem()
                {
                    Name =
                        _device.ShutterSpeed.Values[i] +
                        (exposurevals.ContainsKey(i) ? " EV " + exposurevals[i] : ""),
                    Tag = _device.ShutterSpeed.Values[i]
                };
                if (i == s_index || i == s_min || i == s_max)
                {
                    item.IsChecked = true;
                }
                item.PropertyChanged += item_PropertyChanged;
                shuttercollection.Add(item);
            }
            lst_shutter.ItemsSource = shuttercollection;

            foreach (CameraPreset cameraPreset in ServiceProvider.Settings.CameraPresets)
            {
                CheckedListItem item = new CheckedListItem()
                {
                    Name      = cameraPreset.Name,
                    IsChecked =
                        _photoSession.Braketing.PresetValues.Contains(cameraPreset.Name)
                };
                item.PropertyChanged += item_PropertyChanged;
                presetcollection.Add(item);
            }
            lst_preset.ItemsSource = presetcollection;

            foreach (string value in _device.FNumber.Values)
            {
                CheckedListItem item = new CheckedListItem()
                {
                    Name      = value,
                    IsChecked =
                        _photoSession.Braketing.ApertureValues.Contains(value)
                };
                item.PropertyChanged += item_PropertyChanged;
                aperturecollection.Add(item);
            }
            lst_aperture.ItemsSource = aperturecollection;

            if (_device.Mode.Value == "M")
            {
                tab_exposure.Visibility      = Visibility.Visible;
                tab_manual.Visibility        = Visibility.Visible;
                tab_manual.IsSelected        = true;
                _photoSession.Braketing.Mode = 1;
            }
            else
            {
                _photoSession.Braketing.Mode = 0;
                tab_exposure.Visibility      = Visibility.Visible;
                tab_manual.Visibility        = Visibility.Collapsed;
                tab_exposure.IsSelected      = true;
            }

            if (_device.Mode.Value == "M" || _device.Mode.Value == "A")
            {
                tab_aperture.Visibility = Visibility.Visible;
            }
            else
            {
                tab_aperture.Visibility = Visibility.Collapsed;
            }

            item_PropertyChanged(null, null);
        }
Esempio n. 31
0
 static void Main(string[] args)
 {
     var item = new CheckedListItem <object>();
 }
Esempio n. 32
0
        private void OnSourcesChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            ObservableCollection <CompareSource> obsSender = sender as ObservableCollection <CompareSource>;

            if (e.Action == NotifyCollectionChangedAction.Add)
            {
                foreach (var newItem in e.NewItems)
                {
                    var newSource = m_Sources[m_Sources.IndexOf((CompareSource)newItem)];

                    int titleNum = 1;

                    if (string.IsNullOrEmpty(newSource.Title.Trim()))
                    {
                        newSource.Title = DEFAULT_NAME;
                    }

                    string title = newSource.Title;
                    while (m_Sources.Where(s => s.Title.Equals(newSource.Title)).Count() > 1)
                    {
                        newSource.Title = title + "(" + titleNum++ + ")";
                    }

                    newSource.getValues().Keys.ToList().ForEach(
                        k =>
                    {
                        if (m_Dimensions.ContainsKey(k))
                        {
                            m_Dimensions[k]++;
                        }
                        else
                        {
                            m_Dimensions.Add(k, 1);
                            var newOrdinateCheckbox              = new CheckedListItem <string>(k);
                            newOrdinateCheckbox.PropertyChanged += OnOrdinateCheckChanged;
                            m_AvailableOrdinates.Add(newOrdinateCheckbox);
                            CbAbscissa.Items.Add(k);
                        }
                    });

                    switch (m_Metrica)
                    {
                    case Metrica.Metric:
                        foreach (var keyValue in newSource.getValues())
                        {
                            string newUnit = m_Imperical2MetricalConverter.Convert(keyValue.Value, newSource.getUnits()[keyValue.Key]);
                            newSource.getUnits()[keyValue.Key] = newUnit;
                        }
                        break;

                    case Metrica.Imperial:
                        foreach (var keyValue in newSource.getValues())
                        {
                            string newUnit = m_Metrical2ImperialConverter.Convert(keyValue.Value, newSource.getUnits()[keyValue.Key]);
                            newSource.getUnits()[keyValue.Key] = newUnit;
                        }
                        break;

                    default:
                        throw new InvalidOperationException("invalid metrica");
                    }
                    var newSourceCheckbox = new CheckedListItem <string>(newSource.Title);
                    newSourceCheckbox.PropertyChanged += OnSourceCheckChanged;
                    m_AvailableSources.Add(newSourceCheckbox);
                }
            }
            else if (e.Action == NotifyCollectionChangedAction.Remove)
            {
                foreach (var removedItem in e.OldItems)
                {
                    var removedSource = (CompareSource)removedItem;

                    foreach (string dimension in removedSource.getValues().Keys.ToList())
                    {
                        int count = m_Dimensions[dimension];
                        if (count == 1)
                        {
                            m_Dimensions.Remove(dimension);
                            CbAbscissa.Items.Remove(dimension);

                            var ordinatesToRemove = m_AvailableOrdinates.Where(o => o.Item.Equals(dimension)).ToList();
                            foreach (var item in ordinatesToRemove)
                            {
                                m_AvailableOrdinates.Remove(item);
                            }
                        }
                        else
                        {
                            m_Dimensions[dimension]--;
                        }
                    }

                    m_Graphs.RemoveAll(g => g.Key.Equals(removedSource.Title));

                    var toRemove = m_AvailableSources.Where(s => s.Item.Equals(removedSource.Title)).ToList();
                    foreach (var item in toRemove)
                    {
                        m_AvailableSources.Remove(item);
                    }
                }
                Redraw();
            }
        }
Esempio n. 33
0
        public ExportWindow(List <Core.Data.Geocache> gcList) : this()
        {
            _gcList = gcList;

            if (PropertyItem.PropertyItems.Count == 0)
            {
                //fill the available items
                PropertyItem ppi;
                ppi = new PropertyItemCode();
                ppi = new PropertyItemName();
                ppi = new PropertyItemPublished();
                ppi = new PropertyItemLat();
                ppi = new PropertyItemLon();
                ppi = new PropertyItemCoordinate();
                ppi = new PropertyItemAvailable();
                ppi = new PropertyItemArchived();
                ppi = new PropertyItemCountry();
                ppi = new PropertyItemState();
                ppi = new PropertyItemMunicipality();
                ppi = new PropertyItemCity();
                ppi = new PropertyItemType();
                ppi = new PropertyItemPlacedBy();
                ppi = new PropertyItemOwner();
                ppi = new PropertyItemContainer();
                ppi = new PropertyItemTerrain();
                ppi = new PropertyItemDifficulty();
                ppi = new PropertyItemDescriptionText();
                ppi = new PropertyItemDescriptionHTML();
                ppi = new PropertyItemUrl();
                ppi = new PropertyItemMemberOnly();
                ppi = new PropertyItemCustomLat();
                ppi = new PropertyItemCustomLon();
                ppi = new PropertyItemCustomCoordinate();
                ppi = new PropertyItemAutoCoordinate();
                ppi = new PropertyItemFavorites();
                ppi = new PropertyItemPersonalNotes();
                ppi = new PropertyItemNotes();
                ppi = new PropertyItemFlagged();
                ppi = new PropertyItemFound();
                ppi = new PropertyItemFoundDate();
                ppi = new PropertyItemHints();
                //ppi = new PropertyItemGCVote(core);
#if DEBUG
                ppi = new PropertyItemRDx();
                ppi = new PropertyItemRDy();
                ppi = new PropertyItemEnvelopAreaOther();
                ppi = new PropertyItemInAreaOther();
                ppi = new PropertyItemGlobalcachingUrl();
#endif
            }

            Sheets = new ObservableCollection <Sheet>();
            Fields = new ObservableCollection <CheckedListItem <PropertyItem> >();

            if (!string.IsNullOrEmpty(Core.Settings.Default.HTMLSheets))
            {
                string[] lines = Core.Settings.Default.HTMLSheets.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
                foreach (string s in lines)
                {
                    //fielscount
                    //fields
                    //name
                    string[] parts = s.Split(new char[] { '|' }, 2);
                    int      cnt   = int.Parse(parts[0]);
                    parts = s.Split(new char[] { '|' }, cnt + 2);
                    Sheet sheet = new Sheet();
                    sheet.Name = parts[parts.Length - 1];
                    for (int i = 1; i < parts.Length - 1; i++)
                    {
                        sheet.SelectedItems.Add((from p in PropertyItem.PropertyItems where p.GetType().ToString() == parts[i] select p).FirstOrDefault());
                    }
                    Sheets.Add(sheet);
                }
            }

            foreach (var fi in PropertyItem.PropertyItems)
            {
                CheckedListItem <PropertyItem> cli = new CheckedListItem <PropertyItem>(fi, false);
                Fields.Add(cli);
                cli.PropertyChanged += cli_PropertyChanged;
            }

            DataContext = this;
        }
Esempio n. 34
0
        private void OnSourceCheckChanged(object sender, PropertyChangedEventArgs args)
        {
            CheckedListItem <string> item = sender as CheckedListItem <string>;

            if (item.IsChecked)
            {
                var checkedOrds    = m_AvailableOrdinates.Where(o => o.IsChecked).ToList();
                var ordinatesCount = checkedOrds.Count();
                if (ordinatesCount == 0)
                {
                    return;
                }

                m_AvailableOrdinates.Where(o => o.IsChecked).ToList().ForEach(c =>
                {
                    var source = m_Sources.Where(s => s.Title.Equals(item.Item)).First();
                    //var color = GraphSettings.CurveLines[m_Sources.IndexOf(source)].LineColor;
                    var title    = item.Item;
                    var x_values = string.IsNullOrEmpty(m_Abs) ? null : source.getValues()[m_Abs].ToArray();
                    var y_values = source.getValues()[c.Item].ToArray();
                    // x.Length == y.Length implies from data catching procedure
                    int dataSize = x_values.Length;

                    var x       = m_Abs;
                    var y       = c.Item;
                    Graph graph = null;
                    if (string.IsNullOrWhiteSpace(x))
                    {
                        var points = new PointPairList(new double[dataSize], y_values);
                        graph      = new Graph(points, title + "_" + y + "(" + (x ?? "") + ")", x, y, null, source.getUnits()[y]);
                    }
                    else
                    {
                        var points = new PointPairList(x_values, y_values);
                        graph      = new Graph(points, title + "_" + y + "(" + x + ")", x, y, source.getUnits()[x], source.getUnits()[y]);
                    }

                    //graph.Color = color;
                    //graph.DashStyle = (System.Drawing.Drawing2D.DashStyle)(ordinatesCount - 1);

                    var graphsForCurrentSource = m_Graphs.Where(g => g.Key.Equals(source.Title));
                    if (graphsForCurrentSource == null || graphsForCurrentSource.Count() == 0)
                    {
                        List <Graph> newGraphList = new List <Graph>();
                        newGraphList.Add(graph);
                        var newKeyValue = new KeyValuePair <string, List <Graph> >(title, newGraphList);
                        m_Graphs.Add(newKeyValue);
                    }
                    else
                    {
                        var targetList = graphsForCurrentSource.First().Value;
                        targetList.Add(graph);
                    }
                }
                                                                              );
            }
            else
            {
                m_Graphs.RemoveAll(g => g.Key.Equals(item.Item));
            }
            Redraw();
        }