예제 #1
0
        private void DetermineVisuals()
        {
            if (Model.Visuals == null)
            {
                return;
            }
            var ms = GetAnimation(Model.Visuals);

            if (ms == null)
            {
                return;
            }
            var firstVisibleFrame = ms.Frames
                                    .FirstOrDefault(frame => frame.ImagePath != null);

            if (firstVisibleFrame == null)
            {
                return;
            }

            frameOffset = firstVisibleFrame.ImageOffset;
            var image = new LoadingDialog().Execute(() =>
                                                    BitmapToImageSource(Services.Image.LoadAnimationFrame(
                                                                            Model.Visuals.Id, firstVisibleFrame.ImagePath, MetaViewModel.Current.GamePath)));

            Image = (BitmapImage)image;
        }
        private async void ImportSetFromFileAction()
        {
            FileOpenPicker openPicker = new FileOpenPicker();

            openPicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
            openPicker.FileTypeFilter.Add(".xlsx");
            openPicker.FileTypeFilter.Add(".xls");
            openPicker.FileTypeFilter.Add(".docx");
            openPicker.FileTypeFilter.Add(".doc");

            StorageFile file = await openPicker.PickSingleFileAsync();

            if (file != null)
            {
                try {
                    CancellationTokenSource     cancelSource      = new CancellationTokenSource();
                    Task <ContentDialogResult>  loadingScreenTask = new LoadingDialog().ShowAsync().AsTask(cancelSource.Token);
                    Task <List <CardSetModel> > importingTask     = ImportFlashcardService.ImportNewSetsFromFile(file, cancelSource.Token);

                    Task firstToFinish = await Task.WhenAny(loadingScreenTask, importingTask);

                    cancelSource.Cancel();
                    if (firstToFinish == importingTask)
                    {
                        List <CardSetModel> newImportedCardSetModels = await importingTask;
                        prNavigationService.NavigateTo("EditSetPage");
                        Messenger.Default.Send(newImportedCardSetModels, "EditSetView");
                    }
                } catch (Exception ex) {
                    await new MessageDialog(ex.Message).ShowAsync();
                }
            }
        }
예제 #3
0
        public bool SaveAs()
        {
            if (CurrentArchive == null)
            {
                MessageBox.Show(this, "Nothing to save!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(true);
            }
            SaveFileDialog sfd = new SaveFileDialog();

            sfd.Filter = "Supported Files|*.BUNDLE;*.BIN;*.BNDL;*.DAT;*.TEX|All Files|*.*";
            DialogResult result = sfd.ShowDialog(this);

            if (result == DialogResult.OK)
            {
                if (!Utilities.IsValidPath(sfd.FileName))
                {
                    return(false);
                }

                LoadingDialog loader = new LoadingDialog();
                loader.Status   = "Saving: " + sfd.FileName;
                loader.Done    += Loader_SaveDone;
                _openSaveThread = new Thread(() => DoSaveBundle(loader, sfd.FileName));
                _openSaveThread.Start();
                loader.ShowDialog(this);

                CurrentFileName = sfd.FileName;
                Text            = "Bundle Manager - " + CurrentFileName;

                return(true);
            }
            return(false);
        }
예제 #4
0
        public void DoOpenBundle(LoadingDialog loader, string path)
        {
            BundleArchive archive = BundleArchive.Read(path);

            loader.Value  = new object[] { archive, path };
            loader.IsDone = true;
        }
예제 #5
0
        public static async Task <LoadingDialog> CreateAndDisplayLoadingDialog()
        {
            var dialog = new LoadingDialog();
            await dialog.ShowAsync();

            return(dialog);
        }
예제 #6
0
        private void button_CreateTAD_Click(object sender, EventArgs e)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.Filter = "TAD File (*.tad)|*.tad";

            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                string tadFilepath = saveFileDialog.FileName;
                string tacFilepath = Path.ChangeExtension(tadFilepath, ".tac");

                TAD tad = new TAD();
                tad.FilePath = tadFilepath;
                foreach (TADEntry entry in listBox_ArchiveFiles.Items)
                {
                    tad.Entries.Add(entry);
                }
                TAC tac = new TAC();
                tac.TAD = tad;

                LoadingDialog loadingDialog = new LoadingDialog();
                loadingDialog.SetProgessable(tac);
                Thread thread = new Thread(delegate() {
                    tac.Pack(tacFilepath);
                });
                loadingDialog.ShowDialog(thread);

                tad.UnixTimestamp = dateTimePicker_TAD.Value;
                tad.Write(tadFilepath);
            }
        }
예제 #7
0
        /// <summary>
        ///     Look for updates while displaying a progress bar. At the end display a message box with the result.
        /// </summary>
        public static void LookForUpdates()
        {
            var result = UpdateSystem.UpdateStatus.CheckFailed;
            var error  = LoadingDialog.ShowDialog(null, Localisable.LoadingDialogTitleSearchingForUpdates,
                                                  x => { result = UpdateSystem.CheckForUpdates(); });

            if (error == null)
            {
                switch (result)
                {
                case UpdateSystem.UpdateStatus.CheckFailed:
                    MessageBoxes.UpdateFailed(UpdateSystem.LastError != null
                            ? UpdateSystem.LastError.Message
                            : "Unknown error");
                    break;

                case UpdateSystem.UpdateStatus.NewAvailable:
                    if (MessageBoxes.UpdateAskToDownload())
                    {
                        UpdateSystem.BeginUpdate();
                    }
                    break;

                case UpdateSystem.UpdateStatus.UpToDate:
                    MessageBoxes.UpdateUptodate();
                    break;
                }
            }
            else
            {
                MessageBoxes.UpdateFailed(error.Message);
            }
        }
예제 #8
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            Window.RequestFeature(WindowFeatures.NoTitle);
            Window.RequestFeature(WindowFeatures.ActionBar);
            SetContentView(Resource.Layout.MainActivityMainView);
            SetActionBar(FindViewById <Toolbar>(Resource.Id.Main_Toolbar));

            FindViewById <Button>(Resource.Id.Main_GroupButton).Click += (sender, args) =>
            {
                StartActivity(typeof(GroupActivity));
            };

            FindViewById <Button>(Resource.Id.Main_ChatButton).Click += (sender, args) =>
            {
                StartActivity(typeof(ChatActivity));
            };

            FindViewById <Button>(Resource.Id.Main_MyEventsButton).Click += (sender, args) =>
            {
                StartActivity(typeof(MyEvents));
            };

            FindViewById <Button>(Resource.Id.Main_PartEventsButton).Click += (sender, args) =>
            {
                StartActivity(typeof(ParticipateEventsActivity));
            };

            base.OnCreate(savedInstanceState);

            ActionBar.Title = "Welcome Back !";
            LoadingDialog.Hide();
        }
예제 #9
0
        private void button_Merge_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "Filename Database Dump (*.bin)|*.bin";
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                if (!Helper.IsFileValid(openFileDialog.FileName))
                {
                    return;
                }

                List <FilenameDatabaseEntry> newEntries;
                using (FileStream stream = File.Open(openFileDialog.FileName, FileMode.Open))
                {
                    BinaryFormatter formatter = new BinaryFormatter();
                    newEntries = (List <FilenameDatabaseEntry>)formatter.Deserialize(stream);
                }

                LoadingDialog loadingDialog = new LoadingDialog();
                loadingDialog.SetData(this);
                Thread thread = new Thread(delegate() {
                    Merge(newEntries);
                });
                loadingDialog.ShowDialog(thread);
            }
            FilenameDatabase.Save();
            filenameDatabaseDataTable1.UpdateView(false);
        }
예제 #10
0
        public async void Load()
        {
            LoadingDialog builder = new LoadingDialog(this).SetMessage("Загрузка...");

            Android.App.AlertDialog dialog = builder.Create();
            dialog.Show();

            string response = await Connector.GetAsync("phrase.set") ?? "{}";

            var data = JObject.Parse(response);

            if (data?["status"] == null)
            {
                Toast.MakeText(this, "Произошла ошибка :(", ToastLength.Short).Show();
                dialog.Dismiss();
                Finish();
                return;
            }

            Phrases = new List <Phrase>();
            foreach (var item in (JArray)data["result"])
            {
                Phrase ph = new Phrase {
                    Id   = Convert.ToInt32(item["id"]),
                    Text = Convert.ToString(item["text"])
                };
                Phrases.Add(ph);
            }

            BuildElements();
            dialog.Dismiss();
        }
예제 #11
0
        protected override async void OnResume()
        {
            base.OnResume();
            await UpdateEventList(_eventListView);

            LoadingDialog.Hide();
        }
예제 #12
0
        internal void displayMails()
        {
            int id = 0;

            LoadingDialog md = new LoadingDialog();
            md.Buttons = null;
            md.Show();
            loadInboxAndSent();
            md.Close();

            foreach (Mail m in this.mm.Inbox)
            {
                ListBoxItem newMail = new ListBoxItem();
                StackPanel mailContainer = new StackPanel();
                Label subject = new Label();

                mailContainer.Width = 450;

                subject.Tag = id;
                subject.Content = m.Title;

                mailContainer.Children.Add(subject);

                newMail.Content = mailContainer;

                this.EmailList.Items.Add(newMail);
                id++;
            }
        }
예제 #13
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            DisplayImageOptions displayImageOptions = new DisplayImageOptions.Builder()
                                                      .CacheInMemory(false)
                                                      .ShowImageOnLoading(Resource.Drawable.main)
                                                      .ResetViewBeforeLoading(false)
                                                      .CacheOnDisk(false).Build();
            ImageLoaderConfiguration imagaeLoaderConfigurtaion = new ImageLoaderConfiguration.Builder(ApplicationContext)
                                                                 .DefaultDisplayImageOptions(displayImageOptions)
                                                                 .Build();

            ImageLoader.Instance.Init(imagaeLoaderConfigurtaion);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_navigation);
            mTts     = new TextToSpeech(this, this, "com.google.android.tts");
            mToolbar = FindViewById <SupportToolbar>(Resource.Id.toolbar);
            SetSupportActionBar(mToolbar);
            if (Intent.GetStringExtra("source") != null)
            {
                mSourceAddress = Intent.GetStringExtra("source");
            }
            typeface       = Typeface.CreateFromAsset(this.Assets, "JosefinSans-SemiBold.ttf");
            mLoadingDialog = new LoadingDialog(this, Resource.Drawable.main);
            mLoadingDialog.SetCancelable(false);
            Window window = mLoadingDialog.Window;

            window.SetLayout(WindowManagerLayoutParams.MatchParent, WindowManagerLayoutParams.MatchParent);
            window.SetBackgroundDrawable(new ColorDrawable(Resources.GetColor(Resource.Color.trans)));
            mSharedPreference      = GetSharedPreferences(Constants.MY_PREF, 0);
            mDrawerLayout          = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            mActionBarDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, mToolbar, Resource.String.openD, Resource.String.closedD);
            mDrawerLayout.AddDrawerListener(mActionBarDrawerToggle);
            mActionBarDrawerToggle.SyncState();
            mNavigationView = FindViewById <NavigationView>(Resource.Id.nav_view);
            mNavigationView.ItemIconTintList = null;
            mNavigationView.SetNavigationItemSelectedListener(this);
            View headerLayout = mNavigationView.GetHeaderView(0);

            mTextView = headerLayout.FindViewById <TextView>(Resource.Id.nametodisplay);
            mTextView.SetTypeface(typeface, TypefaceStyle.Normal);
            mTextView.Text = mSharedPreference.GetString("name", " ");
            if (bundle == null)
            {
                mFragment = new MapViewFragment(this);
                FragmentManager.BeginTransaction().Replace(Resource.Id.nav_frame, mFragment).Commit();
            }
            // handle deep link here
            var x = Intent;

            System.Diagnostics.Debug.WriteLine(x.Action);
            var nmLocaiton = "NO MEETING DATA FOUND";

            if (Intent.ActionView.Equals(x.Action))
            {
                var uri = x.Data;
                nmLocaiton = uri.GetQueryParameter("nmlocation");
            }
            System.Diagnostics.Debug.Write("Deep Link: " + nmLocaiton);
        }
예제 #14
0
        private async void ShowLoadingDialog(string name, string pw)
        {
            var loadingDialog = new LoadingDialog();

            await DialogHost.Show(loadingDialog, "LoginDialog", delegate(object sender, DialogOpenedEventArgs args)
            {
                async void start()
                {
                    var result = await Request.Login(name, pw);
                    await Mainthread.BeginInvoke((Action) delegate()
                    {
                        args.Session.Close(false);
                        if (result.Success)
                        {
                            var business = result.Data;
                            ApplicationObject.App.Business = business;
                            ApplicationObject.App.Init();
                            SaveLoginUser(name, pw);
                            LoginSuccess = true;
                            Close();
                        }
                        else
                        {
                            MessageTips(result.Msg);
                        }
                    });
                }

                new Thread(start).Start();
            });
        }
예제 #15
0
        public void SearchForAndRemoveProgramFilesJunk(IEnumerable <ApplicationUninstallerEntry> allUninstallers)
        {
            if (!TryGetUninstallLock())
            {
                return;
            }

            try
            {
                _lockApplication(true);

                var junk  = new List <IJunkResult>();
                var error = LoadingDialog.ShowDialog(null, Localisable.LoadingDialogTitleLookingForJunk,
                                                     x => junk.AddRange(JunkManager.FindProgramFilesJunk(allUninstallers.Where(y => y.RegKeyStillExists()).ToList())));

                if (error != null)
                {
                    PremadeDialogs.GenericError(error);
                }
                else
                {
                    ShowJunkWindow(junk);
                }
            }
            finally
            {
                ReleaseUninstallLock();
                _lockApplication(false);
            }
        }
예제 #16
0
        public void Unpack()
        {
            Clean();
            string tacFilename     = Path.GetFileName(TADFile.Filename).ToLower().Replace(".tad", ".tac");
            string tacPath         = Path.GetDirectoryName(TADFile.Filename) + "\\" + tacFilename;
            string targetDirectory = Path.GetDirectoryName(tacPath) + "\\" + "_" + tacFilename + "_";

            Header.RelativeOutputFolder = "\\" + Helper.GetRelativePath(targetDirectory, Path.GetDirectoryName(tacPath));
            Header.RelativeTACPath      = "\\" + Helper.GetRelativePath(tacPath, Path.GetDirectoryName(tacPath));
            Header.RelativeTADPath      = "\\" + Helper.GetRelativePath(TADFile.Filename, Path.GetDirectoryName(tacPath));

            TACFile       tacFile       = new TACFile();
            LoadingDialog loadingDialog = new LoadingDialog();

            loadingDialog.SetData(tacFile);
            Thread thread = new Thread(delegate() {
                tacFile.Unpack(tacPath, targetDirectory, TADFile);
            });

            loadingDialog.ShowDialog(thread);

            string cachePath = Path.GetDirectoryName(tacPath) + "\\" + Path.GetFileName(TADFile.Filename).ToLower().Replace(".tad", ".cache");

            Filename = cachePath;
            Write(cachePath);
        }
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            Window.RequestFeature(WindowFeatures.NoTitle);
            Window.RequestFeature(WindowFeatures.ActionBar);
            SetContentView(Resource.Layout.EventDetailMainView);

            SetActionBar(FindViewById <Toolbar>(Resource.Id.EventDetail_Toolbar));
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetHomeButtonEnabled(true);

            FindViewById <ImageButton>(Resource.Id.EventDetail_CommentButton).Click += AddNewCommentClicked;
            FindViewById <ImageButton>(Resource.Id.EventDetail_RefreshButton).Click += RefreshComments;

            var commentTxt = FindViewById <EditText>(Resource.Id.EventDetail_CommentTxt);

            commentTxt.EditorAction += (sender, args) =>
            {
                args.Handled = false;
                if (args.ActionId == ImeAction.Done)
                {
                    AddNewComment();
                    args.Handled = true;
                }
            };

            base.OnCreate(savedInstanceState);
            await LoadEvent();

            LoadingDialog.Hide();
        }
예제 #18
0
 /// <summary>
 ///     Shows a loading Dialog.
 /// </summary>
 public async void ShowLoadingDialog(string message = null)
 {
     loadingDialog = new LoadingDialog {
         Text = message ?? Strings.LoadingLabel
     };
     await loadingDialog.ShowAsync();
 }
예제 #19
0
        public void Export(string tadFilename, bool exportModified = true)
        {
            string tacPath     = Path.GetDirectoryName(tadFilename) + "\\" + Path.GetFileName(tadFilename).ToLower().Replace(".tad", ".tac");
            string inputFolder = Path.GetDirectoryName(Filename) + Header.RelativeOutputFolder;

            if (exportModified)
            {
                LoadingDialog loadingDialogHash = new LoadingDialog();
                loadingDialogHash.SetData(this);
                Thread threadHash = new Thread(delegate()
                {
                    CalculateHashes();
                });
                loadingDialogHash.ShowDialog(threadHash);
            }

            TACFile       tacFile       = new TACFile();
            LoadingDialog loadingDialog = new LoadingDialog();

            loadingDialog.SetData(tacFile);
            Thread thread = new Thread(delegate() {
                tacFile.Pack(tacPath, inputFolder, TADFile);
            });

            loadingDialog.ShowDialog(thread);

            TADFile.Write(tadFilename);
        }
예제 #20
0
        /// <summary>
        ///     Look for updates while displaying a progress bar. At the end display a message box with the result.
        /// </summary>
        public static void LookForUpdates()
        {
            bool?result = null;
            var  error  = LoadingDialog.ShowDialog(null, Localisable.LoadingDialogTitleSearchingForUpdates,
                                                   _ => { result = IsUpdateAvailable(Assembly.GetExecutingAssembly().GetName().Version); });

            if (error == null)
            {
                switch (result)
                {
                case null:
                    MessageBoxes.UpdateFailed("Unknown error");
                    break;

                case true:
                    AskAndBeginUpdate();
                    break;

                case false:
                    MessageBoxes.UpdateUptodate();
                    break;
                }
            }
            else
            {
                MessageBoxes.UpdateFailed(error.Message);
            }
        }
예제 #21
0
        /// <summary>
        ///     Ask the user to begin system restore and do so if he accepts. Returns false if user decides to cancel the
        ///     operation.
        /// </summary>
        /// <param name="count">How many items are being uninstalled</param>
        /// <param name="displayMessage">If user should be asked to create the restore point. If false, always create</param>
        public static bool BeginSysRestore(int count, bool displayMessage = true)
        {
            if (SysRestore.SysRestoreAvailable())
            {
                switch (displayMessage ? MessageBoxes.SysRestoreBeginQuestion() : MessageBoxes.PressedButton.Yes)
                {
                case MessageBoxes.PressedButton.Yes:
                    var error = LoadingDialog.ShowDialog(null, Localisable.LoadingDialogTitleCreatingRestorePoint, x =>
                    {
                        //if (_currentRestoreId > 0)
                        EndSysRestore();

                        var result = SysRestore.StartRestore(MessageBoxes.GetSystemRestoreDescription(count),
                                                             SysRestore.RestoreType.ApplicationUninstall, out _currentRestoreId, 3);
                        if (result < 0)
                        {
                            throw new IOException(Localisable.SysRestoreGenericError);
                        }
                    });

                    return(error == null ||
                           MessageBoxes.SysRestoreContinueAfterError(error.Message) ==
                           MessageBoxes.PressedButton.Yes);

                case MessageBoxes.PressedButton.Cancel:
                    return(false);
                }
            }
            return(true);
        }
예제 #22
0
    public static void Show(string message)
    {
        GameObject    prehab = CreateDialog("Prehabs/Dialogs/LoadingDialog");
        LoadingDialog dialog = prehab.GetComponent <LoadingDialog>();

        dialog.Init(message);
    }
예제 #23
0
        private void mapFilenamesToTADToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (m_cacheFile == null || m_tadFile == null)
            {
                return;
            }

            FilenameDatabase filenameDB    = new FilenameDatabase();
            LoadingDialog    loadingDialog = new LoadingDialog();

            loadingDialog.SetData(filenameDB);
            Thread thread = new Thread(delegate()
            {
                filenameDB.MapFilenamesToTADInstance(m_cacheFile);
            });

            loadingDialog.ShowDialog(thread);

            DescriptionDatabase descDB = new DescriptionDatabase();

            loadingDialog = new LoadingDialog();
            loadingDialog.SetData(descDB);
            thread = new Thread(delegate()
            {
                descDB.MapDescriptionToTADInstance(m_tadFile);
            });
            loadingDialog.ShowDialog(thread);

            tadDataTable1.SetCache(m_cacheFile);
            m_cacheFile.Write(m_cacheFile.Filename);
        }
예제 #24
0
        private bool ShowJunkWindow(List <IJunkResult> junk)
        {
            if (!junk.Any(x => _settings.MessagesShowAllBadJunk || x.Confidence.GetRawConfidence() >= 0))
            {
                MessageBoxes.NoJunkFoundInfo();
                return(false);
            }

            using (var junkWindow = new JunkRemoveWindow(junk))
            {
                if (junkWindow.ShowDialog() != DialogResult.OK)
                {
                    return(false);
                }

                var selectedJunk = junkWindow.SelectedJunk.ToList();

                if (!CheckForRunningProcessesBeforeCleanup(selectedJunk))
                {
                    return(false);
                }

                //Removing the junk
                LoadingDialog.ShowDialog(MessageBoxes.DefaultOwner, Localisable.LoadingDialogTitleRemovingJunk, controller =>
                {
                    var top = selectedJunk.Count;
                    controller.SetMaximum(top);
                    var itemsRemoved = 0; // current value

                    var sortedJunk = from item in selectedJunk
                                     // Need to stop and unregister service before deleting its exe
                                     orderby item is StartupJunkNode descending
                                     select item;

                    foreach (var junkNode in sortedJunk)
                    {
                        controller.SetProgress(itemsRemoved++);

                        if (_settings.AdvancedSimulate)
                        {
                            Thread.Sleep(100);
                        }
                        else
                        {
                            try
                            {
                                junkNode.Delete();
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine("Exception while removing junk: " + ex.ToString());
                            }
                        }
                    }
                });

                return(true);
            }
        }
예제 #25
0
        public LevelEditWindow(string levelId)
        {
            InitializeComponent();
            var level = new LoadingDialog().Execute(() =>
                                                    Services.Project.LoadLevel(MetaViewModel.Current.ProjectPath, levelId));

            levelEditView.DataContext = new LevelEditViewModel((Level)level);
        }
예제 #26
0
        private void button_SelectFolder_Click(object sender, EventArgs e)
        {
            VistaFolderBrowserDialog folderDialog = new VistaFolderBrowserDialog();

            if (folderDialog.ShowDialog() == DialogResult.OK)
            {
                string          folder  = folderDialog.SelectedPath;
                List <string>   files   = GetFiles(folder);
                List <TADEntry> entries = new List <TADEntry>();

                foreach (var file in files)
                {
                    FileHash hash;
                    string   f = file.Replace(folder, "");

                    hash = MurmurHash2.GetFileHash(f, true);
                    Console.WriteLine("{0} -> {1} : {2} -> {3}", hash.FilePath, hash.FilePathWithHash, hash.Hash.ToString("x8"), hash.FinalHash.ToString("x8"));

                    FileInfo fileInfo = new FileInfo(file);
                    TADEntry entry    = new TADEntry();
                    entry.FilePath   = file;
                    entry.FileName   = file;
                    entry.FileSize   = (uint)fileInfo.Length;
                    entry.Index      = 0;
                    entry.FirstHash  = hash.FinalHash;
                    entry.SecondHash = hash.FilePathHash;
                    entries.Add(entry);
                }

                SaveFileDialog saveFileDialog = new SaveFileDialog();
                saveFileDialog.Filter = "TAD File (*.tad)|*.tad";

                if (saveFileDialog.ShowDialog() == DialogResult.OK)
                {
                    string tadFilepath = saveFileDialog.FileName;
                    string tacFilepath = Path.ChangeExtension(tadFilepath, ".tac");

                    TAD tad = new TAD();
                    tad.FilePath = tadFilepath;
                    foreach (TADEntry entry in entries)
                    {
                        tad.Entries.Add(entry);
                    }
                    TAC tac = new TAC();
                    tac.TAD = tad;

                    LoadingDialog loadingDialog = new LoadingDialog();
                    loadingDialog.SetProgessable(tac);
                    Thread thread = new Thread(delegate() {
                        tac.Pack(tacFilepath);
                    });
                    loadingDialog.ShowDialog(thread);

                    tad.UnixTimestamp = DateTime.Now;
                    tad.Write(tadFilepath);
                }
            }
        }
예제 #27
0
 public Single()
 {
     InitializeComponent();
     LoadingDialog md = new LoadingDialog();
     md.Buttons = null;
     md.Show();
     initializeMap();
     md.Close();
 }
예제 #28
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            LinearLayout main = new LinearLayout(this);

            main.Orientation = Orientation.Vertical;
            main.SetGravity(GravityFlags.Top);
            SetContentView(main);

            EditText editor = new EditText(this);

            editor.SetHeight(Screen.Height / 4);
            editor.Gravity = GravityFlags.Left | GravityFlags.Top;
            main.AddView(editor);


            Button send = new Button(this);

            send.Text   = "Отправить комментарий";
            send.Click += async delegate {
                if (String.IsNullOrWhiteSpace(editor.Text))
                {
                    return;
                }

                InputMethodManager inputManager = (InputMethodManager)GetSystemService(Activity.InputMethodService);
                inputManager.HideSoftInputFromWindow(editor.WindowToken, 0);


                var data = new NameValueCollection();
                data.Add("name", Options.ClientName);
                data.Add("comment", editor.Text);

                LoadingDialog           builder = new LoadingDialog(this).SetMessage("Отправка...");
                Android.App.AlertDialog dialog  = builder.Create();
                dialog.Show();

                string responce = await Connector.PostAsync("comment.add", data) ?? "{}";

                bool added = JObject.Parse(responce)?["status"] != null;
                if (added)
                {
                    Snackbar bar = Snackbar.Make(send, "Комментарий отправлен :)", Snackbar.LengthShort);
                    bar.Show();
                    editor.Text = "";
                }
                else
                {
                    Snackbar.Make(send, "Произошла ошибка :(", Snackbar.LengthIndefinite)
                    .SetAction("Ok", delegate { })
                    .Show();
                }
                dialog.Dismiss();
            };
            main.AddView(send);
        }
예제 #29
0
    public static void CloseDialog()
    {
        LoadingDialog dialog = DialogManager.Instance.transform.GetComponentInChildren <LoadingDialog>();

        if (dialog != null)
        {
            dialog.Close();
        }
    }
예제 #30
0
        /// <summary>
        ///     Shows a loading Dialog.
        /// </summary>
        public async void ShowLoadingDialog(string message = null)
        {
            // Be sure no other dialog is open.
            HideLoadingDialog();

            loadingDialog = new LoadingDialog {
                Text = message ?? Strings.LoadingLabel
            };
            await loadingDialog.ShowAsync();
        }
예제 #31
0
        public void Open(string path)
        {
            LoadingDialog loader = new LoadingDialog();

            loader.Status   = "Loading: " + path;
            loader.Done    += Loader_OpenDone;
            _openSaveThread = new Thread(() => DoOpenBundle(loader, path));
            _openSaveThread.Start();
            loader.ShowDialog(this);
        }
예제 #32
0
 private async void initializeMap()
 {
     LoadingDialog md = new LoadingDialog();
     md.Buttons = null;
     md.Show();         
     await Task.Delay(1000);
     this.map = new Map(gmap);
     initializeMarkers();
     md.Close();
 }
예제 #33
0
        private void button_Pack2_Click(object sender, EventArgs e)
        {
            InitializeJSON();

            string          folder  = textBox_Folder2.Text + SM_TEXTURES;
            List <string>   files   = GetFiles(folder);
            List <TADEntry> entries = new List <TADEntry>();

            // iterate through files in /textures/ and create TAD entry for each of them
            foreach (var file in files)
            {
                FileHash hash;
                string   f = file.Replace(folder, "");

                hash = MurmurHash2.GetFileHash(f, true);
                Console.WriteLine("{0} -> {1} : {2} -> {3}", hash.FilePath, hash.FilePathWithHash, hash.Hash.ToString("x8"), hash.FinalHash.ToString("x8"));

                FileInfo fileInfo = new FileInfo(file);
                TADEntry entry    = new TADEntry();
                entry.FilePath   = file;
                entry.FileName   = file;
                entry.FileSize   = (uint)fileInfo.Length;
                entry.Index      = 0;
                entry.FirstHash  = hash.FinalHash;
                entry.SecondHash = hash.FilePathHash;
                entries.Add(entry);
            }

            // create tac/tad
            string tadFilepath = textBox_Folder2.Text + SM_ARCHIVE_DATA + "texture_mod.tad";
            string tacFilepath = Path.ChangeExtension(tadFilepath, ".tac");

            TAD tad = new TAD();

            tad.FilePath = tadFilepath;
            foreach (TADEntry entry in entries)
            {
                tad.Entries.Add(entry);
            }
            TAC tac = new TAC();

            tac.TAD = tad;

            LoadingDialog loadingDialog = new LoadingDialog();

            loadingDialog.SetProgessable(tac);
            Thread thread = new Thread(delegate() {
                tac.Pack(tacFilepath);
            });

            loadingDialog.ShowDialog(thread);

            tad.UnixTimestamp = DateTime.Now;
            tad.Write(tadFilepath);
        }