예제 #1
0
        /// <summary>
        /// 导出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnExport_Click(object sender, RoutedEventArgs e)
        {
            if (watchElements == null || watchElements.Count == 0)
            {
                MessageBox.Show("没有要导出的表盘元素");
                return;
            }

            System.Windows.Forms.FolderBrowserDialog folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
            if (folderBrowserDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string       folder = folderBrowserDialog.SelectedPath;
                ExportWindow export = new ExportWindow();
                export.WatchDescription = new WatchDescription
                {
                    Screen  = resolution == 0 ? "HWHD02" : "HWHD01",
                    Version = resolution == 0 ? "2.1.1" : "3.1.1"
                };
                if (export.ShowDialog() ?? false)
                {
                    ConfigWriter writer = new ConfigWriter(folder, watchElements, export.WatchDescription);
                    writer.Write();
                    string res = folder + "/watchface/res/";
                    SaveToImage(res + "A100_001.png");

                    SaveToPreviewImage(folder + "/preview/");
                    Process.Start(folder);
                }
            }
        }
예제 #2
0
        /// <summary>
        /// 打开窗口
        /// </summary>
        private void ExecuteOpenECmd()
        {
            ExportWindow sender = new ExportWindow();

            sender.Show();
            Messenger.Default.Send <bool>(true, "CloseDectWindow"); //注意:token参数一致
        }
        public void LoadData(LocaleViewModel data)
        {
            ViewModel = data;

            DataContext            = ViewModel;
            ExportWindow.ViewModel = ViewModel;
            ExportWindow.ResetBindings();
        }
예제 #4
0
        // PDF export
        private void btnPDF_Click(object sender, RoutedEventArgs e)
        {
            ExportWindow ew = new ExportWindow();

            ew.Owner = this;
            ew.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            ew.ExportType            = ExportType.PDF;
            ew.Show();
        }
예제 #5
0
 public ConfigWindow(Gauges gauges)
     : base(Constants.WINDOW_ID_CONFIG, "NanoGauges Configuration")
 {
     this.gauges = gauges;
     //
     profilesWindow = new ProfilesWindow();
     hotkeysWindow  = new HotkeysWindow();
     exportWindow   = new ExportWindow();
     //
     SetSize(350, 300);
     CenterWindow();
 }
예제 #6
0
 private void ButtonExport_OnClick(object sender, RoutedEventArgs e)
 {
     try
     {
         var exportWindow = new ExportWindow(_streamDeckPanel);
         exportWindow.Show();
         SetFormState();
     }
     catch (Exception ex)
     {
         Common.LogError(ex);
     }
 }
예제 #7
0
    static void ShowNamePopup()
    {
        ExportWindow window = new ExportWindow();

        string[] assets = AssetDatabase.FindAssets("ExportProperties t:ExportProperties", new[] { "Assets/UCO" });
        if (assets.Length > 0)
        {
            Debug.Log(AssetDatabase.GUIDToAssetPath(assets[0]));
            exportProperties = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(assets[0]), typeof(ExportProperties)) as ExportProperties;
            studentName      = exportProperties.studentName;
        }

        window.ShowUtility();
    }
예제 #8
0
        private void ExportWindow(object sender, RoutedEventArgs e)
        {
            ExportWindow exportWindow = new ExportWindow(this._idEvent);

            exportWindow.Show();

            /*this.GridLoading.Visibility = Visibility.Visible;
             *
             * var filePath = string.Empty;
             * using (FolderBrowserDialog fd = new FolderBrowserDialog())
             * {
             *  if (fd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             *  {
             *      filePath = fd.SelectedPath;
             *  }
             * }
             *
             * if (filePath.Equals(string.Empty))
             * {
             *  this.GridLoading.Visibility = Visibility.Hidden;
             *  return;
             * }
             *
             * ObservableCollection<EventFieldUser> data = this._mainWindowImpl.MainFields;
             * DateTime now = DateTime.Now;
             * string nameFile = filePath + '\\' + "users" + now.ToString("ddMMyyyy") + "-" + now.ToString("HHmmsstt") + ".csv";
             *
             * using (var writer = new StreamWriter(nameFile, false, Encoding.UTF8))
             * using (var csvWriter = new CsvWriter(writer))
             * {
             *  csvWriter.Configuration.Delimiter = DELIMITER;
             *  csvWriter.Configuration.HasHeaderRecord = true;
             *  csvWriter.Configuration.AutoMap<EventFieldUser>();
             *
             *  csvWriter.WriteHeader<EventFieldUser>();
             *  csvWriter.NextRecord();
             *  csvWriter.WriteRecords(data);
             *
             *  writer.Flush();
             *
             * }
             *
             * string[] arg = new string[] { WORKER_EXPORT, nameFile};
             * this.RunMyWorker(arg);*/
        }
예제 #9
0
        /// <summary>
        /// Exporta um gesto.
        /// </summary>
        private void exportMenuItem_Click(object sender, RoutedEventArgs e)
        {
            var w = new ExportWindow();

            if (NewDialog(w) == true)
            {
                string         name   = (string)w.Tag;
                SaveFileDialog dialog = new SaveFileDialog();
                dialog.Title           = "Export Gesture";
                dialog.ValidateNames   = true;
                dialog.AddExtension    = true;
                dialog.DefaultExt      = ".gst";
                dialog.CheckPathExists = true;
                dialog.CreatePrompt    = false;
                dialog.OverwritePrompt = true;
                if (dialog.ShowDialog() == true)
                {
                    controller.ExportGesture(name, dialog.FileName);
                }
            }
        }
예제 #10
0
        public void TestSetting()
        {
            // Switch to VPN client session
            this.vpnClient.Session.SwitchTo();
            LandingScreen landingScreen = new LandingScreen(this.vpnClient.Session);

            landingScreen.ClickGetStartedButton();

            // User Sign In via web browser
            UserCommonOperation.UserSignIn(this.vpnClient, this.browser);

            // Main Screen
            this.vpnClient.Session.SwitchTo();
            MainScreen mainScreen = new MainScreen(this.vpnClient.Session);

            mainScreen.ClickSettingsButton();

            // Setting Screen
            SettingScreen settingScreen = new SettingScreen(this.vpnClient.Session);

            Assert.IsNotNull(settingScreen.GetProfileImage());
            Assert.AreEqual(Environment.GetEnvironmentVariable("EXISTED_USER_NAME"), settingScreen.GetUserName());
            Assert.AreEqual("Manage account", settingScreen.GetManageAccountButtonText());
            Assert.AreEqual("Launch VPN app on computer startup", settingScreen.GetLaunchVPNStartupText());
            Assert.AreEqual("Notifications", settingScreen.GetNotificationButtonText());
            Assert.AreEqual("Network settings", settingScreen.GetNetworkSettingButtonText());
            Assert.AreEqual("Language", settingScreen.GetLanguageButtonText());
            Assert.AreEqual("About", settingScreen.GetAboutButtonText());
            Assert.AreEqual("Get help", settingScreen.GetHelpButtonText());
            Assert.AreEqual("Give feedback", settingScreen.GetGiveFeedbackText());
            Assert.IsTrue(settingScreen.GetLaunchVPNStartupCheckBox().Enabled);

            // Click Manage Account button
            settingScreen.ClickManageAccountButton();
            this.browser.Session.SwitchTo();
            Assert.IsTrue(this.browser.GetCurrentUrl().Contains(Constants.ManageAccountUrl));

            // Test checkbox state remain after nav
            bool prevLaunchVPNStartupState = settingScreen.GetLaunchVPNStartupCheckBox().Selected;

            settingScreen.ClickLaunchVPNStartupCheckbox();
            bool expectedCurrentLaunchVPNStartupState = !prevLaunchVPNStartupState;

            // Nav back to main screen
            settingScreen.ClickBackButton();

            // nav back to setting screen again to check the state remaining the same
            mainScreen = new MainScreen(this.vpnClient.Session);
            mainScreen.ClickSettingsButton();

            // Verify the state
            settingScreen = new SettingScreen(this.vpnClient.Session);
            bool currentLaunchVPNStartupState = settingScreen.GetLaunchVPNStartupCheckBox().Selected;

            Assert.AreEqual(expectedCurrentLaunchVPNStartupState, currentLaunchVPNStartupState);

            // Click the notification button
            settingScreen.ScrollDown();
            settingScreen.ClickNotificationButton();
            NotificationsScreen notificationsScreen = new NotificationsScreen(this.vpnClient.Session);

            Assert.AreEqual("Notifications", notificationsScreen.GetTitle());
            Assert.AreEqual("Unsecured network alert", notificationsScreen.GetUnsecuredNetworkAlertText());
            Assert.AreEqual("Get notified if you connect to an unsecured Wi-Fi network", notificationsScreen.GetUnsecuredNetworkAlertDescription());
            Assert.AreEqual("Guest Wi-Fi portal alert", notificationsScreen.GetGuestWifiPortalAlertText());
            Assert.AreEqual("Get notified if a guest Wi-Fi portal is blocked due to VPN connection", notificationsScreen.GetGuestWifiPortalAlertDescription());

            // Check the state remain after nav
            bool prevUnsecuredNetworkAlertState = notificationsScreen.IsUnsecuredNetworkAlertChecked();
            bool prevGuestWifiPortalAlertState  = notificationsScreen.IsGuestWifiPortalAlertChecked();

            notificationsScreen.ClickUnsecuredNetworkAlertCheckBox();
            notificationsScreen.ClickGuestWifiPortalAlertCheckBox();
            bool expectedCurrentUnsecuredNetworkAlertState = !prevUnsecuredNetworkAlertState;
            bool expectedCurrentGuestWifiPortalAlertState  = !prevGuestWifiPortalAlertState;

            // Nav back to setting screen
            notificationsScreen.ClickBackButton();
            settingScreen = new SettingScreen(this.vpnClient.Session);
            settingScreen.ClickNotificationButton();

            // Verifiy alert state
            notificationsScreen = new NotificationsScreen(this.vpnClient.Session);
            Assert.AreEqual(expectedCurrentUnsecuredNetworkAlertState, notificationsScreen.IsUnsecuredNetworkAlertChecked());
            Assert.AreEqual(expectedCurrentGuestWifiPortalAlertState, notificationsScreen.IsGuestWifiPortalAlertChecked());
            notificationsScreen.ClickBackButton();

            // Nav to Network Settings screen
            settingScreen = new SettingScreen(this.vpnClient.Session);
            settingScreen.ClickNetworkSettingButton();

            // On network settings screen
            NetworkSettingsScreen networkSettingsScreen = new NetworkSettingsScreen(this.vpnClient.Session);
            bool preEnableIPv6  = networkSettingsScreen.IsEnableIPv6Checked();
            bool preAllowAccess = networkSettingsScreen.IsAllowAccessChecked();

            Assert.AreEqual("Network settings", networkSettingsScreen.GetTitle());
            Assert.AreEqual("Enable IPv6", networkSettingsScreen.GetEnableIPv6CheckBoxText());
            Assert.AreEqual("Push the internet forward with the latest version of the Internet Protocol", networkSettingsScreen.GetEnableIPv6Description());
            Assert.IsFalse(networkSettingsScreen.IsEnableIPv6DisabledMessageDisplayed());
            Assert.AreEqual("Local network access", networkSettingsScreen.GetAllowAccessText());
            Assert.AreEqual("Access printers, streaming sticks and all other devices on your local network", networkSettingsScreen.GetAllowAccessDescription());
            Assert.IsFalse(networkSettingsScreen.IsAllowAccessDisabledMessageDisplayed());

            // check the checkbox state after click
            networkSettingsScreen.ClickAllowAccessCheckBox();
            networkSettingsScreen.ClickEnableIPv6CheckBox();
            bool expectedEnableIPv6  = !preEnableIPv6;
            bool expectedAllowAccess = !preAllowAccess;

            networkSettingsScreen.ClickBackButton();

            // Back to main screen to turn on vpn
            settingScreen = new SettingScreen(this.vpnClient.Session);
            settingScreen.ClickBackButton();
            mainScreen = new MainScreen(this.vpnClient.Session);
            mainScreen.ToggleVPNSwitch();
            mainScreen.ClickSettingsButton();

            // Check Network setting screen again
            settingScreen = new SettingScreen(this.vpnClient.Session);
            settingScreen.ScrollDown();
            settingScreen.ClickNetworkSettingButton();
            networkSettingsScreen = new NetworkSettingsScreen(this.vpnClient.Session);
            bool currentAllowAccessState = networkSettingsScreen.IsAllowAccessChecked();
            bool currentEnableIPv6       = networkSettingsScreen.IsEnableIPv6Checked();

            Assert.AreEqual(expectedAllowAccess, currentAllowAccessState);
            Assert.AreEqual(expectedEnableIPv6, currentEnableIPv6);
            Assert.IsFalse(networkSettingsScreen.IsAllowAccessEnabled());
            Assert.IsTrue(networkSettingsScreen.IsAllowAccessDisabledMessageDisplayed());
            Assert.AreEqual($"VPN must be off before {(currentAllowAccessState ? "disabling" : "enabling")}", networkSettingsScreen.GetAllowAccessDisabledMessage());
            Assert.IsFalse(networkSettingsScreen.IsEnableIPv6Enabled());
            Assert.IsTrue(networkSettingsScreen.IsEnableIPv6DisabledMessageDisplayed());
            Assert.AreEqual($"VPN must be off before {(currentEnableIPv6 ? "disabling" : "enabling")}", networkSettingsScreen.GetEnableIPv6DisabledMessage());
            networkSettingsScreen.ClickBackButton();

            // Back to main screen to turn off vpn
            settingScreen = new SettingScreen(this.vpnClient.Session);
            settingScreen.ClickBackButton();
            mainScreen = new MainScreen(this.vpnClient.Session);
            mainScreen.ToggleVPNSwitch();
            mainScreen.ClickSettingsButton();

            // Nav to language screen
            settingScreen = new SettingScreen(this.vpnClient.Session);
            settingScreen.ScrollDown();
            settingScreen.ClickLanguageButton();

            // On language screen
            LanguageScreen languageScreen = new LanguageScreen(this.vpnClient.Session);

            languageScreen.RandomPickAdditionalLanguage();

            // Reset back to English
            languageScreen.ClickDefaultLanguageRadioButton();
            languageScreen.ClickBackButton();

            // Nav to About screen
            settingScreen = new SettingScreen(this.vpnClient.Session);
            settingScreen.ClickAboutButton();

            // About screen
            AboutScreen aboutScreen = new AboutScreen(this.vpnClient.Session);

            Assert.AreEqual("Firefox Private Network", aboutScreen.GetFPNTitle());
            Assert.AreEqual("A fast, secure and easy to use VPN \r\n(Virtual Private Network).", aboutScreen.GetFPNSubtitle());
            Assert.AreEqual("Release version", aboutScreen.GetReleaseTitle());
            Console.WriteLine($"Version: {aboutScreen.GetReleaseVersion()}");
            Assert.IsTrue(Regex.IsMatch(aboutScreen.GetReleaseVersion(), @"^\d+.\d+[abAB]?$"));

            // Click terms of service button
            this.vpnClient.Session.SwitchTo();
            aboutScreen.ClickTermsOfService();
            this.browser.Session.SwitchTo();
            string actualTermsOfServiceUrl = this.browser.GetCurrentUrl();

            Console.WriteLine($"Terms of service url: {actualTermsOfServiceUrl}");
            Assert.IsTrue(actualTermsOfServiceUrl.Contains(Constants.TermsOfServiceUrl));

            // Click privacy policy button
            this.vpnClient.Session.SwitchTo();
            aboutScreen.ClickPrivacyPolicy();
            this.browser.Session.SwitchTo();
            string actualPrivacyPolicyUrl = this.browser.GetCurrentUrl();

            Console.WriteLine($"Privacy Policy url: {actualPrivacyPolicyUrl}");
            Assert.IsTrue(actualPrivacyPolicyUrl.Contains(Constants.PrivacyPolicyUrl));

            // Click the Debug button
            this.vpnClient.Session.SwitchTo();
            aboutScreen.ClickDebug();

            // On Privacy Notice popup
            PrivacyNoticePopup privacyNoticePopup = new PrivacyNoticePopup(this.vpnClient.Session);

            Assert.AreEqual(Utils.CleanText(Constants.PrivacyNotice), Utils.CleanText(privacyNoticePopup.GetPrivacyNoticeDetails()));
            privacyNoticePopup.ClickYesButton();

            // Open Export Debug package window
            ExportWindow exportDebugPackageWindow = new ExportWindow(this.vpnClient.Session, "Export debug package");

            exportDebugPackageWindow.SaveFile(this.folderPath, this.debugFileName);
            Assert.IsTrue(Utils.WaitUntilFileExist(Path.Combine(this.folderPath, this.debugFileName)));

            // Click viewlog button
            aboutScreen.ClickViewLog();
            LogWindow logWindow = new LogWindow(this.desktop.Session);

            Assert.AreEqual("Timestamp", logWindow.GetTimeStampColumnHeader());
            Assert.AreEqual("Message", logWindow.GetMessageColumnHeader());
            Assert.IsTrue(logWindow.GetNumberOfLogs() > 0);

            // Click save button on view log window
            logWindow.ClickSaveButton();

            // Open SaveLog window
            ExportWindow saveLogWindow = new ExportWindow(this.desktop.Session, "Save log");

            saveLogWindow.SaveFile(this.folderPath, this.logFileName);
            Assert.IsTrue(Utils.WaitUntilFileExist(Path.Combine(this.folderPath, this.logFileName)));

            // Back to setting screen
            logWindow.CloseWindow();
            aboutScreen.ClickBackButton();

            // Click Get Help button
            settingScreen = new SettingScreen(this.vpnClient.Session);
            settingScreen.ClickGetHelpButton();

            // On Get Help Screen
            GetHelpScreen getHelpScreen = new GetHelpScreen(this.vpnClient.Session);

            Assert.AreEqual("Get help", getHelpScreen.GetTitle());
            Assert.AreEqual("Contact us", getHelpScreen.GetContactUs());
            Assert.AreEqual("Help & Support", getHelpScreen.GetHelpAndSupport());

            // Click contact us button
            this.vpnClient.Session.SwitchTo();
            getHelpScreen.ClickContactUs();
            this.browser.Session.SwitchTo();
            string actualContactUsUrl = this.browser.GetCurrentUrl();

            Console.WriteLine($"Contact us url: {actualContactUsUrl}");
            Assert.IsTrue(actualContactUsUrl.Contains(Constants.ContactUsUrl));

            // Click help and support button
            this.vpnClient.Session.SwitchTo();
            getHelpScreen.ClickHelpAndSupport();
            this.browser.Session.SwitchTo();
            string actualHelpSupportUrl = this.browser.GetCurrentUrl();

            Console.WriteLine($"Help and support url: {actualHelpSupportUrl}");
            Assert.IsTrue(actualHelpSupportUrl.Contains(Constants.SupportUrl));

            // Back to setting screen
            this.vpnClient.Session.SwitchTo();
            getHelpScreen.ClickBackButton();

            // Click Give feedback button
            settingScreen = new SettingScreen(this.vpnClient.Session);
            settingScreen.ClickGiveFeedbackLink();
            this.browser.Session.SwitchTo();
            Assert.IsTrue(this.browser.GetCurrentUrl().Contains(Constants.FeedbackUrl));

            // Sign out
            this.vpnClient.Session.SwitchTo();
            settingScreen.ClickSignOutButton();
        }
예제 #11
0
        public override void Execute()
        {
            ExportWindow frm = new ExportWindow(Services);

            frm.Show(Services.HostWindow.Instance);
        }
예제 #12
0
        private void exportPC(object sender, RoutedEventArgs e)
        {
            ExportWindow window = new ExportWindow();

            window.ShowDialog();
        }
예제 #13
0
		public override void Execute()
		{
			ExportWindow frm = new ExportWindow(Services);
			frm.Show(Services.HostWindow.Instance);
		}
예제 #14
0
        // Обработка нажатия кнопки в Док.
        private void btnToDoc_Click(object sender, RoutedEventArgs e)
        {
            ExportWindow exportWindow = new ExportWindow();

            exportWindow.ShowDialog();
        }
예제 #15
0
        // Save, SaveAs, or Export
        private void SaveAsButton_Click(object sender, RoutedEventArgs e)
        {
            // we should be checking the Loadfile object
            if (Loadfile == null)
            {
                // Get the table name from the command in SQL Console
                #region Select Ad-Hoc

                string pattern = @".*\s*FROM\s*(?<tblname>\w*)\s*";
                Regex  rgx     = new Regex(pattern, RegexOptions.IgnoreCase);
                Match  match   = rgx.Match(SelectCommandString);
                CurrentView.TableName = match.Groups["tblname"].Value.ToString();

                #endregion

                string NewLoadfileFilepath =
                    System.IO.Path.Combine(
                        Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
                        CurrentView.TableName + "_" + Log.ErrorLog.TimeStamp() + ".dat"
                        );

                this.tbFilepath.Text = NewLoadfileFilepath;

                ConcordanceDat Dat = new ConcordanceDat(NewLoadfileFilepath);
                Dat.SetFieldNames(this.CurrentView.FieldNamesAsDisplayed);
                Dat.Save(NewLoadfileFilepath);
                Dat.Close();
                this.Loadfile = Dat;
            }

            ExportWindow Ew = null;

            try
            {
                Ew = new ExportWindow(this.Loadfile);
                Ew.ShowDialog();
            }
            catch (Exception Ex)
            {
                Status("Error opening Save dialog with loadfile: "
                       + this.Loadfile.FileInformation.Name
                       + Environment.NewLine
                       + Ex.Message
                       );
            }

            if (Ew.DialogResult == true)
            {
                Log.Timer.Start();

                // try to make a backup
                try
                {
                    // make a backup of the loadfile
                    if (this.Loadfile.FileInformation.FullName.ToUpper() == Ew.OutputFilepath.ToUpper())
                    {
                        Status("Creating backup of the original loadfile....");

                        string backupfilename = System.IO.Path.Combine(
                            System.IO.Path.GetDirectoryName(this.Loadfile.FileInformation.FullName),
                            System.IO.Path.GetFileNameWithoutExtension(this.Loadfile.FileInformation.FullName)
                            + "_LFUBACKUP_"
                            + Log.ErrorLog.TimeStamp()
                            + System.IO.Path.GetExtension(this.Loadfile.FileInformation.FullName)
                            );

                        Log.ErrorLog.AddMessage("Creating backup of " + this.Loadfile.FileInformation.FullName + " as " + backupfilename);

                        // make the copy!
                        File.Copy(this.Loadfile.FileInformation.FullName, backupfilename);
                        Status("Created backup " + backupfilename);
                    }
                }
                catch (Exception Ex)
                {
                    Log.ErrorLog.AddMessage("Error during backup of file: "
                                            + this.Loadfile.FileInformation.FullName
                                            + Environment.NewLine
                                            + Ex.Message
                                            + Environment.NewLine
                                            + Ex.StackTrace);

                    Status("Error during save of file: " + this.Loadfile.FileInformation.FullName);
                }

                // try to save the loadfile
                try
                {
                    // we need to save against a select statement and NOT a tablename -ds 09-23-2015
                    Export.Save(Loadfile, Ew.OutputFilepath, CurrentView.TableName, CurrentView.FieldNamesAsDisplayed, SelectCommandString);

                    Status("Save is complete: "
                           + Ew.OutputFilepath
                           + " ("
                           + Log.Timer.ElapsedTime().ToString()
                           + ")"
                           );

                    // let's not rename table
                    // -ds 2015-07-17

                    /*if (Db.Connect.RenameTable(TableName, Db.Connect.GetTableName(Ew.OutputFilepath)) == 1)
                     * {
                     *  // change visible path only if we successfully renamed that backing table
                     *  this.tbFilepath.Text = Ew.OutputFilepath;
                     *  TableName = Db.Connect.GetTableName(this.tbFilepath.Text);
                     * }*/
                }
                catch (Exception Ex)
                {
                    Log.ErrorLog.AddMessage("Error during save of file: "
                                            + this.Loadfile.FileInformation.FullName
                                            + Environment.NewLine
                                            + Ex.Message
                                            + Environment.NewLine
                                            + Ex.StackTrace);

                    Status("Error during save of file: " + this.Loadfile.FileInformation.FullName);
                }
            }
            else
            {
                Status("Export or Save was cancelled.");
            }
        }