private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            StartupWindow window = new StartupWindow();

            if (window.ShowDialog() == true)
            {
                this.Init(window.ProjectName, window.ProjectLocation);
            }
        }
示例#2
0
        private async void Application_StartupAsync(object sender, StartupEventArgs e)
        {
            if (!mutex.WaitOne(0, false))
            {
                MessageBox.Show("食材管理アプリは既に起動しています。", "二重起動防止", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                mutex.Close();
                mutex = null;
                this.Shutdown();
            }
            // food
            var folder       = ApplicationData.Current.LocalFolder;
            var foodDataPath = System.IO.Path.Combine(folder.Path, "food_data.json");

            if (File.Exists(foodDataPath) == false)
            {
                StorageFile result = await folder.CreateFileAsync("food_data.json");
            }
            //var folder = System.Windows.Storage.ApplicationData.Current.LocalFolder;

            // 食材データを読み込む(既定値はfood_composition.json)
            var ins           = FoodShelfModel.GetInstance();
            var isLoadSuccess = await ins.LoadAsync();

            if (isLoadSuccess == false)
            {
                Application.Current.Shutdown();
            }

            // 食品成分表の読み込みを行う(既定値food_composition_japanese.json)
            string hoge = MVVM_Refregator.Properties.Resources.food_composition_japanese;

            //Assembly assembly = Assembly.GetExecutingAssembly();
            //assembly.GetManifestResourceStream("MVVM_Refregator.App.food_composition_japanese.json");
            //AnalysisPageModel.GetInstance().LoadFoodComposition();
            AnalysisPageModel.GetInstance().LoadFoodComposition((string x) => x, hoge);

            if (this.canNotification)
            {
                if (ins.FoodCollection.Any(x => x.HasUsed == false && x.LimitDate.Date == DateTime.Today.Date))
                {
                    this._notificationManager.Show(this._notificationContent, expirationTime: TimeSpan.FromSeconds(4));
                }
                else if (ins.FoodCollection.Any(x => x.HasUsed == false && x.LimitDate.Date <= DateTime.Today.Date.AddDays(7).Date&& x.LimitDate.Date >= DateTime.Today))
                {
                    this._notificationManager.Show(this.oneDayLimitContent, expirationTime: TimeSpan.FromSeconds(4));
                }
            }

            // Viewの起動
            var view = new StartupWindow();

            view.ShowDialog();

            // Notification消すため
            Application.Current.Shutdown();
        }
示例#3
0
        private void CodeInput(object sender, StartupEventArgs e)
        {
            //Disable shutdown when the dialog closes
            Current.ShutdownMode = ShutdownMode.OnExplicitShutdown;

            var dialog = new StartupWindow();

            if (dialog.ShowDialog() == false)
            {
                Current.Shutdown(-1);
            }
        }
示例#4
0
        public MainWindow()
        {
            var startupWindow = new StartupWindow();

            startupWindow.ShowDialog();
            _cooker.CookingTime = startupWindow.CookingTime;

            //put next pizza on conveyor belt
            _dispatcherTimer.Tick    += new EventHandler(StartCookingOrder);
            _dispatcherTimer.Interval = new TimeSpan(0, 0, Convert.ToInt32(_cooker.CookingTime / 10));//time to get into cooker
            _dispatcherTimer.Start();

            InitializeComponent();
            SetSource();
            Refresh();
        }
示例#5
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            var login = new StartupWindow();

            login.ShowDialog();
        }