Example #1
18
 public Satis(TrulyObservableCollection <SatisUrun> c)
 {
     foreach (SatisUrun x in c)
     {
         SatilanUrunler.Add(x);
     }
 }
Example #2
0
        private static void Main(string[] args)
        {
            var autoReset     = new AutoResetEvent(false);
            var r             = new Random();
            var o             = new TrulyObservableCollection <DataPoint>();
            var subscription1 = Observable.Interval(TimeSpan.FromSeconds(1)).Take(3).Subscribe(
                i =>
            {
                o.Add(
                    new DataPoint
                {
                    ItemCount = r.Next(100)
                });
                Console.WriteLine("Fire1 {0}", i);
            });
            var subscription2 =
                Observable.FromEventPattern <NotifyCollectionChangedEventArgs>(o, "CollectionChanged")
                .Subscribe(s => { Console.WriteLine("List changed. Current total {0}", o.Sum(s1 => s1.ItemCount)); });
            var subscription3 = Observable.Interval(TimeSpan.FromSeconds(1)).Delay(TimeSpan.FromSeconds(3)).Take(3).Finally(
                () =>
            {
                o.Clear();
                autoReset.Set();
            }).Subscribe(
                i =>
            {
                if (o.Any())
                {
                    o[r.Next(o.Count)].ItemCount = r.Next(100);
                    Console.WriteLine("Fire3 {0}", i);
                }
            });

            autoReset.WaitOne();
        }
        public FilteredOutputWindowViewModel()
        {
            SetupEvents();
            CreateCommands();

            AutoScroll                   = Properties.Settings.Default.AutoScroll;
            MultiFilterMode              = (LogicalGate)Properties.Settings.Default.MultiFilterMode;
            FilterMode                   = (FilteringMode)Properties.Settings.Default.FilterMode;
            _documentEvents.PaneUpdated += (e) =>
            {
                // See [IDE GUID](https://docs.microsoft.com/en-us/visualstudio/extensibility/ide-guids?view=vs-2017 )
                const string debugPane = "{FC076020-078A-11D1-A7DF-00A0C9110051}";
                if (e.Guid != debugPane)
                {
                    return;
                }
                // In Chinese we call the Debug as 调试
                // That is why I can not view any.
                //if (e.Name != "Debug") return;
                _currentText = GetPaneText(e);
                UpdateOutput();
            };

            Filters = new TrulyObservableCollection <FilterContainer>(GetSettings());
            Filters.CollectionChanged += (s, e) =>
            {
                RaisePropertyChanged(nameof(FilterButtonName));
                UpdateOutput();
                UpdateSettings();
            };
            ColorList = new ObservableCollection <string>(typeof(Colors).GetProperties().Select(z => z.Name));
        }
Example #4
0
        public VplControl()
        {
            if (!DesignerProperties.GetIsInDesignMode(this))
            {
                try
                {
                    DefaultStyleKeyProperty.OverrideMetadata(typeof(VplControl),
                                                             new FrameworkPropertyMetadata(typeof(VplControl)));
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                }

                Style = FindResource("VplControlStyle") as Style;
                GraphFlowDirection = GraphFlowDirections.Vertical;

                KeyDown += VplControl_KeyDown;
                KeyUp   += VplControl_KeyDown;

                ScaleTransform.Changed += ScaleTransformOnChanged;

                NodeCollection      = new TrulyObservableCollection <Node>();
                NodeGroupCollection = new List <NodeGroup>();
                ConnectorCollection = new List <Connector>();
                SelectedNodes       = new TrulyObservableCollection <Node>();
                SelectedConnectors  = new TrulyObservableCollection <Connector>();
                ExternalNodeTypes   = new List <Type>();

                TypeSensitive = true;

                InitializeGridBackground();
                InitializeTheme();
            }
        }
Example #5
0
 public Board(GameLocation gameLocation)
 {
     this.gameLocation = gameLocation;
     BoardMatrix       = new TrulyObservableCollection <TrulyObservableCollection <BoardField> >();
     for (var i = 0; i <= BoardSize; i++)
     {
         BoardMatrix.Add(new TrulyObservableCollection <BoardField>());
         for (var j = 0; j <= BoardSize; j++)
         {
             if (i % 2 == 0 && j % 2 == 0)
             {
                 BoardMatrix[i].Add(new BoardField
                 {
                     Position = new Position {
                         Y = i, X = j
                     },
                     FieldType = BoardElementType.Empty
                 });
             }
             else
             {
                 BoardMatrix[i].Add(new BoardField
                 {
                     Position = new Position {
                         Y = i, X = j
                     },
                     FieldType = BoardElementType.EmptyForWall
                 });
             }
         }
     }
 }
Example #6
0
 /// <summary>
 /// Constructeur de local contenant le numéro du local.
 /// </summary>
 /// <param name="numero">Numero du local Ex: "D125"</param>
 public Local(string numero)
 {
     Numero   = numero;
     LstPoste = new TrulyObservableCollection <Poste>();
     LstPoste.ItemPropertyChanged += PropertyChangedHandler;
     VolontaireAssigne             = new Volontaire();
 }
 public LocalGameLobbyPage()
 {
     Players = new TrulyObservableCollection <PlayerParameters>
     {
         new PlayerParameters()
         {
             Name             = "Player 1",
             PawnColor        = Colors.Chartreuse,
             StartingPosition = PlayerStartingPosition.Bottom,
             PlayerType       = PlayerType.Human
         },
         new PlayerParameters()
         {
             Name             = "Player 2",
             PawnColor        = Colors.Brown,
             StartingPosition = PlayerStartingPosition.Top,
             PlayerType       = PlayerType.AI
         },
         new PlayerParameters()
         {
             Name             = "Player 3",
             PawnColor        = Colors.BlueViolet,
             StartingPosition = PlayerStartingPosition.Left,
             PlayerType       = PlayerType.AI
         },
         new PlayerParameters()
         {
             Name             = "Player 4",
             PawnColor        = Colors.Magenta,
             StartingPosition = PlayerStartingPosition.Right,
             PlayerType       = PlayerType.Human
         }
     };
     this.InitializeComponent();
 }
Example #8
0
        public VplControl()
        {
            if (!DesignerProperties.GetIsInDesignMode(this))
            {
                try
                {
                    DefaultStyleKeyProperty.OverrideMetadata(typeof (VplControl),
                        new FrameworkPropertyMetadata(typeof (VplControl)));
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                }

                Style = FindResource("VplControlStyle") as Style;
                GraphFlowDirection = GraphFlowDirections.Vertical;

                KeyDown += VplControl_KeyDown;
                KeyUp += VplControl_KeyDown;

                ScaleTransform.Changed += ScaleTransformOnChanged;

                NodeCollection = new TrulyObservableCollection<Node>();
                NodeGroupCollection = new List<NodeGroup>();
                ConnectorCollection = new List<Connector>();
                SelectedNodes = new TrulyObservableCollection<Node>();
                SelectedConnectors = new TrulyObservableCollection<Connector>();
                ExternalNodeTypes = new List<Type>();

                TypeSensitive = true;

                InitializeGridBackground();
                InitializeTheme();
            }
        }
Example #9
0
        /// <summary>Retrieves the stock entries from the server</summary>
        private void GetStockEntries()
        {
            try
            {
                LoggingService.Log("Getting Stock Entries", "Log.txt");

                Mouse.OverrideCursor = Cursors.Wait;
                FilterBound.Validate();
                FilterError.Text       = "";
                FilterError.Visibility = Visibility.Collapsed;

                SQLStockRepository stockRepo = new SQLStockRepository();
                StockEntriesBound = null;
                StockEntriesBound = new TrulyObservableCollection <StockEntry>(stockRepo.GetStockEntries(FilterBound));
                StockEntriesDataGrid.ItemsSource       = StockEntriesBound;
                StockEntriesBound.ItemPropertyChanged += StockEntriesBound_ItemPropertyChanged;
                StockEntriesBound.CollectionChanged   += StockEntriesBound_CollectionChanged;

                Messages.Items.Insert(0, "Retrieved " + StockEntriesBound.Count.ToString() + " entries");
            }
            catch (Exception ex)
            {
                Messages.Items.Insert(0, ex.Message);
                LoggingService.Log(ex, "Log.txt");
            }
            Mouse.OverrideCursor = Cursors.Arrow;
        }
        public CreatePoll()
        {
            InitializeComponent();

            try
            {
                Names = new ObservableCollection<NameIdModel>();
                progressIndicator = SystemTray.ProgressIndicator;
                progressIndicator = new ProgressIndicator();

                SystemTray.SetProgressIndicator(this, progressIndicator);
                progressIndicator.IsIndeterminate = true;
                progressIndicator.Text = "Pulling Groups...";
                Voting = new VotingClass();
                Questions = new TrulyObservableCollection<VotingQuestionClass>();

                QuestionList.ItemsSource = Questions;
                RecipientsList.ItemsSource = Names;

            }
            catch (Exception exception)
            {
                ErrorHandler.Save(exception, MobileTypeEnum.WP8);
            }
        }
Example #11
0
        /// <summary>
        /// Clears the file list
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnClearClick__Main(object sender, RoutedEventArgs e)
        {
            if (_viewModel.CurrentLanguage == "All")
            {
                _viewModel.StatusText    = "Cleared " + _viewModel.List.Count() + " files";
                _viewModel.NotifyMessage = "Cleared";
                _viewModel.List.Clear();
                _viewModel.FlyoutOpen         = true;
                MainView_DataGrid.ItemsSource = null;
                MainView_DataGrid.ItemsSource = _viewModel.List;
            }
            else
            {
                TrulyObservableCollection <MyFile> tempFileList = _viewModel.List;
                foreach (MyFile f in _viewModel.TempList)
                {
                    tempFileList.Remove(f);
                }

                _viewModel.StatusText = "Cleared " + _viewModel.TempList.Count() + " files";
                _viewModel.List       = tempFileList;
                _viewModel.TempList.Clear();
                _viewModel.NotifyMessage      = "Cleared";
                _viewModel.FlyoutOpen         = true;
                MainView_DataGrid.ItemsSource = null;
                MainView_DataGrid.ItemsSource = _viewModel.TempList;
            }
        }
Example #12
0
 public State(Dictionary <string, Action> eventHandlers)
 {
     EventHandlers        = eventHandlers;
     _laborDataCollection = new TrulyObservableCollection <LaborData>();
     _bases = new ObservableCollection <string>();
     _times = new ObservableCollection <DateTime>();
 }
Example #13
0
 public Player()
 {
     Airplanes = new TrulyObservableCollection <Airplane>();
     Flights   = new TrulyObservableCollection <Flight>();
     Schedule  = new Schedule();
     Balance   = 100000000;
     HomeCity  = CityCatalog.Cities.Find(x => x.Name == "Пермь");
 }
Example #14
0
 /// <summary>Clears the grid</summary>
 private void ClearGrid()
 {
     StockEntriesBound = null;
     StockEntriesBound = new TrulyObservableCollection <StockEntry>();
     StockEntriesDataGrid.ItemsSource       = StockEntriesBound;
     StockEntriesBound.ItemPropertyChanged += StockEntriesBound_ItemPropertyChanged;
     StockEntriesBound.CollectionChanged   += StockEntriesBound_CollectionChanged;
 }
Example #15
0
        /// <summary>
        /// Saves the new selected item in the viewmodel
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnLanguageBox_Changed(object sender, SelectionChangedEventArgs e)
        {
            _viewModel.CurrentLanguage = (sender as ComboBox).SelectedItem as string;
            WhiteList_Grid.ItemsSource = null;

            if (_viewModel.CurrentLanguage == "All")
            {
                _viewModel.CurrentWhiteList   = _viewModel.WhiteList;
                MainView_DataGrid.ItemsSource = null;
                MainView_DataGrid.ItemsSource = _viewModel.List;
            }
            else
            {
                // WhiteList

                List <WhiteList> tempList = new List <WhiteList>();

                foreach (WhiteList wl in _viewModel.WhiteList)
                {
                    if (wl.Language == _viewModel.CurrentLanguage)
                    {
                        tempList.Add(new WhiteList
                        {
                            Language  = wl.Language,
                            Extension = wl.Extension
                        });
                    }
                }

                _viewModel.CurrentWhiteList = tempList;
                TrulyObservableCollection <MyFile> tempFileList = new TrulyObservableCollection <MyFile>();

                // Filelist

                foreach (MyFile f in _viewModel.List)
                {
                    bool flag = false;
                    for (int i = 0; i < _viewModel.CurrentWhiteList.Count(); i++)
                    {
                        if (_viewModel.CurrentWhiteList[i].Extension == f.Extension)
                        {
                            tempFileList.Add(f);
                            flag = true;
                            break;
                        }
                    }
                    if (flag)
                    {
                        continue;
                    }
                }
                _viewModel.TempList           = tempFileList;
                MainView_DataGrid.ItemsSource = null;
                MainView_DataGrid.ItemsSource = _viewModel.TempList;
            }
            WhiteList_Grid.ItemsSource = _viewModel.CurrentWhiteList;
        }
Example #16
0
 public TurniejWindowVM(List <string> listaGraczy, List <Film> listaFilmow)
 {
     _lista = new TrulyObservableCollection <FilmTurniej>();
     foreach (Film film in listaFilmow)
     {
         _lista.Add(new FilmTurniej(film));
     }
     ListaGraczy            = listaGraczy;
     indeksAktualnegoGracza = random.Next(listaGraczy.Count);
 }
        public TemplatingViewModel(IDispatcherHelper dispatcherHelper)
        {
            IntegrityCheck.IsNotNull(dispatcherHelper);

            m_DispatcherHelper = dispatcherHelper;

            m_StateLock = new object();
            Minutae     = new TrulyObservableCollection <MinutiaRecord>();
            m_StateMgr  = new StateManager <TemplatingState>(this, typeof(Uninitialised));
        }
 public UIControlDefinitionModel(MobiseModel parent, bool addDefaultAttributes)
     : base(parent)
 {
     this.AttributeCategories = new TrulyObservableCollection <AttributeCategoryModel>();
     this.DesignerAttributes  = new Dictionary <string, string>();
     this.VisualStates        = new TrulyObservableCollection <VisualStateDefinitionModel>();
     if (addDefaultAttributes)
     {
         this.CreateDefaultAttributes();
     }
 }
 public MobiseConfiguration()
     : base()
 {
     this.Controls                    = new TrulyObservableCollection <UIControlDefinitionModel>();
     this.Themes                      = new TrulyObservableCollection <ThemeModel>();
     this.StyleSchemaMappings         = new TrulyObservableCollection <StyleSchemaMappingModel>();
     this.StyleAttributeDefaultValues = new TrulyObservableCollection <StyleAttributeDefaultValueModel>();
     this.baseControlAttributes       = new TrulyObservableCollection <AttributeCategoryModel>();
     this.ControllerDefinitons        = new TrulyObservableCollection <ControllerDefinitionModel>();
     this.MBObjects                   = new TrulyObservableCollection <MBObjectModel>();
 }
        public AccueilUtilisateurPage(MainWindow MainWindow)
        {
            InitializeComponent();
            this.MainWindow = MainWindow;

            // DATA BINDING
            _Utilisateurs = new TrulyObservableCollection <DataAccessLayer.Models.Utilisateur>(_GA.DataAccess.GetAllUtilisateurs());
            DataContext   = this;

            LV_Utilisateurs.ItemsSource     = Utilisateurs;
            Utilisateurs.CollectionChanged += Utilisateurs_CollectionChanged;
        }
Example #21
0
 private void initStatistics()
 {
     _statistic = new Statistics();
     Info       = new TrulyObservableCollection <InfoRow>();
     Info.Add(_infoDeviceName);
     Info.Add(_infoRightHand);
     Info.Add(_infoLeftHand);
     Info.Add(_infoSpine);
     Info.Add(_infoIsSkeletonDetected);
     Info.Add(_infoFramesPerSecond);
     Info.Add(_infoWastedFrames);
 }
Example #22
0
        public Statistiques()
        {
            int nbStats = 0;

            Stats = new TrulyObservableCollection <Statistique>();
            Stats.Add(new Statistique("Élimination(s)", nbStats++));
            Stats.Add(new Statistique("Mort(s)", nbStats++));
            Stats.Add(new Statistique("Assistance(s)", nbStats++));
            Stats.Add(new Statistique("Batiment(s) détruit(s)", nbStats++));

            Stats.ItemPropertyChanged += PropertyChanged;
        }
 private void initStatistics()
 {
     _statistic = new Statistics();
     Info = new TrulyObservableCollection<InfoRow>();
     Info.Add(_infoDeviceName);
     Info.Add(_infoRightHand);
     Info.Add(_infoLeftHand);
     Info.Add(_infoSpine);
     Info.Add(_infoIsSkeletonDetected);
     Info.Add(_infoFramesPerSecond);
     Info.Add(_infoWastedFrames);
 }
Example #24
0
        public void Update()
        {
            var stocks = Mapper.Map <Stock[]>(_queryDispatcher.Execute <StockQuery, DtoStock[]>(new StockQuery()))
                         .OrderBy(x => x.InstanceCreationDate)
                         .ToArray();

            Stocks = new TrulyObservableCollection <Stock>(stocks);
            foreach (var stock in Stocks)
            {
                stock.Balance.PropertyChanged += BalanceOnPropertyChanged;
            }
            Stocks.CollectionChanged += StocksOnCollectionChanged;
        }
Example #25
0
 public ToDoListViewModel(IApplication app, IDataBase db)
 {
     _application         = app;
     _db                  = db;
     Pending              = new TrulyObservableCollection <ToDoItem>();
     Pending.ItemChanged += Pending_ItemChanged;
     Completed            = new TrulyObservableCollection <ToDoItem>();
     Pending.AddRange(_db.Todo.GetUncompleted());
     Completed.AddRange(_db.Todo.GetCompleteded());
     AddNewItemCommand           = Command.CreateCommand(AddNewItem);
     DeleteItemCommand           = Command.CreateCommand <int>(DeleteItem, CanDelete);
     DeleteCompletedItemsCommand = Command.CreateCommand(DeleteCompletedItems);
 }
Example #26
0
        public MainViewModel(
            IDeviceService deviceService,
            IWhitelistService whitelistSerice
            )
        {
            this.deviceService   = deviceService;
            this.whitelistSerice = whitelistSerice;

            AllowedProcesses              = new TrulyObservableCollection <AllowedProcess>();
            AllowedProcesses.ItemChanged += AllowedProcesses_ItemChanged;

            Load();
        }
        public override void Cleanup()
        {
            PathFolderDialogCommand = null;
            TexMakerCommand         = null;
            AddExtensionCommand     = null;
            ExitCommand             = null;
            _fileList         = null;
            _whiteList        = null;
            _currentWhiteList = null;
            _Languages        = null;

            base.Cleanup();
        }
        private void OpenCollectionForEditing(TrulyObservableCollection<CardInCollection> cards)
        {
            CardCollectionEditor.ItemsSource = cards;
            ListCollectionView view = (ListCollectionView)CollectionViewSource.GetDefaultView(cards);
            view.Filter = CardsFilter;
            if (!view.GroupDescriptions.Any())
            {
                view.GroupDescriptions.Add(new PropertyGroupDescription("CardClass"));
            }
            view.CustomSort = new CardInCollectionComparer();

            FlyoutCollection.IsOpen = true;
        }
Example #29
0
        /// <summary>
        /// Saves the rule config when changes are made
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RulesChangedHandler(object sender, NotifyCollectionChangedEventArgs e)
        {
            var collection    = new TrulyObservableCollection <MatchingRule>();
            var filteredRules = this._rules.Where(r => !string.IsNullOrEmpty(r.Pattern));//we don't want to save empty patterns!

            foreach (var filteredRule in filteredRules)
            {
                collection.Add(filteredRule);
            }

            Properties.Settings.Default.Rules = collection;
            Properties.Settings.Default.Save();
        }
Example #30
0
        public SatisViewModel(IDialogCoordinator instance, MainWindow mw)
        {
            model             = new SatisModel();
            SatisListesi      = new TrulyObservableCollection <SatisUrun>();
            _satisListesiB    = new TrulyObservableCollection <SatisUrun>();
            _alinanNakitB     = 0m;
            dialogCoordinator = instance;
            tcontrol          = mw.tcTabs;
            mwindow           = mw;

            HizliEkle = new ObservableCollection <Urun>(UrunListesi.Urunler.Where((x) => x.HizliEkle == true));

            UrunListesi.Urunler.CollectionChanged += (s, e) => HizliEkle = new ObservableCollection <Urun>(UrunListesi.Urunler.Where((x) => x.HizliEkle == true));
        }
        public TransactionsProvider(IQueryDispatcher queryDispatcher)
        {
            //lets cache categories [needed after not loading full categories in transaction query]:
            Mapper.Map <Category[]>(queryDispatcher.Execute <CategoryQuery, Data.DTO.Category[]>(new CategoryQuery()));

            var query = new TransactionQuery();

            DtoTransaction[] dtos = null;
            using (new MeasureTimeWrapper(() => dtos = queryDispatcher.Execute <TransactionQuery, DtoTransaction[]>(query), "query transactions")) { }

            Transaction[] transactions = null;
            using (new MeasureTimeWrapper(() => transactions = Mapper.Map <Transaction[]>(dtos), $"map transactions [{dtos.Length}]")) { }
            using (new MeasureTimeWrapper(() => AllTransactions = new TrulyObservableCollection <Transaction>(transactions), "create tru. ob. coll")) { }
        }
        private void OpenCollectionForEditing(TrulyObservableCollection <CardInCollection> cards)
        {
            CardCollectionEditor.ItemsSource = cards;
            ListCollectionView view = (ListCollectionView)CollectionViewSource.GetDefaultView(cards);

            view.Filter = CardsFilter;
            if (!view.GroupDescriptions.Any())
            {
                view.GroupDescriptions.Add(new PropertyGroupDescription("CardClass"));
            }
            view.CustomSort = new CardInCollectionComparer();

            FlyoutCollection.IsOpen = true;
        }
Example #33
0
        public SaveFilesViewModel()
        {
            if (Application.Current.MainWindow != null)
            {
                Application.Current.MainWindow.Closing += OnWindowClosing;
            }
            SaveFiles   = new TrulyObservableCollection <SaveFile>(SQLiteDataAccess.LoadSaveFiles());
            ReplayFiles = new TrulyObservableCollection <ReplayFile>(SQLiteDataAccess.LoadReplayFiles());
            SaveSlots   = new TrulyObservableCollection <SaveSlot>(SQLiteDataAccess.LoadSaveSlots());

            ReplayFiles.CollectionChanged += OnCollectionChanged;
            SaveFiles.CollectionChanged   += OnCollectionChanged;
            SaveSlots.CollectionChanged   += OnCollectionChanged;
            _isSaved = true;
        }
Example #34
0
        public MainPage()
        {
            InitializeComponent();
            Loaded += OnLoaded;
            FezHats = new TrulyObservableCollection<FezHatItem>
            {
                new MockFezHat(1),
                new MockFezHat(2),
                new MockFezHat(3)
            };

            var sensorPollTimer = new DispatcherTimer {Interval = new TimeSpan(0, 0, 1)};
            sensorPollTimer.Tick += SensorPollTimerOnTick;
            sensorPollTimer.Start();
        }
        /// <summary>
        /// Froms the XML.
        /// </summary>
        /// <param name="xml">The XML.</param>
        /// <exception cref="System.NotImplementedException"></exception>
        public override void FromXml(XElement xml)
        {
            if (xml.Attribute("name") != null)
            {
                this.Name = xml.Attribute("name").Value;
            }

            if (xml.Attribute("mobiseID") != null && !(this is ScreenModel))
            {
                this.mMobiseObjectID = xml.Attribute("mobiseID").Value;
            }

            ////if (xml.Attribute("class") != null)
            ////  this.StyleClass = xml.Attribute("class").Value;

            ////if (xml.Attribute("style") != null)
            ////    this.Style = xml.Attribute("style").Value;

            foreach (var attribute in xml.Attributes())
            {
                // don't load any attribute call type name or mobiseID because this are not part of the dynamic attributes
                if (attribute.Name.LocalName.ToLowerInvariant() != "type" && attribute.Name.LocalName.ToLowerInvariant() != "name" && attribute.Name.LocalName.ToLowerInvariant() != "mobiseid")
                {
                    var controlAttribute = this.mAttributesIndex.ContainsKey(attribute.Name.LocalName.ToLowerInvariant()) ? this.mAttributesIndex[attribute.Name.LocalName.ToLowerInvariant()] : null;//this.mControlDefinition.AllAttributes.FirstOrDefault(a => a.Name.ToLowerInvariant() == attribute.Name.LocalName.ToLowerInvariant());
                    if (controlAttribute != null)
                    {
                        this.mAttributes[controlAttribute] = controlAttribute.ParseValue(attribute.Value);
                    }
                }
            }

            if (xml.HasElements)
            {
                foreach (XElement childCollection in xml.Elements())
                {
                    var controlAttribute = this.mAttributesIndex.ContainsKey(childCollection.Name.LocalName.ToLowerInvariant()) ? this.mAttributesIndex[childCollection.Name.LocalName.ToLowerInvariant()] : null;//this.mControlDefinition.AllAttributes.FirstOrDefault(a => a.Name == mControlDefinition.ContainerProperty);
                    if (controlAttribute != null)
                    {
                        TrulyObservableCollection <UIControlInstanceModel> childItems = new TrulyObservableCollection <UIControlInstanceModel>();
                        if (childItems != null)
                        {
                            ReadFromXMLChildItems(xml, childCollection.Name.LocalName, childItems);
                        }
                        this.mAttributes[controlAttribute] = childItems;
                    }
                }
            }
        }
Example #36
0
        protected dynWorkspaceModel(
            String name, IEnumerable<dynNodeModel> e, IEnumerable<dynConnectorModel> c, double x, double y)
        {
            Name = name;

            Nodes = new TrulyObservableCollection<dynNodeModel>(e);
            Connectors = new TrulyObservableCollection<dynConnectorModel>(c);
            Notes = new ObservableCollection<dynNoteModel>();
            X = x;
            Y = y;

            HasUnsavedChanges = false;
            LastSaved = DateTime.Now;

            WorkspaceSaved += OnWorkspaceSaved;
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            //this.sbShowListViewItem.Begin();
            // ATTN: Please note it's a "TrulyObservableCollection" that's instantiated. Otherwise, "Trades[0].Qty = 999" will NOT trigger event handler "Trades_CollectionChanged" in main.
            // REF: http://stackoverflow.com/questions/8490533/notify-observablecollection-when-item-changes
            TrulyObservableCollection<Trade> Trades = new TrulyObservableCollection<Trade>();
            Trades.Add(new Trade { Symbol = "APPL", Qty = 123 });
            Trades.Add(new Trade { Symbol = "IBM", Qty = 456 });
            Trades.Add(new Trade { Symbol = "CSCO", Qty = 789 });

            Trades.CollectionChanged += Trades_CollectionChanged;
            //Trades.ItemPropertyChanged += PropertyChangedHandler;
            Trades.RemoveAt(2);

            Trades[0].Qty = 999;
        }
Example #38
0
		public FolderViewModel()
		{
			Scripts = new TrulyObservableCollection<ScriptViewModel>();
			
			Scripts.ItemChanged += (sender, args) =>
			{
				OnPropertyChanged("HasError");
				OnPropertyChanged("SucceededScriptsCount");
				OnPropertyChanged("FailedScriptsCount");
			};

			Scripts.CollectionChanged += (sender, args) =>
			{
				OnPropertyChanged("HasError");
				OnPropertyChanged("SucceededScriptsCount");
				OnPropertyChanged("FailedScriptsCount");
			};
		}
Example #39
0
        protected WorkspaceModel(
            String name, IEnumerable<NodeModel> e, IEnumerable<ConnectorModel> c, double x, double y)
        {
            Name = name;

            Nodes = new TrulyObservableCollection<NodeModel>(e);
            Connectors = new TrulyObservableCollection<ConnectorModel>(c);
            Notes = new ObservableCollection<NoteModel>();
            X = x;
            Y = y;

            HasUnsavedChanges = false;
            LastSaved = DateTime.Now;

            WorkspaceSaved += OnWorkspaceSaved;
            WorkspaceVersion = AssemblyHelper.GetDynamoVersion();
            undoRecorder = new UndoRedoRecorder(this);
        }
        public EditPoll()
        {
            InitializeComponent();

            try
            {
                Names = new ObservableCollection<NameIdModel>();
                progressIndicator = SystemTray.ProgressIndicator;
                progressIndicator = new ProgressIndicator();

                Voting = new VotingClass();
                Questions = new TrulyObservableCollection<VotingQuestionClass>();

                QuestionList.ItemsSource = Questions;
                RecipientsList.ItemsSource = Names;

            }
            catch (Exception exception)
            {
                ErrorHandler.Save(exception, MobileTypeEnum.WP8);
            }
        }
Example #41
0
        protected void LoadTournamentNamesFromWebResponse(
            string webResponse, 
            TrulyObservableCollection<TournamentName> tournamentNames,
            bool loadAll)
        {
            tournamentNames.Clear();

            var jss = new JavaScriptSerializer();
            TournamentName[] names = jss.Deserialize<TournamentName[]>(webResponse);

            foreach (var tournamentName in names)
            {
                if (loadAll)
                {
                    tournamentNames.Add(tournamentName);
                }
                else if (tournamentName.StartDate.AddMonths(3) > DateTime.Now)
                {
                    tournamentNames.Add(tournamentName);
                }
            }

            OnTournamentsUpdated();
        }
        /// <summary>
        /// Saves the rule config when changes are made
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RulesChangedHandler(object sender, NotifyCollectionChangedEventArgs e)
        {
            var collection = new TrulyObservableCollection<MatchingRule>();
            var filteredRules = this._rules.Where(r => !string.IsNullOrEmpty(r.Pattern));//we don't want to save empty patterns!

            foreach (var filteredRule in filteredRules)
            {
                collection.Add(filteredRule);
            }

            Properties.Settings.Default.Rules = collection;
            Properties.Settings.Default.Save();
        }
Example #43
0
        protected void LoadTournamentDescriptionsFromWebResponse(string responseString,
            TrulyObservableCollection<TournamentDescription> tournamentDescriptionNames)
        {
            string[] lines = responseString.Split('\n');
            string[][] csvParsedLines = CSVParser.Parse(lines);

            bool clearedDescriptions = false;
            int lineNumber = 0;
            foreach (var fields in csvParsedLines)
            {
                lineNumber++;
                if ((fields.Length == 0) || string.IsNullOrWhiteSpace(fields[0])) continue;

                if (!clearedDescriptions)
                {
                    clearedDescriptions = true;
                    
                }

                if (fields.Length < 3)
                {
                    // the description contains newlines, so the line number doesn't match up ...
                    throw new ArgumentException(string.Format("Website response: line {0}: contains fewer than 3 fields: {1}", lineNumber, lines[lineNumber - 1]));
                }

                var td = new TournamentDescription();

                int key;
                if (!int.TryParse(fields[0], out key))
                {
                    throw new ArgumentException(string.Format("Website response: line {0}: contains a bad key: {1}", lineNumber, fields[0]));
                }
                td.TournamentDescriptionKey = key;
                td.Name = fields[1];
                td.Description = fields[2].Replace("\r\r", "\r");

                tournamentDescriptionNames.Add(td);
            }
        }
Example #44
0
        public ResultsTabViewModel()
        {
            TournamentNames = new TrulyObservableCollection<TournamentName>();
            GetTournamentsVisible = Visibility.Visible;
            GotTournamentsVisible = Visibility.Collapsed;
            Is2DayTournament = Visibility.Collapsed;
            TournamentNameIndex = -1;

            CreateEmptyClosestToThePin();
            CsvDay1PoolFileName = new ObservableCollection<string>();
            CsvDay2PoolFileName = new ObservableCollection<string>();
            CsvDay1PoolTotal = new ObservableCollection<string>();
            CsvDay2PoolTotal = new ObservableCollection<string>();

            for(int i = 0; i < 4; i++)
            {
                CsvDay1PoolFileName.Add(string.Empty);
                CsvDay2PoolFileName.Add(string.Empty);

                CsvDay1PoolTotal.Add("$0 Day 1");
                CsvDay2PoolTotal.Add("$0 Day 2");
            }
            ChitsTotal = "$0 Total chits";
            ChitsFlights = string.Empty;

            _csvDay1PoolKvp = new List<KeyValuePair<string, string>>[4];
            _csvDay2PoolKvp = new List<KeyValuePair<string, string>>[4];

            CsvDay1PoolFileName.CollectionChanged += CsvDay1PoolFileName_CollectionChanged;
            CsvDay2PoolFileName.CollectionChanged += CsvDay2PoolFileName_CollectionChanged;
        }
        public TournamentTabViewModel()
        {
            Tournament = new Tournament();
            _allTournamentNames = new TrulyObservableCollection<TournamentName>();

            TournamentDescriptionNames = new TrulyObservableCollection<TournamentDescription>();
            TournamentDescription = new TournamentDescription();
            TournamentDescriptionNameIndex = -1;

            TournamentChairmen = new TrulyObservableCollection<TournamentChairman>();
            TournamentChairmenSelectedIndex = -1;

            ReadTournamentChairmen();
        }
Example #46
0
        /*
        public void DoDynamicAnimation(object sender, MouseButtonEventArgs args)
        {
            for (var i = 0; i < 36; ++i)
            {
                // var e = new Button { Width = 50, Height = 16, Content="Test" };

                //var e = new Ellipse { Width = 16, Height = 16, Fill = SystemColors.HighlightBrush };
                //var e = new Ellipse { Width = 6, Height = 6, Fill=Brushes.HotPink };

                var e = new SliderNode(this) {Left = Mouse.GetPosition(this).X, Top = Mouse.GetPosition(this).Y};

                // var e = new TextBlock { Text = "Test" };
                // var e = new Slider { Width = 100 };

                // var e = new ProgressBar { Width = 100 , Height =10, Value=i };

                // var e = =new DataGrid{Width=100, Height=100};
                // var e = new TextBox { Text = "Hallo" };
                // var e = new Label { Content = "Halllo" };
                // var e = new RadioButton { Content="dfsdf" };

                //Canvas.SetLeft(e, Mouse.GetPosition(this).X);
                //Canvas.SetTop(e, Mouse.GetPosition(this).Y);

                var tg = new TransformGroup();
                var translation = new TranslateTransform(30, 0);
                var translationName = "myTranslation" + translation.GetHashCode();
                RegisterName(translationName, translation);
                tg.Children.Add(translation);
                tg.Children.Add(new RotateTransform(i*10));
                e.RenderTransform = tg;

                NodeCollection.Add(e);
                Children.Add(e);

                var anim = new DoubleAnimation(3, 250, new Duration(new TimeSpan(0, 0, 0, 2, 0)))
                {
                    EasingFunction = new PowerEase {EasingMode = EasingMode.EaseOut}
                };

                var s = new Storyboard();
                Storyboard.SetTargetName(s, translationName);
                Storyboard.SetTargetProperty(s, new PropertyPath(TranslateTransform.YProperty));
                var storyboardName = "s" + s.GetHashCode();
                Resources.Add(storyboardName, s);

                s.Children.Add(anim);

                s.Completed +=
                    (sndr, evtArgs) =>
                    {
                        //panel.Children.Remove(e);
                        Resources.Remove(storyboardName);
                        UnregisterName(translationName);
                    };
                s.Begin();
            }
        }
        */


        public void VplControl_KeyUp(object sender, KeyEventArgs e)
        {
            switch (e.Key)
            {
                case Key.Delete:

                    // Do not Delete if there is an ScriptingNode in the selection -> Delete Key is used several times inside ... 
                    foreach (var node in SelectedNodes)
                    {
                        if (node.GetType().ToString() == "TUM.CMS.VPL.Scripting.Nodes.ScriptingNode")
                            return;
                        node.Delete();
                    }
                        

                    SelectedNodes.Clear();
                    break;
                case Key.C:
                {
                    if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
                    {
                        tempCollection = new TrulyObservableCollection<Node>();


                        foreach (var node in SelectedNodes)
                            tempCollection.Add(node);
                    }
                }
                    break;
                case Key.V:
                {
                    if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
                    {
                        // Do not copy if there is an ScriptingNode in the selection
                        if (SelectedNodes.Any(node => node.GetType().ToString() == "TUM.CMS.VPL.Scripting.Nodes.ScriptingNode"))
                        {
                            return;
                        }

                        if (tempCollection == null) return;
                        if (tempCollection.Count == 0) return;

                        var bBox = Node.GetBoundingBoxOfNodes(tempCollection.ToList());

                        var copyPoint = new Point(bBox.Left + bBox.Size.Width/2, bBox.Top + bBox.Size.Height/2);
                        var pastePoint = Mouse.GetPosition(this);

                        var delta = Point.Subtract(pastePoint, copyPoint);

                        SelectedNodes.Clear();

                        var alreadyClonedConnectors = new List<Connector>();
                        var copyConnections = new List<CopyConnection>();

                        // copy nodes from clipboard to canvas
                        foreach (var node in tempCollection)
                        {
                            var newNode = node.Clone();

                            newNode.Left += delta.X;
                            newNode.Top += delta.Y;

                            newNode.Left = Convert.ToInt32(newNode.Left);
                            newNode.Top = Convert.ToInt32(newNode.Top);

                            NodeCollection.Add(newNode);

                            copyConnections.Add(new CopyConnection {NewNode = newNode, OldNode = node});
                        }

                        foreach (var cc in copyConnections)
                        {
                            var counter = 0;

                            foreach (var conn in cc.OldNode.InputPorts)
                            {
                                foreach (var connector in conn.ConnectedConnectors)
                                {
                                    if (!alreadyClonedConnectors.Contains(connector))
                                    {
                                        Connector newConnector = null;

                                        // start and end node are contained in selection
                                        if (tempCollection.Contains(connector.StartPort.ParentNode))
                                        {
                                            var cc2 =
                                                copyConnections.FirstOrDefault(
                                                    i => Equals(i.OldNode, connector.StartPort.ParentNode));

                                            if (cc2 != null)
                                            {
                                                newConnector = new Connector(this, cc2.NewNode.OutputPorts[0],
                                                    cc.NewNode.InputPorts[counter]);
                                            }
                                        }
                                        // only end node is contained in selection
                                        else
                                        {
                                            newConnector = new Connector(this, connector.StartPort,
                                                cc.NewNode.InputPorts[counter]);
                                        }

                                        if (newConnector != null)
                                        {
                                            alreadyClonedConnectors.Add(connector);
                                            ConnectorCollection.Add(newConnector);
                                        }
                                    }
                                }
                                counter++;
                            }
                        }
                    }
                }
                    break;
                case Key.G:
                {
                    if (Keyboard.Modifiers == ModifierKeys.Control)
                        GroupNodes();
                }
                    break;
                case Key.S:
                {
                    if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
                        SaveFile();
                }
                    break;
                case Key.O:
                {
                    if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
                        OpenFile();
                }
                    break;
                case Key.A:
                {
                    if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
                    {
                        SelectedNodes.Clear();

                        foreach (var node in NodeCollection)
                        {
                            node.IsSelected = true;
                            SelectedNodes.Add(node);
                        }
                    }
                }
                    break;
            }
        }
        public VplControl()
        {
            try
            {
                DefaultStyleKeyProperty.OverrideMetadata(typeof (VplControl),
                    new FrameworkPropertyMetadata(typeof (VplControl)));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            Style = FindResource("VplControlStyle") as Style;
            GraphFlowDirection = GraphFlowDirections.Vertical;


            MouseDown += HandleMouseDown;
            MouseMove += HandleMouseMove;
            MouseUp += HandleMouseUp;
            MouseWheel += HandleMouseWheel;
            KeyDown += VplControl_KeyDown;
            KeyUp += VplControl_KeyDown;

            NodeCollection = new TrulyObservableCollection<Node>();
            NodeGroupCollection = new List<NodeGroup>();
            ConnectorCollection = new List<Connector>();
            SelectedNodes = new TrulyObservableCollection<Node>();
            ExternalNodeTypes = new List<Type>();

            TypeSensitive = true;

            // Zooming 
            scaleTransform = new ScaleTransform();
            translateTransform = new TranslateTransform();
            transformGroup = new TransformGroup();
            transformGroup.Children.Add(scaleTransform);
            transformGroup.Children.Add(translateTransform);

            // Zooming Transformation
            LayoutTransform = transformGroup;

            // Init Grid for the background
            var visualBrush = new VisualBrush
            {
                TileMode = TileMode.Tile,
                Viewport = new Rect(0, 0, 50, 50),
                ViewportUnits = BrushMappingMode.Absolute,
                Viewbox = new Rect(0, 0, 50, 50),
                ViewboxUnits = BrushMappingMode.Absolute,
                Visual = new Rectangle
                {
                    Stroke = Brushes.DarkGray,
                    StrokeThickness = 0.1,
                    Height = 1000,
                    Width = 1000,
                    Fill = Brushes.White
                }
            };

            Theme = new Theme(this) {FontFamily = TextElement.GetFontFamily(this)};

            var solidColorBrush = TextElement.GetForeground(this) as SolidColorBrush;
            if (solidColorBrush != null)
                Theme.ForegroundColor = solidColorBrush.Color;

            var colorBrush = Application.Current.Resources["BackgroundBrush"] as SolidColorBrush;
            if (colorBrush != null)
                Theme.BackgroundColor = colorBrush.Color;

            var gridBrush = Application.Current.Resources["GridBrush"] as SolidColorBrush;
            if (gridBrush != null)
                Theme.GridColor = gridBrush.Color;

            var connectorBrush = Application.Current.Resources["ConnectorBrush"] as SolidColorBrush;
            if (connectorBrush != null)
                Theme.ConnectorColor = connectorBrush.Color;

            Theme.ConnectorThickness =
                Application.Current.Resources["ConnectorThickness"] is double
                    ? (double) Application.Current.Resources["ConnectorThickness"]
                    : 0;


            var toolTipBackgroundBrush = Application.Current.Resources["TooltipBackgroundBrush"] as SolidColorBrush;
            if (toolTipBackgroundBrush != null)
            {
                Theme.TooltipBackgroundColor =
                    toolTipBackgroundBrush.Color;
            }

            var tooltipBorderBrush = Application.Current.Resources["TooltipBorderBrush"] as SolidColorBrush;
            if (tooltipBorderBrush != null)
                Theme.TooltipBorderColor = tooltipBorderBrush.Color;

            var portFillBrush = Application.Current.Resources["PortFillBrush"] as SolidColorBrush;
            if (portFillBrush != null)
                Theme.PortFillColor = portFillBrush.Color;

            var portStrokeBrush = Application.Current.Resources["PortStrokeBrush"] as SolidColorBrush;
            if (portStrokeBrush != null)
                Theme.PortStrokeColor = portStrokeBrush.Color;

            Theme.PortSize =
                Application.Current.Resources["PortSize"] is double
                    ? (double) Application.Current.Resources["PortSize"]
                    : 0;

            Theme.PortStrokeThickness =
                Application.Current.Resources["PortStrokeThickness"] is double
                    ? (double) Application.Current.Resources["PortStrokeThickness"]
                    : 0;

            Theme.NodeBackgroundColor = Colors.White;

            Theme.ButtonBorderColor = (Application.Current.Resources["ButtonBorderBrush"] as SolidColorBrush).Color;

            Theme.ButtonFillColor = (Application.Current.Resources["ButtonFillBrush"] as SolidColorBrush).Color;

            Theme.HighlightingColor = (Application.Current.Resources["BrushHighlighting"] as SolidColorBrush).Color;

            Theme.NodeBorderColor = (Application.Current.Resources["NodeBorderBrush"] as SolidColorBrush).Color;

            //NodeBorderThickness = Application.Current.Resources["NodeBorderThickness"] is Thickness ? (Thickness) Application.Current.Resources["NodeBorderThickness"] : new Thickness(),

            Theme.NodeBorderCornerRadius =
                Application.Current.Resources["NodeBorderCornerRadius"] is double
                    ? (double) Application.Current.Resources["NodeBorderCornerRadius"]
                    : 0;

            Theme.NodeBorderColorOnMouseOver =
                (Application.Current.Resources["NodeBorderBrushMouseOver"] as SolidColorBrush).Color;

            Theme.NodeBorderColorOnSelection =
                (Application.Current.Resources["NodeBorderBrushSelection"] as SolidColorBrush).Color;

            Theme.LineColor = (Application.Current.Resources["LineStrokeBrush"] as SolidColorBrush).Color;

            Theme.LineThickness =
                Application.Current.Resources["LineStrokeThickness"] is double
                    ? (double) Application.Current.Resources["LineStrokeThickness"]
                    : 0;

            Theme.ConnEllipseFillColor =
                (Application.Current.Resources["ConnEllipseFillBrush"] as SolidColorBrush).Color;

            Theme.ConnEllipseSize =
                Application.Current.Resources["ConnEllipseSize"] is double
                    ? (double) Application.Current.Resources["ConnEllipseSize"]
                    : 0;
        }
 public TournamentDescriptionTabViewModel()
 {
     TournamentDescriptionNames = new TrulyObservableCollection<WebAdmin.TournamentDescription>();
     TournamentDescription = new TournamentDescription();
     TournamentDescriptionNameIndex = -1;
 }
 /// <summary>
 /// Only to be used when AutoLogGenerating
 /// </summary>
 /// <param name="log"></param>
 private void AppendLogAndUpdate(List<LogTrace> log)
 {
     EntireLog = new TrulyObservableCollection<LogTrace>(EntireLog.ToList().Concat(log));
     UpdateCurrentLogIfNeeded();
 }
Example #50
0
        private void CreateEmptyClosestToThePin()
        {
            ClosestToThePinsDay1 = new TrulyObservableCollection<ClosestToThePin>();
            ClosestToThePinsDay1.Add(new ClosestToThePin { Hole = 5 });
            ClosestToThePinsDay1.Add(new ClosestToThePin { Hole = 9 });
            ClosestToThePinsDay1.Add(new ClosestToThePin { Hole = 11 });
            ClosestToThePinsDay1.Add(new ClosestToThePin { Hole = 15 });

            ClosestToThePinsDay2 = new TrulyObservableCollection<ClosestToThePin>();
            ClosestToThePinsDay2.Add(new ClosestToThePin { Hole = 5 });
            ClosestToThePinsDay2.Add(new ClosestToThePin { Hole = 9 });
            ClosestToThePinsDay2.Add(new ClosestToThePin { Hole = 11 });
            ClosestToThePinsDay2.Add(new ClosestToThePin { Hole = 15 });
        }
 private void ManageStandardCards_Click(object sender, RoutedEventArgs e)
 {
     var collection = new TrulyObservableCollection<CardInCollection>(SetsInfo.Where(s => s.IsStandardSet).SelectMany(si => si.SetCards).ToList());
     OpenCollectionForEditing(collection);
 }
Example #52
0
 public StyleDatabase(SettingsHelper helperArg)
 {
     Global.CallNew(out settings);
     foreach (var e in Enum.GetValues(typeof(FormatterSettingsScope)).Cast<FormatterSettingsScope> ())
         settings.Add(e, new FormatSettings());
     settingsHelper = helperArg;
     styles = new TrulyObservableCollection<StyleInfo>();
     foreach (ClangFormat.StyleId id in Enum.GetValues(typeof(ClangFormat.StyleId)))
         styles.Add(new PredefinedStyleInfo(id));
     styles.Add(new FileStyleInfo());
     customViewSource = new CollectionViewSource { Source = styles };
     customViewSource.View.Filter = p => p is CustomStyleInfo;
     allViewSource = new CollectionViewSource { Source = styles };
     loadSettings();
 }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedFrom(e);
            try
            {






                var currentObject = (App.Current as App).SecondPageObject;
                if (currentObject != null)
                {
                    if (currentObject.GetType() == typeof(VotingQuestionClass))
                    {
                        var quest = ((VotingQuestionClass)currentObject);
                        var tempQuest = Questions.Where(x => x.QuestionId == quest.QuestionId).FirstOrDefault();
                        if (tempQuest == null)
                        {
                            Voting.Questions.Add(quest);
                            Questions.Add(quest);
                        }
                        else
                        {
                            if (quest.IsDeleted)
                            {
                                Questions.Remove(tempQuest);
                            }
                            else
                            {
                                int index = Questions.IndexOf(tempQuest);
                                Questions.Remove(tempQuest);
                                Questions.Insert(index, quest);
                                QuestionList.ItemsSource = null;
                                QuestionList.ItemsSource = Questions;
                            }
                        }
                    }
                    else if (currentObject.GetType() == typeof(ObservableCollection<NameIdModel>))
                        Names = ((ObservableCollection<NameIdModel>)currentObject);
                }
                else
                {
                    Voting = new VotingClass();
                    Questions = new TrulyObservableCollection<VotingQuestionClass>();
                    QuestionList.ItemsSource = Questions;
                    RecipientsList.ItemsSource = Names;
                    progressIndicator = SystemTray.ProgressIndicator;
                    progressIndicator = new ProgressIndicator();
                    SystemTray.SetProgressIndicator(this, progressIndicator);
                    progressIndicator.IsIndeterminate = true;
                    progressIndicator.Text = "Pulling Poll...";
                    if (SettingsMobile.Instance.User == null)
                    {
                        SqlFactory fact = new SqlFactory();
                        SettingsMobile.Instance.User = fact.GetProfile();
                    }
                    Voting.VotingId = Convert.ToInt64(this.NavigationContext.QueryString["pid"]);
                    PullTopic();
                }
                (App.Current as App).SecondPageObject = null;

            }
            catch (Exception exception)
            {
                ErrorHandler.Save(exception, MobileTypeEnum.WP8);
            }
        }
Example #54
0
        /*
        public void DoDynamicAnimation(object sender, MouseButtonEventArgs args)
        {
            for (var i = 0; i < 36; ++i)
            {
                // var e = new Button { Width = 50, Height = 16, Content="Test" };

                //var e = new Ellipse { Width = 16, Height = 16, Fill = SystemColors.HighlightBrush };
                //var e = new Ellipse { Width = 6, Height = 6, Fill=Brushes.HotPink };

                var e = new SliderNode(this) {Left = Mouse.GetPosition(this).X, Top = Mouse.GetPosition(this).Y};

                // var e = new TextBlock { Text = "Test" };
                // var e = new Slider { Width = 100 };

                // var e = new ProgressBar { Width = 100 , Height =10, Value=i };

                // var e = =new DataGrid{Width=100, Height=100};
                // var e = new TextBox { Text = "Hallo" };
                // var e = new Label { Content = "Halllo" };
                // var e = new RadioButton { Content="dfsdf" };

                //Canvas.SetLeft(e, Mouse.GetPosition(this).X);
                //Canvas.SetTop(e, Mouse.GetPosition(this).Y);

                var tg = new TransformGroup();
                var translation = new TranslateTransform(30, 0);
                var translationName = "myTranslation" + translation.GetHashCode();
                RegisterName(translationName, translation);
                tg.Children.Add(translation);
                tg.Children.Add(new RotateTransform(i*10));
                e.RenderTransform = tg;

                NodeCollection.Add(e);
                Children.Add(e);

                var anim = new DoubleAnimation(3, 250, new Duration(new TimeSpan(0, 0, 0, 2, 0)))
                {
                    EasingFunction = new PowerEase {EasingMode = EasingMode.EaseOut}
                };

                var s = new Storyboard();
                Storyboard.SetTargetName(s, translationName);
                Storyboard.SetTargetProperty(s, new PropertyPath(TranslateTransform.YProperty));
                var storyboardName = "s" + s.GetHashCode();
                Resources.Add(storyboardName, s);

                s.Children.Add(anim);

                s.Completed +=
                    (sndr, evtArgs) =>
                    {
                        //panel.Children.Remove(e);
                        Resources.Remove(storyboardName);
                        UnregisterName(translationName);
                    };
                s.Begin();
            }
        }
        */


        public void VplControl_KeyUp(object sender, KeyEventArgs e)
        {
            switch (e.Key)
            {
                case Key.Delete:

                    foreach (var node in SelectedNodes)
                        node.Delete();

                    foreach (var conn in SelectedConnectors)
                    {
                        conn.Delete();
                    }

                    SelectedNodes.Clear();
                    SelectedConnectors.Clear();
                    break;
                case Key.C:
                {
                    if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
                    {
                        tempCollection = new TrulyObservableCollection<Node>();


                        foreach (var node in SelectedNodes)
                            tempCollection.Add(node);
                    }
                }
                    break;
                case Key.V:
                {
                    if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
                    {
                        if (tempCollection == null) return;
                        if (tempCollection.Count == 0) return;

                        var bBox = Node.GetBoundingBoxOfNodes(tempCollection.ToList());

                        var copyPoint = new Point(bBox.Left + bBox.Size.Width/2, bBox.Top + bBox.Size.Height/2);
                        var pastePoint = Mouse.GetPosition(this);

                        var delta = Point.Subtract(pastePoint, copyPoint);

                        UnselectAllElements();

                        var alreadyClonedConnectors = new List<Connector>();
                        var copyConnections = new List<CopyConnection>();

                        // copy nodes from clipboard to canvas
                        foreach (var node in tempCollection)
                        {
                            var newNode = node.Clone();

                            newNode.Left += delta.X;
                            newNode.Top += delta.Y;

                            newNode.Left = Convert.ToInt32(newNode.Left);
                            newNode.Top = Convert.ToInt32(newNode.Top);

                            newNode.Show();

                            copyConnections.Add(new CopyConnection {NewNode = newNode, OldNode = node});

                        }

                        foreach (var cc in copyConnections)
                        {
                            var counter = 0;

                            foreach (var conn in cc.OldNode.InputPorts)
                            {
                                foreach (var connector in conn.ConnectedConnectors)
                                {
                                    if (!alreadyClonedConnectors.Contains(connector))
                                    {
                                        Connector newConnector = null;

                                        // start and end node are contained in selection
                                        if (tempCollection.Contains(connector.StartPort.ParentNode))
                                        {
                                            var cc2 =
                                                copyConnections.FirstOrDefault(
                                                    i => Equals(i.OldNode, connector.StartPort.ParentNode));

                                            if (cc2 != null)
                                            {
                                                newConnector = new Connector(this, cc2.NewNode.OutputPorts[0],
                                                    cc.NewNode.InputPorts[counter]);
                                            }
                                        }
                                        // only end node is contained in selection
                                        else
                                        {
                                            newConnector = new Connector(this, connector.StartPort,
                                                cc.NewNode.InputPorts[counter]);
                                        }

                                        if (newConnector != null)
                                        {
                                            alreadyClonedConnectors.Add(connector);
                                            ConnectorCollection.Add(newConnector);
                                        }
                                    }
                                }
                                counter++;
                            }
                        }
                    }
                }
                    break;
                case Key.G:
                {
                    if (Keyboard.Modifiers == ModifierKeys.Control)
                        GroupNodes();
                }
                    break;

                case Key.S:
                {
                    if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
                        SaveFile();
                }
                    break;
                case Key.T:
                {
                    Console.WriteLine("T");
                    foreach (var node in NodeCollection)
                    {
                        Console.WriteLine(node.ActualWidth);
                        Console.WriteLine(node.ActualHeight);
                    }
                }
                    break;
                case Key.O:
                {
                    if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
                        OpenFile();
                }
                    break;
                case Key.A:
                {
                    if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
                    {
                        SelectedNodes.Clear();

                        foreach (var node in NodeCollection)
                        {
                            node.IsSelected = true;
                            SelectedNodes.Add(node);
                        }
                    }
                }
                    break;
                case Key.Escape:
                {
                    UnselectAllElements();
                    mouseMode = MouseMode.Nothing;
                }
                    break;
                case Key.LeftCtrl:
                    if (!Keyboard.IsKeyDown(Key.RightCtrl)) ShowElementsAfterTransformation();
                    break;
                case Key.RightCtrl:
                    if (!Keyboard.IsKeyDown(Key.LeftCtrl)) ShowElementsAfterTransformation();
                    break;
            }
        }
Example #55
0
 public TeeTimeRequest()
 {
     Players = new TrulyObservableCollection<Player>();
 }
        private void ShowTournamentNames()
        {
            if (ShowAllTournamentNames)
            {
                TournamentNames = _allTournamentNames;
            }
            else
            {
                TournamentNames = new TrulyObservableCollection<TournamentName>();

                foreach (var tournamentName in _allTournamentNames)
                {
                    if (tournamentName.StartDate.AddMonths(3) > DateTime.Now)
                    {
                        TournamentNames.Add(tournamentName);
                    }
                }
            }
        }
Example #57
0
        public PaymentsTabViewModel()
        {
            TournamentNames = new TrulyObservableCollection<TournamentName>();
            TeeTimeRequests = new TrulyObservableCollection<TeeTimeRequest>();

            GetTournamentsVisible = Visibility.Visible;
            GotTournamentsVisible = Visibility.Collapsed;
        }
Example #58
0
        private async Task LoadSignupsFromWeb(object o)
        {
            if (TournamentNames.Count == 0)
            {
                MessageBox.Show("You must select a touranment first");
                return;
            }
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(WebAddresses.BaseAddress);

                using (new WaitCursor())
                {
                    var values = new List<KeyValuePair<string, string>>();

                    values.Add(new KeyValuePair<string, string>("tournament",
                        TournamentNames[TournamentNameIndex].TournamentKey.ToString(CultureInfo.InvariantCulture)));

                    var content = new FormUrlEncodedContent(values);

                    var response = await client.PostAsync(WebAddresses.ScriptFolder + WebAddresses.GetSignups, content);
                    var responseString = await response.Content.ReadAsStringAsync();

                    Logging.Log("LoadSignupsFromWeb", responseString);

                    TeeTimeRequests.Clear();
                    List<TeeTimeRequest> ttr = LoadSignupsFromWebResponse(responseString);

                    PaymentsDue = 0;
                    PaymentsMade = 0;
                    TrulyObservableCollection<TeeTimeRequest> ttr2 = new TrulyObservableCollection<TeeTimeRequest>();
                    foreach (var teeTimeRequest in ttr)
                    {
                        ttr2.Add(teeTimeRequest);
                        PaymentsDue += teeTimeRequest.PaymentDue;
                        PaymentsMade += teeTimeRequest.PaymentMade;
                    }
                    TeeTimeRequests = ttr2;
                    ttr2.CollectionChanged += TeeTimeRequests_CollectionChanged;
                }
            }
        }
        public void Init()
        {
            Activities = new ObservableCollection<Activity>();

            _contradictionApproach = new ContradictionApproach(new HashSet<Activity>(Activities));
            ContradictionApproach.PostProcessingResultEvent += UpdateGraphWithPostProcessingResult;

            _redundancyRemover = new RedundancyRemover();
            _redundancyRemover.ReportProgress += ProgressMadeInRedundancyRemover;
            
            ActivityButtons = new ObservableCollection<ActivityNameWrapper>();

            EntireLog = new TrulyObservableCollection<LogTrace>();

            PerformPostProcessing = false;

            IsTraceAdditionAllowed = true;
            
            var startOptionsViewModel = new StartOptionsWindowViewModel();
            startOptionsViewModel.AlphabetSizeSelected += SetUpWithAlphabet;
            startOptionsViewModel.LogLoaded += SetUpWithLog;
            startOptionsViewModel.DcrGraphLoaded += SetUpWithGraph;
            
            OpenStartOptionsEvent?.Invoke(startOptionsViewModel);
        }