示例#1
0
        private void ExportToCSV(object sender, RoutedEventArgs e)
        {
            if (!App.Current.IsRunningOutOfBrowser)
            {
                MessageBox.Show("This function can only be run when Rawr is installed offline due to a Silverlight Permissions issue."
                                + "\n\nYou can install Rawr offline using the button in the Upper Right-Hand corner of the program",
                                "Cannot Perform Action", MessageBoxButton.OK);
                return;
            }

            SaveFileDialog dialog = new SaveFileDialog();

            dialog.DefaultExt = ".csv";
            dialog.Filter     = "Comma Separated Values | *.csv";
            if (dialog.ShowDialog().GetValueOrDefault(false))
            {
                try
                {
                    using (StreamWriter writer = File.CreateText(dialog.SafeFileName)) // no path data and no way to get it? wtf?
                    {
                        writer.Write(GetChartDataCSV());
                        writer.Flush();
                        writer.Close();
                        writer.Dispose();
                    }
                }
                catch (Exception ex) {
                    Base.ErrorBox eb = new Base.ErrorBox("Error Saving CSV File", ex.Message);
                    eb.Show();
                }
            }
        }
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            // TODO: Run Load Character from Profiler action
            try
            {
                CharacterProfilerData characterList = new CharacterProfilerData(TB_FilePath.Text);

                FormChooseCharacter form = new FormChooseCharacter(characterList);

                form.Show();
                if (form.DialogResult == true)
                {
                    //StartProcessing();
                    //BackgroundWorker bw = new BackgroundWorker();
                    //bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_LoadCharacterProfilerComplete);
                    //bw.DoWork += new DoWorkEventHandler(bw_LoadCharacterProfiler);
                    //bw.RunWorkerAsync(form.Character);
                    Base.ErrorBox eb = new Base.ErrorBox("Load Character from Character Profiler", "Not Yet Implemented");
                    eb.Show();
                }

                //form.Dispose();
            }
            catch (InvalidDataException ex)
            {
                MessageBox.Show("Unable to parse saved variable file: " + ex.Message);
                Base.ErrorBox eb = new Base.ErrorBox("Load Character from Character Profiler", "Not Yet Implemented");
                eb.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error reading saved variable file: " + ex.Message);
                Base.ErrorBox eb = new Base.ErrorBox("Error reading saved variable file", "Not Yet Implemented");
                eb.Show();
            }
        }
示例#3
0
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            // TODO: Run Load Character from Profiler action
            try
            {
                CharacterProfilerData characterList = new CharacterProfilerData(TB_FilePath.Text);

                FormChooseCharacter form = new FormChooseCharacter(characterList);

                form.Show();
                if (form.DialogResult == true)
                {
                    //StartProcessing();
                    //BackgroundWorker bw = new BackgroundWorker();
                    //bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_LoadCharacterProfilerComplete);
                    //bw.DoWork += new DoWorkEventHandler(bw_LoadCharacterProfiler);
                    //bw.RunWorkerAsync(form.Character);
                    Base.ErrorBox eb = new Base.ErrorBox("Load Character from Character Profiler", "Not Yet Implemented");
                    eb.Show();
                }

                //form.Dispose();
            }
            catch (InvalidDataException ex)
            {
                MessageBox.Show("Unable to parse saved variable file: " + ex.Message);
                Base.ErrorBox eb = new Base.ErrorBox("Load Character from Character Profiler", "Not Yet Implemented");
                eb.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error reading saved variable file: " + ex.Message);
                Base.ErrorBox eb = new Base.ErrorBox("Error reading saved variable file", "Not Yet Implemented");
                eb.Show();
            }
        }
示例#4
0
        private void ExportToCSV(object sender, RoutedEventArgs e)
        {
#if SILVERLIGHT
            if (!App.Current.IsRunningOutOfBrowser) {
                MessageBox.Show("This function can only be run when Rawr is installed offline due to a Silverlight Permissions issue."
                              + "\n\nYou can install Rawr offline using the button in the Upper Right-Hand corner of the program",
                                "Cannot Perform Action", MessageBoxButton.OK);
                return;
            }
#endif

            SaveFileDialog dialog = new SaveFileDialog();
            dialog.DefaultExt = ".csv";
            dialog.Filter = "Comma Separated Values | *.csv";
            if (dialog.ShowDialog().GetValueOrDefault(false)) {
                try {
                    using (Stream s = dialog.OpenFile())
                    {
                        List<byte> toWrite = new List<byte>();
                        foreach (char c in GetChartDataCSV().ToCharArray())
                        {
                            toWrite.AddRange(BitConverter.GetBytes(c));
                        }
                        s.Write(toWrite.ToArray(), 0, toWrite.Count);
                        s.Close();
                    }
#if SILVERLIGHT
                } catch (System.Security.SecurityException) {
                    MessageBox.Show("The folder you have selected is restricted from being accessed by Silverlight."
                                  + "\r\nUnfortunately there is no way around this at this time.",
                                    "Cannot Perform Action", MessageBoxButton.OK);
#endif
                } catch (Exception ex) {
                    Base.ErrorBox eb = new Base.ErrorBox("Error Saving CSV File", ex.Message);
                    eb.Show();
                }
            }
        }
        private void ExportToCSV(object sender, RoutedEventArgs e)
        {
            if (!App.Current.IsRunningOutOfBrowser) {
                MessageBox.Show("This function can only be run when Rawr is installed offline due to a Silverlight Permissions issue."
                              + "\n\nYou can install Rawr offline using the button in the Upper Right-Hand corner of the program",
                                "Cannot Perform Action", MessageBoxButton.OK);
                return;
            }

            SaveFileDialog dialog = new SaveFileDialog();
            dialog.DefaultExt = ".csv";
            dialog.Filter = "Comma Separated Values | *.csv";
            if (dialog.ShowDialog().GetValueOrDefault(false))
            {
                try
                {
                    using (StreamWriter writer = File.CreateText(dialog.SafeFileName)) // no path data and no way to get it? wtf?
                    {
                        writer.Write(GetChartDataCSV());
                        writer.Flush();
                        writer.Close();
                        writer.Dispose();
                    }
                }
                catch (Exception ex) {
                    Base.ErrorBox eb = new Base.ErrorBox("Error Saving CSV File", ex.Message);
                    eb.Show();
                }
            }
        }