コード例 #1
0
        public static Shortcuts VMToShortcuts(ShortcutsVM shortcutsVM)
        {
            Shortcuts shortcuts = new Shortcuts(shortcutsVM.Version);

            shortcuts.WindowItems = VMsToWindowItems(shortcutsVM.WindowItemVMs);
            return(shortcuts);
        }
コード例 #2
0
        /// <summary>
        /// Creates a new instance of the frmOptions class.
        /// </summary>

        public frmOptions()
        {
            InitializeComponent();

            __RightClickEnabled = Shortcuts.IsSearchOption();

            ForeColorButton.ColorChange            += new bSearch.Windows.Controls.ColorButton.ColorChangeHandler(NewColor);
            BackColorButton.ColorChange            += new bSearch.Windows.Controls.ColorButton.ColorChangeHandler(NewColor);
            btnResultsWindowForeColor.ColorChange  += new bSearch.Windows.Controls.ColorButton.ColorChangeHandler(NewColor);
            btnResultsWindowBackColor.ColorChange  += new bSearch.Windows.Controls.ColorButton.ColorChangeHandler(NewColor);
            btnResultsContextForeColor.ColorChange += new bSearch.Windows.Controls.ColorButton.ColorChangeHandler(NewColor);
            chkRightClickOption.CheckedChanged     += new EventHandler(chkRightClickOption_CheckedChanged);

            // get mainform's image list to use here for up/down buttons
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain));
            System.Windows.Forms.ImageList ListViewImageList         = new ImageList();
            ListViewImageList.ImageStream      = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("ListViewImageList.ImageStream")));
            ListViewImageList.TransparentColor = System.Drawing.Color.Transparent;
            ListViewImageList.Images.SetKeyName(0, "");
            ListViewImageList.Images.SetKeyName(1, "");

            btnUp.ImageList    = ListViewImageList;
            btnUp.ImageIndex   = 0;
            btnDown.ImageList  = ListViewImageList;
            btnDown.ImageIndex = 1;

            API.ListViewExtensions.SetTheme(lstFiles);
            API.ListViewExtensions.SetTheme(TextEditorsList);
            API.ListViewExtensions.SetTheme(PluginsList);
        }
コード例 #3
0
        public static ShortcutsVM ShortcutsToVM(Shortcuts shortcuts)
        {
            ShortcutsVM shortcutsVM = new ShortcutsVM(shortcuts.Version);

            shortcutsVM.WindowItemVMs = WindowItemsToVMs(shortcuts.WindowItems);
            return(shortcutsVM);
        }
コード例 #4
0
        private void saveButton_Click(object sender, RoutedEventArgs e)
        {
            string fullName = fullNameField.Text;
            string phone    = phoneNumberField.Text;
            string address  = addressField.Text;
            string serial   = serialField.Text;

            var _validation = Shortcuts.checkIfEmptyString(fullName, phone, address, serial);

            if (_validation || selectDocument.SelectedItem == null)
            {
                MessageBox.Show("Все поля обязательны!");
                return;
            }

            var documentType = (DocumentType)selectDocument.SelectedItem;

            Profile profile = new Profile
            {
                FullName        = fullName,
                DocumentType    = documentType.DocumentTypeID,
                SeriesAndNumber = serial,
                Address         = address,
                PhoneNumber     = phone
            };

            db.Profiles.Add(profile);
            db.SaveChanges();

            MessageBox.Show("Успешно!");
            this.Close();
        }
コード例 #5
0
        private void OnLogoutCommand(object obj)
        {
            DialogResult _result = MessageBox.Show("로그아웃 하시겠습니까?", "로그아웃", MessageBoxButtons.OKCancel);

            if (_result != DialogResult.OK)
            {
                return;
            }
            try
            {
                ((RemoteRepository)App.Repo).UpdateAuth(new Auth());
            }
            catch
            {
            }
            finally
            {
                App.Repo = new LocalRepository();
                App.Repo.Load();
                _repo = App.Repo;
                Shortcuts.Clear();
                foreach (var item in App.Repo.ShortcutItems)
                {
                    Shortcuts.Add(item);
                }
                CurrentAuth.UserName = "******";
                App.EA.GetEvent <ItemChanged>().Publish(new List <ShortcutModel>(App.Repo.ShortcutItems));
            }
        }
コード例 #6
0
ファイル: App.xaml.cs プロジェクト: ervingegprifti/MDSHO
        private void SetDataContext()
        {
            try
            {
                Shortcuts shortcuts = null;
                if (IsFirstTimeRun())
                {
                    // This is the first time the application is runing.
                    shortcuts = NewData.NewShortcuts();
                    SaveData.SaveShortcuts(shortcuts, true);
                }
                else
                {
                    // This is not the first time the application is runing.
                    // Get the shortcuts data
                    shortcuts = ShortcutsData.GetShortcuts();

                    // If shortcuts is null then perhaps the sortcut data file is corrupted.
                    if (shortcuts == null)
                    {
                        MessageBoxResult messageBoxResult = MessageBox.Show("For some reason shortcuts are corrupted.\nReseting shortcuts.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        shortcuts = NewData.NewShortcuts();
                        SaveData.SaveShortcuts(shortcuts, true);
                    }
                }
                DataContext = ContextHelper.ShortcutsToVM(shortcuts);
            }
            catch (Exception ex)
            {
                Error.ShowDialog(ex);
            }
        }
コード例 #7
0
        public MainPresenter(AppController controller)
        {
            //inicialização dos controles
            this.controller    = controller;
            this.mainWindow    = new MainWindow(this);
            this.mainPage      = new Main(this);
            this.principalPage = new Principal(this);
            this.shortcutsPage = new Shortcuts(this);

            //carregamento de paginas e conteudos visuais adicionais
            this.mainWindow.principal.Navigate(this.principalPage);
            this.mainWindow.shortcuts.Navigate(this.shortcutsPage);

            //carregamento dos dados
            IEnumerable <Testamento> testamentos = from Testamento t in controller.DefaultContainer
                                                   select t;
            IEnumerable <Livro> livros = from Livro l in controller.DefaultContainer
                                         select l;

            this.textSuggest   = new SimpleTextSuggester(livros, ActivateSbItem);
            this.sbItemSuggest = new SimpleSbItemSuggester(livros, ActivateSbItem);

            this.shortcutsPage.Traducoes   = (new SbDbManager()).Databases;
            this.shortcutsPage.Testamentos = testamentos;

            //carregamento das configurações salvas
            this.principalPage.busca.Text = this.controller.DefaultTerm;

            //exibição do site no primeiro acesso ou em uma atualização de versão
            if (Settings.Default.VersaoVisualizadaNoSite != Application.ResourceAssembly.GetName().Version.ToString())
            {
                StaticContentGenerator.OpenSite(Resources.linkSitePrimeiroUso);
                Settings.Default.VersaoVisualizadaNoSite = Application.ResourceAssembly.GetName().Version.ToString();
            }
        }
コード例 #8
0
        private void createDiscussionBoxes(IEnumerable <Discussion> discussions)
        {
            foreach (Discussion discussion in discussions)
            {
                if (!SystemFilter.DoesMatchFilter(discussion))
                {
                    continue;
                }

                SingleDiscussionAccessor accessor = Shortcuts.GetSingleDiscussionAccessor(
                    _gitLabInstance, _modificationListener, _mergeRequestKey, discussion.Id);
                DiscussionBox box = new DiscussionBox(this, accessor, _git, _currentUser,
                                                      _mergeRequestKey.ProjectKey, discussion, _mergeRequestAuthor,
                                                      _diffContextDepth, _colorScheme,
                                                      // pre-content-change
                                                      (sender) =>
                {
                    SuspendLayout();
                    sender.Visible = false; // to avoid flickering on repositioning
                },
                                            // post-content-change
                                                      (sender, lite) =>
                {
                    // 'lite' means that there were no a preceding PreContentChange event, so we did not suspend layout
                    updateLayout(null, true, lite);
                    updateSearch();
                    _onDiscussionModified?.Invoke();
                }, sender => MostRecentFocusedDiscussionControl = sender)
                {
                    // Let new boxes be hidden to avoid flickering on repositioning
                    Visible = false
                };
                Controls.Add(box);
            }
        }
コード例 #9
0
        async private Task connectToUrlAsyncInternal(string url, UrlParser.ParsedMergeRequestUrl parsedUrl)
        {
            labelWorkflowStatus.Text = String.Format("Connecting to {0}...", url);
            MergeRequestKey mrk = parseUrlIntoMergeRequestKey(parsedUrl);

            GitLabInstance gitLabInstance = new GitLabInstance(mrk.ProjectKey.HostName, Program.Settings);
            MergeRequest   mergeRequest   = await Shortcuts
                                            .GetMergeRequestAccessor(gitLabInstance, _modificationNotifier, mrk.ProjectKey)
                                            .SearchMergeRequestAsync(mrk.IId, false);

            if (mergeRequest == null)
            {
                throw new UrlConnectionException("Merge request does not exist. ", null);
            }
            labelWorkflowStatus.Text = String.Empty;

            bool canOpenAtLiveTab = mergeRequest.State == "opened" && checkIfCanOpenAtLiveTab(mrk, true);
            bool needReload       = (canOpenAtLiveTab && getDataCache(canOpenAtLiveTab).MergeRequestCache == null) ||
                                    mrk.ProjectKey.HostName != getHostName();

            if (needReload)
            {
                Trace.TraceInformation("[MainForm.ExternalCalls] Restart workflow for url {0}", url);
                await restartWorkflowByUrlAsync(mrk.ProjectKey.HostName);
            }

            if (!canOpenAtLiveTab || !await openUrlAtLiveTabAsync(mrk, url, !needReload))
            {
                await openUrlAtSearchTabAsync(mrk);
            }
        }
コード例 #10
0
ファイル: Purpose.cs プロジェクト: XZelnar/MicroWorld
 public override void onMouseMove(InputEngine.MouseMoveArgs e)
 {
     base.onMouseMove(e);
     e.Handled = true;
     int x = 5;
     int y = 30;
     for (int i = 0; i < compToDraw.Count; i++)
     {
         //compToDraw[i].DrawAt((int)pos.X + x, (int)pos.Y + y);
         Rectangle r = new Rectangle((int)pos.X + x, (int)pos.Y + y, 40, 40);
         Point p = new Point(e.curState.X, e.curState.Y);
         if (r.Contains(p))
         {
             Shortcuts.SetInGameStatus(
                 compToDraw[i].ComponentGraphics.GetCSToolTip() + " (" + compToDraw[i].Avalable.ToString() + " avalable)", "");
             return;
         }
         x += 50;
         if (x >= size.X)
         {
             x = 0;
             y += 50;
         }
     }
 }
コード例 #11
0
        private void AddItem()
        {
            var item = new ShortcutViewModel();

            Shortcuts.Add(item);
            SelectedItem = item;
        }
コード例 #12
0
        private void saveButton_Click(object sender, RoutedEventArgs e)
        {
            string name  = nameField.Text;
            string phone = phoneField.Text;

            var _validation = Shortcuts.checkIfEmptyString(name);

            if (_validation)
            {
                MessageBox.Show("Заполните поля отмеченныее (*)!");
                return;
            }

            if (String.IsNullOrEmpty(phone))
            {
                phone = null;
            }

            Company company = new Company
            {
                Name        = name,
                PhoneNumber = phone
            };

            db.Companies.Add(company);
            db.SaveChanges();

            MessageBox.Show("Успешно!");
            this.Close();
        }
コード例 #13
0
ファイル: Program.cs プロジェクト: L-Dogg/ASD2
        private bool ValidatePath(Location[] path)
        {
            Location previous = path[0];
            int      length   = 0;

            for (int i = 1; i < path.Length; i++)
            {
                if (previous.X < path[i].X && previous.Y < path[i].Y)
                {
                    if (!Shortcuts.Contains(previous))
                    {
                        return(false);
                    }

                    length += ShortcutLength;
                }
                else
                {
                    length += SideLength;
                }

                previous = path[i];
            }

            return(length == ExpectedResult);
        }
コード例 #14
0
        private void OnLoginCommand(object obj)
        {
            if (_loginWindow != null)
            {
                return;
            }

            _loginWindow = new LoginWindow(_repo.Auth);
            _loginWindow.ShowDialog();

            if (_loginWindow.DialogResult == true)
            {
                var remoteRepo = new RemoteRepository();
                _repo = remoteRepo;
                remoteRepo.UpdateAuth(_loginWindow.Auth);
                _repo.Load();
                App.Repo = _repo;

                CurrentAuth.UserName = _repo.Auth.UserName;

                Shortcuts.Clear();
                foreach (var item in _repo.ShortcutItems)
                {
                    Shortcuts.Add(item);
                }

                App.EA.GetEvent <ItemChanged>().Publish(new List <ShortcutModel>(App.Repo.ShortcutItems));
            }

            _loginWindow = null;
        }
コード例 #15
0
        //Gets Group's shortcut items
        public static List <ShortcutItem> GetShortcuts(string groupName)
        {
            string cfgFile = AppConfig.GetShortcutFile(groupName);

            List <ShortcutItem> groupShortcuts = new List <ShortcutItem>();

            if (System.IO.File.Exists(cfgFile))
            {
                using (FileStream fileStream = new FileStream(cfgFile, FileMode.Open))
                {
                    XmlSerializer serializer = new XmlSerializer(typeof(Shortcuts));
                    Shortcuts     result     = (Shortcuts)serializer.Deserialize(fileStream);

                    if (result != null && result.Items != null)
                    {
                        groupShortcuts.AddRange(result.Items);
                    }
                    else
                    {
                        System.IO.File.Delete(cfgFile);
                    }
                }
            }

            return(groupShortcuts);
        }
コード例 #16
0
ファイル: InputManager.cs プロジェクト: Gomsoz/CardRPGScripts
    void ChckUIShortcuts()
    {
        Shortcuts shortcut = null;

        if (Input.GetKeyDown(KeyCode.I))
        {
            shortcut = button_I;
        }
        else if (Input.GetKeyDown(KeyCode.P))
        {
            shortcut = button_P;
        }
        else if (Input.GetKeyDown(KeyCode.Q))
        {
            shortcut = button_Q;
        }

        if (shortcut == null)
        {
            return;
        }

        Debug.Log(shortcut);
        shortcut.Execute();
    }
コード例 #17
0
        public static void CreateShortcutGroupPolicy(Guid gpoGuid, bool computer, ShortcutsShortcut shortcut)
        {
            if (gpoGuid == null)
            {
                throw new ArgumentNullException("gpoGuid");
            }
            if (shortcut == null)
            {
                throw new ArgumentNullException("shortcut");
            }
            string    filePath  = GetShortcutsPolicyFilePath(gpoGuid, computer);
            Shortcuts shortcuts = XmlSerializeHelper.XmlDeserializeFromFile <Shortcuts>(filePath);

            ShortcutsShortcut[] shotcutsArray = shortcuts.Shortcut;
            if (shotcutsArray != null)
            {
                List <ShortcutsShortcut> current = new List <ShortcutsShortcut>(shotcutsArray);
                current.Add(shortcut);
                shortcuts.Shortcut = current.ToArray();
            }
            else
            {
                List <ShortcutsShortcut> current = new List <ShortcutsShortcut>();
                current.Add(shortcut);
                shortcuts.Shortcut = current.ToArray();
            }
            XmlSerializeHelper.XmlSerializeToFile <Shortcuts>(shortcuts, filePath);
        }
コード例 #18
0
 public override void onMouseMove(InputEngine.MouseMoveArgs e)
 {
     if (isdnd)
     {
         ChangeScale(e.curState.X);
     }
     if (IsIn(e.curState.X, e.curState.Y))
     {
         String s = (Math.Round(Graphics.GraphicsEngine.camera.Scale * 10) / 10f).ToString() + ")";
         s = "X " + s;
         float scrollx = (196 - 17) * (GraphicsEngine.camera.Scale - Camera.ZOOM_MIN) / (Camera.ZOOM_MAX - Camera.ZOOM_MIN);
         Shortcuts.SetInGameStatus("Grid zoom (" + s, "<Ctrl> + Mouse Wheel");
         if (GUIEngine.s_toolTip.isVisible)
         {
             Shortcuts.ShowToolTipNoAnimation(position + new Vector2(scrollx, -1), "Zoom (" + s + ")", ArrowLineDirection.LeftUp);
         }
         else
         if (!GUIEngine.s_toolTip.Text.StartsWith("Zoom ("))
         {
             Shortcuts.ShowToolTip(position + new Vector2(scrollx, -1), "Zoom (" + s + ")", ArrowLineDirection.LeftUp);
         }
     }
     else
     {
         if (GUIEngine.s_toolTip.isVisible &&
             GUIEngine.s_toolTip.Text.StartsWith("Zoom ("))
         {
             GUIEngine.s_toolTip.Close();
         }
     }
 }
コード例 #19
0
        //Gets all shortcut items from the DataTable
        public static List <ShortcutItem> ConvertToShortcut(DataTable dt)
        {
            List <ShortcutItem> lstShortcuts = new List <ShortcutItem>();

            string groupName = dt.TableName;

            using (MemoryStream ms = new MemoryStream())
            {
                //internal name used by program
                dt.TableName = ElementNodeName;
                DataSet ds = new DataSet(ElementRootNodeName);
                ds.Tables.Add(dt);
                ds.WriteXml(ms);
                ms.Seek(0, SeekOrigin.Begin);

                XmlSerializer serializer = new XmlSerializer(typeof(Shortcuts));
                Shortcuts     result     = (Shortcuts)serializer.Deserialize(ms);


                if (result != null && result.Items != null)
                {
                    foreach (ShortcutItem item in result.Items)
                    {
                        item.GroupName = groupName;
                        lstShortcuts.Add(item);
                    }
                }
            }
            return(lstShortcuts);
        }
コード例 #20
0
        async private Task upgradeProjectListFromOldVersion(string hostname)
        {
            if (Program.Settings.SelectedProjectsUpgraded)
            {
                return;
            }

            GitLabClient.ProjectAccessor projectAccessor = Shortcuts.GetProjectAccessor(
                new GitLabInstance(hostname, Program.Settings), _modificationNotifier);

            labelWorkflowStatus.Text = "Preparing workflow to the first launch...";
            IEnumerable <Tuple <string, bool> > projects = ConfigurationHelper.GetProjectsForHost(
                hostname, Program.Settings);
            List <Tuple <string, bool> > upgraded = new List <Tuple <string, bool> >();

            foreach (var project in projects)
            {
                Project p = await projectAccessor.SearchProjectAsync(project.Item1);

                if (p != null)
                {
                    if (!upgraded.Any(x => x.Item1 == p.Path_With_Namespace))
                    {
                        upgraded.Add(new Tuple <string, bool>(p.Path_With_Namespace, project.Item2));
                    }
                }
            }
            ConfigurationHelper.SetProjectsForHost(hostname, upgraded, Program.Settings);
            updateProjectsListView();
            Program.Settings.SelectedProjectsUpgraded = true;
            labelWorkflowStatus.Text = "Workflow prepared.";
        }
コード例 #21
0
        private void registerButton_Click(object sender, RoutedEventArgs e)
        {
            string login          = loginField.Text;
            string password       = passwordField.Password;
            string repeatPassword = repeatPasswordField.Password;

            bool _validation = Shortcuts.checkIfEmptyString(login, password, repeatPassword);

            if (_validation)
            {
                MessageBox.Show("Заполните поля логина и пароля!");
                return;
            }

            if (password != repeatPassword)
            {
                MessageBox.Show("Пароли не совпадают!");
                return;
            }

            string fullName        = fullNameField.Text;
            int    documentType    = ((DocumentType)selectDocumentType.SelectedItem).DocumentTypeID;
            string seriesAndNumber = seriesAndNumberField.Text;
            string address         = addressField.Text;
            string phoneNumber     = phoneField.Text;

            _validation = Shortcuts.checkIfEmptyString(fullName, seriesAndNumber, address, phoneNumber);
            if (_validation)
            {
                MessageBox.Show("Заполните все поля!");
                return;
            }

            User user = new User
            {
                Username = login,
                Password = Shortcuts.hashPassword(password),
                Role     = 0
            };

            db.Users.Add(user);
            db.SaveChanges();

            Profile profile = new Profile
            {
                FullName        = fullName,
                DocumentType    = documentType,
                SeriesAndNumber = seriesAndNumber,
                Address         = address,
                PhoneNumber     = phoneNumber,
                UserID          = user.UserID
            };

            db.Profiles.Add(profile);
            db.SaveChanges();

            MessageBox.Show("Успешно!");
            this.Close();
        }
コード例 #22
0
        private void butReset_Click(object sender, EventArgs e)
        {
            ActionCode action   = (ActionCode)lstShortcuts.SelectedItems[0].Tag;
            Shortcut   shortcut = new Shortcut(action, Shortcuts.GetDefaultKeys(action));

            ShortcutActions.SetShortcuts(shortcut);
            applyShortcutChange(lstShortcuts.SelectedItems[0], shortcut);
        }
コード例 #23
0
 private void LoadShortcuts()
 {
     Shortcuts.Clear();
     foreach (var item in ShortcutServices.LoadExistingShortcuts())
     {
         Shortcuts.Add(new ShortcutViewModel(item));
     }
 }
コード例 #24
0
 public override void onMouseMove(InputEngine.MouseMoveArgs e)
 {
     base.onMouseMove(e);
     if (bRemove.IsIn(e.curState.X, e.curState.Y))
     {
         Shortcuts.SetInGameStatus("Remove component", "");
     }
 }
コード例 #25
0
 internal static void LoadFromResources(string keyboardShortcutsId, out Shortcuts shortcuts)
 {
     using (var ReadFileStream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(keyboardShortcutsId))
     {
         var serializer = new XmlSerializer(typeof(Shortcuts));
         shortcuts = serializer.Deserialize(ReadFileStream) as Shortcuts;
     }
 }
コード例 #26
0
 internal static void AssertCitiesHarmonyInstalled()
 {
     if (!HarmonyHelper.IsHarmonyInstalled)
     {
         Shortcuts.ShowErrorDialog("Error: Missing Harmony", SOLUTION);
         throw new Exception(ERROR_MESSAGE);
     }
 }
コード例 #27
0
 public void Remove(string shortcutName)
 {
     if (!Shortcuts.ContainsKey(shortcutName))
     {
         return;
     }
     Shortcuts.Remove(shortcutName);
 }
コード例 #28
0
        void ApplySettings()
        {
            Shortcuts.RemoveHotKey(this.Handle);

            Shortcuts.ApplyHotKey(this.Handle, options.hotkey, options.modifierhotkey);

            notifyIcon1.Text = string.Format(FreeSnippingTool.CommonStrings.TrayIconToolTip, options.modifierhotkey.ToString(), options.hotkey.ToString());
        }
コード例 #29
0
        void ButtonSearch_Click(object sender, RoutedEventArgs e)
        {
            Shortcuts.SetEnable(ButtonSearch, false);
            var logQueryModel = GridSearchArea.DataContext as LogQueryModel;

            this.DataGridLogList.QueryCriteria = logQueryModel;
            this.DataGridLogList.Bind();
        }
コード例 #30
0
 public override bool ProcessClick(int index)
 {
     if (index == linkId)
     {
         return(Shortcuts.TryExitCurrentNode());
     }
     return(false);
 }