private void urlTextBox_TextChanged(object sender, EventArgs e)
 {
     if (Util.TrySet(ref resource.referenceURL, urlTextBox.Text))
     {
         ResourceUpdate?.Invoke(this, new EventArgs());
     }
 }
 private void referenceTextBox_TextChanged(object sender, EventArgs e)
 {
     referenceTextBox.Text = referenceTextBox.Text.Replace('–', '-');
     if (Util.TrySet(ref resource.reference, referenceTextBox.Text))
     {
         ResourceUpdate?.Invoke(this, new EventArgs());
     }
 }
        private void categoryComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            var category = (StudyResource.Category)Enum.Parse(typeof(StudyResource.Category), categoryComboBox.SelectedItem as string);

            if (Util.TrySet(ref resource.category, category))
            {
                ResourceUpdate?.Invoke(this, new EventArgs());
            }
        }
        private void addButton_Click(object sender, EventArgs e)
        {
            TextInput topicForm = new TextInput("Add Topic");

            topicForm.ShowDialog();

            if (topicForm.value != null)
            {
                resource.topics.Add(topicForm.value.ToLower());
                ResourceUpdate?.Invoke(this, new EventArgs());
                UpdateView();
            }
        }
        private void removeButton_Click(object sender, EventArgs e)
        {
            foreach (string topic in topicListBox.SelectedItems)
            {
                resource.topics.Remove(topic);
            }

            if (topicListBox.SelectedItems.Count > 0)
            {
                ResourceUpdate?.Invoke(this, new EventArgs());
            }

            UpdateView();
        }
Exemple #6
0
        /// <summary>
        /// 处理资源文件更新
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void updateResource(object sender, RoutedEventArgs e)
        {
            Button     btn      = sender as Button;
            MainWindow mainWin  = this.Owner as MainWindow;
            string     boxTitle = "资源更新";

            //状态等待
            btn.IsEnabled = false;
            this.updateProgressBar.IsIndeterminate = true;
            this.updateProgressBar.Visibility      = Visibility.Visible;
            try
            {
                ResourceUpdate updateService = new ResourceUpdate(this);
                bool           hasUpdate     = await updateService.updateAsync(DirectoryHelper.getXmlResourcePath(), DirectoryHelper.getXmlResourcePath(true));

                //状态还原
                btn.IsEnabled = true;
                this.updateProgressBar.IsIndeterminate = true;
                this.updateProgressBar.Visibility      = Visibility.Hidden;
                if (hasUpdate)
                {
                    //更新成功
                    if (MessageBox.Show("更新资源文件成功,重启本程序生效,确定要重启程序吗", boxTitle, MessageBoxButton.YesNoCancel, MessageBoxImage.Question) == MessageBoxResult.Yes)
                    {
                        //重启应用
                        await mainWin.closeAllApp();

                        mainWin.isWinAppRestart = true;
                        Process.Start(Process.GetCurrentProcess().MainModule.FileName);
                        Application.Current.Shutdown();
                    }
                }
                else
                {
                    //已经是最新
                    mainWin.showErrorMessage("本地资源文件已经是最新版", boxTitle, MessageBoxImage.Information);
                }
            }
            catch (Exception e1)
            {
                //状态还原
                btn.IsEnabled = true;
                this.updateProgressBar.IsIndeterminate = true;
                this.updateProgressBar.Visibility      = Visibility.Hidden;
                //
                mainWin.showErrorMessage(e1.Message, boxTitle);
            }
        }
Exemple #7
0
    void CheckUpdate()
    {
#if UNITY_EDITOR
        GameStart();
        return;
#endif
        if (GameMain.Inst.ResourceMode != 0)
        {
            //启动更新器
            ResourceUpdate resourceUpdate = gameObject.AddComponent <ResourceUpdate>();
            resourceUpdate.onUpdateEnd = OnUpdateEnd;
        }
        else //直接启动游戏
        {
            GameStart();
        }
    }
        private void webTextButton_Click(object sender, EventArgs e)
        {
            ScriptureReference scripture = ScriptureReference.Parse(resource.reference);

            if (scripture == null)
            {
                MessageBox.Show("Invalid reference.");
                return;
            }

            List <StudyElement> text = scripture.GetText();

            if (text == null)
            {
                MessageBox.Show("Failed to obtain text from web.");
                return;
            }

            resource.body.AddRange(text);
            ResourceUpdate?.Invoke(this, new EventArgs());
        }
 private void textButton_Click(object sender, EventArgs e)
 {
     resource.body.Add(new TextElement(""));
     ResourceUpdate?.Invoke(this, new EventArgs());
 }
 private void mediaButton_Click(object sender, EventArgs e)
 {
     resource.body.Add(new MediaElement(MediaElement.Type.Image, ""));
     ResourceUpdate?.Invoke(this, new EventArgs());
 }
Exemple #11
0
 public void OnGPSUpdate(ResourceUpdate update)
 {
     this.GPSText.text = Currency.CurrencyToString(update.valueAfter) + " GPS";
 }
Exemple #12
0
 private void OnGPSUpdate(ResourceUpdate res)
 {
     this.UpdateStats();
 }
 private void Init()
 {
     resourceRead   = new ResourceRead(this);
     resourceUpdate = new ResourceUpdate(this);
 }
 internal ARPResourceList(ResourceUpdate UpdateType, Dictionary <Int32, ResourceSettings> ResourceConfigs)
 {
     this.UpdateType      = UpdateType;
     this.ResourceConfigs = ResourceConfigs;
 }
 protected virtual void OnResourceUpdate(TinyDocDB_UpdateEventArgs e)
 {
     ResourceUpdate?.Invoke(this, e);
 }
Exemple #16
0
 private void OnGoldUpdate(ResourceUpdate res)
 {
     this.UpdateValues();
 }
Exemple #17
0
 public void OnGoldUpdate(ResourceUpdate update)
 {
     this.UpdateHighlighted();
 }
Exemple #18
0
 public void OnGoldUpdate(ResourceUpdate update)
 {
     this.goldText.text = Currency.CurrencyToString(update.valueAfter);
 }