Example #1
0
 //форма с комбобоксом пошла
 public static void UserAdd()
 {
     Data.ModelCode.CompanyContext bd = new Data.ModelCode.CompanyContext();
     if (bd.Companies.ToList().Count == 0)
     {
         View.AddComp         user = new View.AddComp(Application.Current.MainWindow);
         ViewModels.ViewModel Add  = user.DataContext as ViewModels.ViewModel;
         Add.AddComp = user;
         user.Show();
     }
     else
     {
         View.AddUserCompany  addUserCompany = new View.AddUserCompany(Application.Current.MainWindow as MainWindow);
         ViewModels.ViewModel Add            = addUserCompany.DataContext as ViewModels.ViewModel;
         Add.AddUserCompany = addUserCompany;
         List <string> companies = new List <string>();
         for (int i = 0; i < bd.Companies.ToList().Count; i++)
         {
             companies.Add(bd.Companies.ToList()[i].Name);
         }
         addUserCompany.UserCombo.ItemsSource  = companies;
         addUserCompany.UserCombo.SelectedItem = 0;
         addUserCompany.Show();
     }
 }
Example #2
0
 public void FillVM(ref ViewModels.ViewModel VM)
 {
     VM.DrawedVertexCount = indices.Count;
     VM.IndexBuffer       = indexBuff;
     VM.Textures          = new[] { tex, nM };
     VM.VertexBinging     = vb;
 }
Example #3
0
 public static void ShowWimdowUser(Models.Data.Company company)
 {
     View.AddUser         user      = new View.AddUser(Application.Current.MainWindow);
     ViewModels.ViewModel viewModel = (ViewModels.ViewModel)user.DataContext;
     viewModel.AddUser = user;
     user.Show();
 }
Example #4
0
        public CameraPage()
        {
            InitializeComponent();
            var vm = new ViewModels.ViewModel();

            BindingContext = vm;
        }
 private void window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (model != null)
     {
         model.close_clear();
         model = null;
     }
     Application.Current.Shutdown();
 }
Example #6
0
 public Model(ViewModels.ViewModel vm)
 {
     _KijeloltElem1 = 0;
     _KijeloltElem2 = 0;
     FajlLista1     = new List <FajlAdatok>();
     FajlLista2     = new List <FajlAdatok>();
     VM             = vm;
     BillentyuzetVezerlo.Instance.MODEL = this;
     _TobbszorosenKijeloltElemek1       = new List <int>();
     _TobbszorosenKijeloltElemek2       = new List <int>();
     _Meghajtok = new ObservableCollection <string>();
     MeghajtoFeltolt();
 }
 bool IsThePlaylistNameUsed(string name)
 {
     ViewModels.ViewModel vm = this.DataContext as ViewModels.ViewModel;
     if (vm != null)
     {
         foreach (var p in vm.Settings.PlayListList)
         {
             if (string.Equals(p.Name, name))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Example #8
0
        /// <summary>
        /// Function that's run when the program first starts.
        /// Set up the data context links with the local variables.
        /// </summary>
        public MainWindow(
            ViewModels.ViewModel model,
            Navigation.AvaloniaNavigationService navigationService,
            ILogger <MainWindow> logger)
        {
            // Initialize the readonly properties.
            this.ViewModel         = model;
            this.NavigationService = navigationService;
            this.Logger            = logger;

            try
            {
                // Set up an event handler for any otherwise unhandled exceptions in the code.
                AppDomain.CurrentDomain.UnhandledException   += CurrentDomain_UnhandledException;
                AppDomain.CurrentDomain.FirstChanceException += CurrentDomain_FirstChanceException;

                // Initialize the window.
                AvaloniaXamlLoader.Load(this);

                // Set the title.
                Title = $"{SystemInfo.ProductInfo.Name} - {SystemInfo.ProductInfo.Version}";

                // Load configuration data
                Collections.QuestCollection?quests = null;
                string?currentQuest = null;

                try
                {
                    this.Logger.LogDebug("Loading configuration.");
                    Config.NetTallyConfig.Load(out quests, out currentQuest, Options.AdvancedOptions.Instance);
                    this.Logger.LogInformation("Configuration loaded.");
                }
                catch (ConfigurationErrorsException e)
                {
                    this.Logger.LogError(e, "Failure during configuration.");
                    WarningDialog.Show("Error in configuration. Current configuration ignored.", "Error in configuration");
                }

                // Complete the platform setup.
                this.PlatformSetup(quests, currentQuest);
            }
            catch (Exception e)
            {
                this.Logger.LogError(e, "Failure during program startup.");
                WarningDialog.Show("Unable to start the program.", "Failure on startup");
                this.Close();
            }
        }
 private void comboPlayList_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
 {
     RemoveButton.IsEnabled = false;
     ImportButton.IsEnabled = false;
     if (comboPlayList.Items.Count > 0)
     {
         ViewModels.ViewModel vm = this.DataContext as ViewModels.ViewModel;
         if (vm != null)
         {
             string PlaylistPath = vm.Settings.CurrentPlayListPath;
             int    index        = 0;
             foreach (var item in comboPlayList.Items)
             {
                 if (item is Models.PlayList)
                 {
                     Models.PlayList p = item as Models.PlayList;
                     if (p != null)
                     {
                         if (string.Equals(p.Path, PlaylistPath))
                         {
                             comboPlayList.SelectedIndex = index;
                             break;
                         }
                         if (string.Equals(p.ImportedPath, PlaylistPath))
                         {
                             comboPlayList.SelectedIndex = index;
                             break;
                         }
                     }
                 }
                 index++;
             }
             if (comboPlayList.SelectedIndex < 0)
             {
                 comboPlayList.SelectedIndex = 0;
             }
         }
     }
 }
Example #10
0
 public ContactList()
 {
     this.InitializeComponent();
     ViewModels.ViewModel vm = new ViewModels.ViewModel();
     GV.ItemsSource = vm.Mails;
 }
Example #11
0
        private async void AddPlaylist_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            var filePicker = new Windows.Storage.Pickers.FileOpenPicker();

            filePicker.FileTypeFilter.Add(".json");
            filePicker.FileTypeFilter.Add(".tma");
            filePicker.ViewMode = Windows.Storage.Pickers.PickerViewMode.Thumbnail;
            //filePicker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.VideosLibrary;
            filePicker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.MusicLibrary;
            filePicker.SettingsIdentifier     = "PlaylistPicker";
            filePicker.CommitButtonText       = "Add JSON or TMA (TestMEdiaApp)  Playlist File to your list";

            ClearErrorMessage();

            var file = await filePicker.PickSingleFileAsync();

            if (file != null)
            {
                string fileToken = Windows.Storage.AccessCache.StorageApplicationPermissions.FutureAccessList.Add(file);
                try
                {
                    Shell.Current.DisplayWaitRing = true;
                    //Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Wait, 1);
                    Models.PlayList playlist = await Models.PlayList.GetNewPlaylist(file.Path);

                    if (playlist != null)
                    {
                        if (playlist.Count > 0)
                        {
                            if (!IsThePlaylistNameUsed(playlist.Name))
                            {
                                ViewModels.ViewModel vm = this.DataContext as ViewModels.ViewModel;
                                if (vm != null)
                                {
                                    ObservableCollection <Models.PlayList> PlayListList = vm.Settings.PlayListList;
                                    PlayListList.Add(playlist);
                                    vm.Settings.PlayListList = PlayListList;
                                    if (!SelectPlaylistWithName(playlist.Name))
                                    {
                                        ImportButton.IsEnabled = false;
                                        RemoveButton.IsEnabled = false;
                                    }
                                }
                            }
                            else
                            {
                                SetErrorMessage("Playlist name already used");
                            }
                        }
                        else
                        {
                            SetErrorMessage("Playlist empty: 0 item");
                        }
                    }
                    else
                    {
                        SetErrorMessage("Error while parsing the playlist file");
                    }
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("Exception: " + ex.Message);
                }
                finally
                {
                    Shell.Current.DisplayWaitRing = false;
                    //Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Arrow, 1);
                }
            }
        }
 public MainWindow()
 {
     InitializeComponent();
     model = new ViewModels.ViewModel();
     this.DataContext = model;
 }
Example #13
0
 public void Bind(ViewModels.ViewModel cardsViewModel)
 {
     DataContext = cardsViewModel;
 }
Example #14
0
 public CustomerList()
 {
     this.InitializeComponent();
     ViewModels.ViewModel vm = new ViewModels.ViewModel();
     CL.ItemsSource = vm.Customers;
 }
Example #15
0
 public FajlMuveletek(ViewModels.ViewModel vm)
 {
     VM = vm;
 }