Ejemplo n.º 1
0
 /// <summary>
 /// Externally called as handler
 /// </summary>
 /// <param name="h"></param>
 public void Accept(HotKey h)
 {
     var b1 = waitingForUserDecision;
     var b2 = (!waitingForUserDecision && !requireUserDecision);
     if (b1 || b2)
     {
         Add();
         // cant be, then will create pascal
         //if (h.Tag != null)
         //{
         //    h.Tag = null;
         //}
         waitingForUserDecision = false;
         ThisApp.SetStatus(TypeOfMessage.Success, txtEnglishTranslate.Text + " accepted");
         ClearTextBoxes(true, true);
     }
     else
     {
     #if DEBUG
         string postfix = string.Empty;
         if (!waitingForUserDecision)
         {
             postfix = ", wasn't waited for user desision. Press button";
         }
         ThisApp.SetStatus(TypeOfMessage.Information, "wasn't accepted" + postfix);
         #endif
     }
 }
Ejemplo n.º 2
0
 public UpdaterPage()
 {
     InitializeComponent();
     if (ThisApp.IsUwpApp())
     {
         appUpdater1.Visible = false;
     }
 }
Ejemplo n.º 3
0
        public General()
        {
            InitializeComponent();

            NetworkIntefaceModule netModule = new NetworkIntefaceModule();
            var adapters = netModule.GetNetworkInterface();

            foreach (String adapter in adapters)
            {
                ListAdapter.Items.Add(adapter);
            }

            //Set to default value
            cmbFormat.SelectedItem = "Auto";
            radioEnglish.Checked   = true;
            if (ListAdapter.Items != null)
            {
                ListAdapter.SelectedIndex = 0;
            }

            if (ThisApp.IsUwpApp())
            {
                ToggleAutoUpdate.Checked = false;
                ToggleAutoUpdate.Enabled = false;
                label6.Text += " (Disabled)";
            }

            #region LoadConfiguration

            //Get app configuration
            var configuration = registryManager.GetGeneralConfiguration();

            //set configuration
            ToggleMonitor.Checked    = (configuration.Monitoring) ? true : false;
            ToggleAutoUpdate.Checked = (configuration.AutoUpdate) ? true : false;

            if (configuration.Format != null)
            {
                cmbFormat.SelectedItem = configuration.Format;
            }

            if (configuration.Language == Language.English)
            {
                radioEnglish.Checked = true;
            }
            else
            {
                radioIndonesia.Checked = true;
            }

            if (configuration.MonitoredAdapter != null && ListAdapter.Items.Contains(configuration.MonitoredAdapter))
            {
                ListAdapter.SelectedItem = configuration.MonitoredAdapter;
            }

            #endregion LoadConfiguration
        }
Ejemplo n.º 4
0
        public Main()
        {
            InitializeComponent();
            CleaningOnStartup();

            main  = this;
            State = this.WindowState;
            if (ThisApp.IsUwpApp())
            {
                Text += " (UWP)";
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Recognize language and set to txt 
 /// Translate if is needed and put into *.xlf
 /// </summary>
 /// <param name="requireUserDecision"></param>
 /// <param name="text"></param>
 /// <param name="key2"></param>
 public void Add(bool requireUserDecision, string text, string key2 = null)
 {
     #region Recognize language and set to txt 
     // If A2 is path, A1 is text
     if (FS.ExistsFile(text))
     {
         return;
     }
     this.requireUserDecision = requireUserDecision;
     acceptHotkey.Tag = key2;
     if (TextLang.IsCzech(text))
     {
         l = Langs.cs;
         //rbCs.IsChecked = true;
     }
     else
     {
         // not to lb but directly to l. manybe in UC will raise event handler to set l, but in XlfEngine not. 
         l = Langs.en;
         //rbEn.IsChecked = true;
     }
     ClearTextBoxes(false, true);
     txtText.Text = text;
     #endregion
     #region Process text
     if (l == Langs.en)
     {
         // Insert as content of <target>
         // Will use only english so czech don't translate now
         Add();
     }
     else
     {
         string englishTranslate = null;
         englishTranslate = TranslateHelper.Instance.Translate(text, "en", "cs");
         if (char.IsUpper(text[0]))
         {
             englishTranslate = SH.FirstCharUpper(englishTranslate);
         }
         txtEnglishTranslate.Text = englishTranslate;
         ThisApp.SetStatus(TypeOfMessage.Error, "Press enter to add or delete to exit");
         if (requireUserDecision)
         {
             waitingForUserDecision = true;
         }
         else
         {
             Accept(acceptHotkey);
         }
     }
     #endregion
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Return whether A1 is in XlfKeys
 /// if A2, save A1 to clipboard
 /// Externally called from InsertIntoXlfAndConstantCsUC.ClipboardMonitor_OnClipboardContentChanged
 /// </summary>
 /// <param name="pascal"></param>
 /// <param name="insertToClipboard"></param>
 public bool IsAlreadyContainedInXlfKeys(string pascal, bool insertToClipboard)
 {
     int first = -1;
     var keys = GetConsts(out first);
     if (keys.Contains(pascal))
     {
         if (insertToClipboard)
         {
             ClipboardHelper.SetText(pascal);
         }
         ThisApp.SetStatus(TypeOfMessage.Information, "Already " + pascal + " contained");
         return true;
     }
     return false;
 }
Ejemplo n.º 7
0
        public Main()
        {
            InitializeComponent();
            registryManager = new RegistryManager();
            integration     = new Integration();

            CleaningOnStartup();

            main  = this;
            State = this.WindowState;
            if (ThisApp.IsUwpApp())
            {
                Text += " (UWP)";
            }
        }
Ejemplo n.º 8
0
 private void btnConnect_Click(object sender, EventArgs e)
 {
     ThisApp.Project = cbbProjectList.SelectedItem as Project;
     //if (rdClient.Checked)
     //{
     //    ThisApp.Project.Id = 1;
     //    ThisApp.Project.Name = "client";
     //}
     //if (rdApi.Checked)
     //{
     //    ThisApp.Project.Id = 2;
     //    ThisApp.Project.Name = "api";
     //}
     Utility.UpdateLastSelectProject(ThisApp.Project);
     ThisApp.AppSetting     = Utility.GetCurrentSetting(ThisApp.Project.Name);
     ThisApp.currentSession = ThisApp.getSessionByDbType(DatabaseType.SQL);
     this.Close();
 }
Ejemplo n.º 9
0
        void DocPicker_DidPickDocumentAtUrls(object sender, UIDocumentPickedAtUrlsEventArgs e)
        {
            if (e.Urls == null || e.Urls.Length < 1)
            {
                return;
            }

            docPicker?.DismissViewControllerAsync(true);

            // IMPORTANT! You must lock the security scope before you can
            // access this file
            var securityEnabled = e.Urls[0].StartAccessingSecurityScopedResource();

            ThisApp.ClearDocumentHandler();
            ThisApp.DocumentLoaded += ThisApp_DocumentLoaded;
            ThisApp.OpenDocument(e.Urls[0]);

            // IMPORTANT! You must release the security lock established
            // above.
            e.Urls[0].StopAccessingSecurityScopedResource();
        }
Ejemplo n.º 10
0
 private void InitCbbTable(Model.DatabaseType databaseType)
 {
     m_dbType = databaseType;
     ThisApp.currentSession = ThisApp.getSessionByDbType(m_dbType);
     this.ToForm(ThisApp.currentSession);
     ThisApp.DbType      = m_dbType;
     cbbTable.DataSource = null;
     if (databaseType == Model.DatabaseType.SQL)
     {
         cbbTable.DataSource = Model.DatabaseHelper.lstSqlTable;
     }
     if (databaseType == Model.DatabaseType.Mongo)
     {
         cbbTable.DataSource = Model.DatabaseHelper.lstMongoCollection;
     }
     if (databaseType == Model.DatabaseType.Neo)
     {
         cbbTable.DataSource = Model.DatabaseHelper.lstNeoNode;
     }
     cbbTable.DisplayMember = "RealName";
 }
        /// <Docs>Called after the object has been loaded from the nib file. Overriders must call base.AwakeFromNib().</Docs>
        /// <summary>
        /// Awakes from nib.
        /// </summary>
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            // Create a new accessory browser
            AccessoryBrowser = new HMAccessoryBrowser();

            // Wireup changes
            AccessoryBrowser.DidFindNewAccessory += (sender, e) => {
                // Update display
                ReloadData();
            };

            AccessoryBrowser.DidRemoveNewAccessory += (sender, e) => {
                // Update display
                ReloadData();

                // Inform the rest of the UI that it needs to refresh
                ThisApp.RaiseUpdateGUI();
            };
        }
        private void frmSetupApplication_Load(object sender, EventArgs e)
        {
            HiddenControl(this);
            if (ThisApp.AppSetting == null)
            {
                return;
            }
            this.ToForm(AppSetting);

            if (rdSql.Checked)
            {
                m_dbType = DatabaseType.SQL;
            }
            if (rdMongo.Checked)
            {
                m_dbType = DatabaseType.Mongo;
            }
            if (rdNeo.Checked)
            {
                m_dbType = DatabaseType.Neo;
            }
            ThisApp.currentSession = ThisApp.getSessionByDbType(m_dbType);
            groupBox2.ToForm(ThisApp.currentSession);
        }
 private void rdNeo_Click(object sender, EventArgs e)
 {
     m_dbType = DatabaseType.Neo;
     ThisApp.currentSession = ThisApp.getSessionByDbType(m_dbType);
     groupBox2.ToForm(ThisApp.currentSession);
 }
Ejemplo n.º 14
0
 private void ThisAddIn_Startup(object sender, System.EventArgs e)
 {
     ThisApp        = Application;
     ActiveExplorer = ThisApp.ActiveExplorer();
     ActiveExplorer.SelectionChange += CurrentExplorer_SelectionChange;
 }
Ejemplo n.º 15
0
 public new void Show()
 {
     Visibility = Visibility.Visible;
     ThisApp?.BringToFront();
 }